[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XPATH or 2 templates ?

Subject: XPATH or 2 templates ?
From: Delaney Robin <Robin.Delaney@xxxxxxx>
Date: Mon, 18 Nov 2002 13:21:37 +0100
xpath 101
This is driding me nuts. If anyone can help I'd appreciate
The only node-name I know exists is <Concat>. 

If I template-match on <Concat> then I get the correct text for the 1st part
and not for the 2nd although it's close 
If I template-match on <Concat/*> then I get the correct text for the 2nd
part but not for the first !

Why can I not have template match on <Concat> and <Concat/*> within the same
stylesheet ? 

XML

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="E:\Zvxml\XtraTest\Test.xsl"?>
<Concat>
	<Zula>
		<Ver>101</Ver>
		<Mandant>
			<Anbiete>0204268270</Anbiete>
		<Adresse>
				<Strasse>Versicherungsstr. 1</Strasse>
				<Ort>Offenburg</Ort>
			</Adresse>
		</Mandant>
	</Zula>
	<Zula>
		<Ver>202</Ver>
		<Mandant>
			<Anbiete>0204268270</Anbiete>
			<Adresse>
				<Strasse>Versicherungsstr. 1</Strasse>
				<Ort>Offenburg</Ort>
			</Adresse>
		</Mandant>
	</Zula>
</Concat>


XSL

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="text"/>
 	<xsl:template match="Concat">
			<xsl:for-each select="*[1]//*[not(*)]">
--> 1st part
				<xsl:value-of select="local-name()"/>	
				<xsl:if test="position()!=last()">;</xsl:if>

			</xsl:for-each> 

  		<xsl:text>&#13;</xsl:text> 

  		  	<xsl:for-each select="//*[not(*)]">
				<xsl:value-of select="node()"/>
--> 2nd Part
				<xsl:if test="position()!=last()">;</xsl:if>

			</xsl:for-each> 
		<xsl:text>&#13;</xsl:text> 	

  	</xsl:template>
  </xsl:stylesheet>
 
Output:
Ver;Anbiete;Strasse;Ort 
101;0204268270;Versicherungsstr. 1;Offenburg;202;0568324;Bahnhofstr.
1;Offenburg 

I Need:
Ver;Anbiete;Strasse;Ort 
101;0204268270;Versicherungsstr. 1;Offenburg  
202;0204268270;Versicherungsstr. 1;Offenburg 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.