Re: [xsl] position

Subject: Re: [xsl] position
From: Thomas Rasmussen <tbr77@xxxxxxxxxxxx>
Date: Sat, 14 Feb 2004 16:17:34 +0100
G. Ken Holman wrote:

At 2004-02-14 14:02 +0100, m.vanrootseler@xxxxxxxxx wrote:

The facility to count items in the source node tree is <xsl:number>:

<xsl:number count="note" level="any"/>

just like I did in the root template
(where it works as it should),

"it works" because of how you prepared your current node list. It is also working in your other match, but you haven't prepared the current node list accordingly, so you cannot use position() because it is based solely on the current node list.

I hope this helps.

............................ Ken

I was about to suggest using <xsl:number> too, so I made a small example, but the first note is not treated as I would expect it to be?
sabloton will not parse the xsl complaining about "number is not positive"
saxon does not number the first node, probably treating it as NAN
xalan numbers the first node 0
So the following only works in Xalan (and it is probably a hack)
<xsl:template match="w">
<xsl:text> </xsl:text>
<xsl:if test="note">
<xsl:variable name="tmp"><xsl:number count="note" format="1" level="any"/></xsl:variable>
style="vertical-align:super;font-size:7pt"><xsl:value-of select="$tmp+1"/></span>

What am I doing wrong?


XSL-List info and archive:

Current Thread