XSLT does dot recognise XPATH statement when XSL does
consider the document:
Code:
[color="royal blue"]<xmldata>
<xml some namespace data>
<rs:data>
<z:row cust_name="Bill" />
<z:row cust_name="Frank" />
<z:row cust_name="Joe" />
</rs:data>
</xml>
</xmldata>[/color]
I have a stylesheet using xsl that prints out my rows nicely. When I change it to xslt (because I want to use the position() function), the xpath statement used in my template match criteria no longer finds my rows. I believe this is due to the namspaces in the xml document. (like it can't find <rs:data>. but if the xml were different, it would find <data>. The xml's not going to change, and I'd rather not try to style it once before I style it again. any suggestions as to what to do?
Code:
[color="royal blue"]<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/TR/WD-xsl"
>
<!-- This works, but I can't use the position() function with it. //-->
<!-- If I switch the xsl namespace URI to be XSLT
(http://www.w3.org/1999/XSL/Transform),
it doesn't produce my rows anymore //-->
<xsl:template match="/">
<TABLE>
<TR>
<TD>Customer Name</TD>
<TD>Rank</TD>
</TR>
<xsl:apply-templates select="/xmldata/xml/rs:data/z:row" />
<!-- this is where the problem lies -->
</TABLE>
</xsl:template>
<xsl:template match="/xmldata/xml/rs:data/z:row">
<TR>
<TD><xsl:value-of select="@cust_name" /></TD>
<TD><xsl:value-of select="position()" /></TD>
</TR>
</xsl:template>
</xsl:stylesheet>
[/color]