xsl-list
[Top] [All Lists]

XPATH or 2 templates ?

2002-11-18 05:21:37
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



<Prev in Thread] Current Thread [Next in Thread>