[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: position

Subject: Re: position
From: Thomas Rasmussen <tbr77@xxxxxxxxxxxx>
Date: Sat, 14 Feb 2004 16:17:34 +0100
thomas rasmussen
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:apply-templates/>
<xsl:if test="note">
<xsl:variable name="tmp"><xsl:number count="note" format="1" level="any"/></xsl:variable>
<span
style="vertical-align:super;font-size:7pt"><xsl:value-of select="$tmp+1"/></span>
</xsl:if>
</xsl:template>


What am I doing wrong?

Thomas

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.