This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: position() problem with // axis + parent numbering problem
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: position() problem with // axis + parent numbering problem
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Tue, 18 Apr 2000 11:28:32 +0100
- Reply-To: xsl-list at mulberrytech dot com
> -----Original Message-----
> From: Warren Hedley [mailto:w.hedley@auckland.ac.nz]
> Sent: 18 April 2000 10:51
> To: xsl-list@mulberrytech.com
> <xsl:for-each select="//text[1]">
> <xsl:text>First node (</xsl:text>
> <xsl:value-of select="position()" />
> <xsl:text>) = `</xsl:text>
> <xsl:value-of select="." />
> <xsl:text>'
> </xsl:text>
> </xsl:for-each>
>
> <xsl:for-each select="//text[not(position() = 1)]">
> <xsl:text>Text (</xsl:text>
> <xsl:value-of select="position()" />
> <xsl:text>) = `</xsl:text>
> <xsl:value-of select="." />
> <xsl:text>'
> </xsl:text>
> </xsl:for-each>
>
You're getting confused here between position() inside a predicate and
position() outside a predicate. The position() you're testing in the
for-each expression is the position of the <text> element relative to its
siblings. The position() you're evaluating in the value-of expression is the
position within the set of things being processed by the for-each. XSLT may
be side-effect free, but it's not context-free!
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list