---
title: "formatera xml data med xsl 2"
type: "forum-thread"
url: "https://www.webforum.nu/amne/xml/104040-formatera-xml-data-med-xsl-2"
topic: "XML"
topic_url: "https://www.webforum.nu/amne/xml"
author: "Mc Fetto"
published: "2004-05-21T16:14:39.000Z"
updated: "2004-05-22T08:19:30.000Z"
replies: 1
views: 211
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/xml/104040-formatera-xml-data-med-xsl-2"
---

# formatera xml data med xsl 2

## #1 — Mc Fetto, 2004-05-21T16:14Z

har följande soap fil:

```
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
 <soapenv:Body>
  <ns1:getNewsTitlesFromGroupResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:weiii">
   <getNewsTitlesFromGroupReturn xsi:type="ns2:ArrayOf_xsd_string" soapenc:arrayType="ns3:string[10]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:weii" xmlns:ns3="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <item>Security standard approved by OASIS</item>
    <item>webMethods join WSCC as Partners</item>
    <item>OASIS members approve CAP standard</item>
    <item>W3C updated drafts of WSDL 2.0</item>
    <item>SAP, IBM integrate platforms</item>
    <item>WRQ supports Visual Studio .NET</item>
    <item>World`s first Web Services Certification Program starts April 22</item>
    <item>BEA, IBM propose BPEL for Java</item>
    <item>Examensjobb Ã¶kar IT-fÃ¶retagens konkurrenskraft</item>
    <item>Manage eBay auctions from Excel</item>
   </getNewsTitlesFromGroupReturn>
  </ns1:getNewsTitlesFromGroupResponse>
 </soapenv:Body>
</soapenv:Envelope>
```

och följande xsl fil

```
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- Match The Root Node -->
	<xsl:template match="/">
		<HTML>
		    <HEAD>
			<TITLE>WSCC News</TITLE>
		    </HEAD>
		    <BODY>
			<h1 align="center">All the news</h1>
			<ol>
			<xsl:apply-templates/>
			</ol>                
		    </BODY>
		</HTML>
	</xsl:template>

	<xsl:template match="getNewsTitlesFromGroupReturn">

	      <xsl:for-each select="item">
		<xsl:value-of select="@item"/>
	      </xsl:for-each>

	</xsl:template>

	<xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
		<xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
	</xsl:template>

</xsl:stylesheet>
```

Jag har problem med att få ut \<item\>, hur kan man göra detta?

Permalänk: https://www.webforum.nu/p/104040

## #2 — Mc Fetto, 2004-05-22T08:19Z

löste det på följande sätt:

```
	<xsl:template match="getNewsTitlesFromGroupReturn">

	      <xsl:for-each select = "//item" > 
	      	<li>
	          <xsl:value-of select = "." /> 
		</li>
               </xsl:for-each> 	

	</xsl:template>
```

Permalänk: https://www.webforum.nu/p/1352253

---

Tråden på webben: https://www.webforum.nu/amne/xml/104040-formatera-xml-data-med-xsl-2
