This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
position() oddity?
Given test.xml
<?xml version="1.0"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="test.xsl" type="text/xsl"?>
<headers>
<title>First</title>
<title>Second</title>
<title>Third</title>
<title>Fourth</title>
<title>Fifth</title>
</headers>
what would you expect position() in template match "headers/title" to
return? Currently it returns 2 4 6 8 10 using test.xsl (appended) when
run through xt and cocoon. It's not quite what I expected (1 2 3 4 5 :-)
///Peter
--
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
<xsl:output method="html"/>
<xsl:template match="/">
<html><body><table>
<xsl:apply-templates/>
</table></body></html>
</xsl:template>
<xsl:template match="headers">
<tr>
<xsl:apply-templates/>
</tr>
</xsl:template>
<xsl:template match="headers/title">
<td>
<xsl:value-of select="position()"/>
</td>
<td>
<xsl:apply-templates/>
</td>
</xsl:template>
</xsl:stylesheet>
///Peter
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list