I'm having trouble using position() in the following situation. The xml
looks like this:
<root>
<page>
<line>
<w>one</w> <w>two<note text="first note"/></w>
<w>three</w>
</line>
<line>
<w>four</w> <w>five</w> <w>six<note text="second
note"/></w>
</line>
<line>
<w>seven<note text="third note"/></w>
<w>eight</w> <w>nine</w>
</line>
</page>
<page>
<line>
<w>ten</w> <w>eleven<note text="4th note"/></w>
<w>twelve</w>
</line>
<line>
<w>thirteen</w> <w>fourteen</w> <w>fifteen<note
text="5th note"/></w>
</line>
<line>
<w>sixteen<note text="6th note"/></w>
<w>seventeen</w> <w>eighteen</w>
</line>
</page>
</root>
And the xsl file like this:
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="root/page"/>
<br/>
<xsl:text>Notes:</xsl:text>
<br/>
<xsl:for-each select="//note">
<xsl:value-of select="position()"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@text"/>
<br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="page">
<xsl:apply-templates select="line"/>
<hr/>
</xsl:template>
<xsl:template match="line">
<xsl:apply-templates/>
<br/>
</xsl:template>
<xsl:template match="w">
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:if test="note">
<span
style="vertical-align:super;font-size:7pt">*</span>
<!-- --------------------------------------------------------^ position
should go here -->
</xsl:if>
</xsl:template>
Instead of the asterisk in the <span>, I'd like to put the value of the
position of the <note> there, just like I did in the root template
(where it works as it should), but I can't get the correct value there.
Has anyone got any ideas on how to do this?
Mick
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list