[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Fwd: XSLT 2.0 Determining Position of Sequence Ite
> I have a simple xpath expression like this > > for $x in (10 to 20) return $x > > which simply return the sequence of integers between 10 and 20 > > Now, what if I wanted to return something like this instead > from the same sequence > > 1 2 3 4 ... 11 > > I want to get access to the "position" of $x in the sequence, > and also the total number of items in the sequence. > > I tried something like this > > for $x in (10 to 20) return $x/position() XQuery has for $x at $p in (10 to 20) return $p where $x will range from 10 to 20 while $p ranges from 1 to 11. But that's not available in XPath. In XPath you have to resort to for $p in 1 to 11 ... But if you really want to use position(), you can go back to <xsl:for-each select="10 to 20"> .... Michael Kay http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|