Re: [xsl] Select nodes with equal position

Subject: Re: [xsl] Select nodes with equal position
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sat, 2 Apr 2005 19:58:37 +0100
using a variable is a sensible way to go But don't do this

  <xsl:variable name="mypos">
    <xsl:value-of select="position()"/>
  </xsl:variable>

It doesn't store a number in $mypos it stores a result tree fragment
with a root node with child a text node with string value the decimal
expansion of teh number. This is expensive to build, and has to be
converted back to a number before you use it.

  <xsl:variable name="mypos" select="position()"/>

stores a number in $mypos.

If you really object to variables

  <xsl:value-of select="../../colspec[position() = count(current()/preceding-sibling::entry)+1]/@colname"/>

but that's likely to be slower

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread