This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: position() problem with // axis + parent numbering problem




> -----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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]