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

RE: About position() in xsl:for-each-group

Subject: RE: About position() in xsl:for-each-group
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 9 Feb 2008 10:13:57 -0000
RE:  About position() in xsl:for-each-group
> Am I the only one to find odd that "position()" evaluates to 
> the position of the current group instead of 1, i.e., the 
> position of the first city in the current group (contrast 
> with "@country")?

It seems logical to me: xsl:for-each-group iterates over the groups, so it
makes sense that within the body of the instruction, position() ranges from
1 to last(), and last() gives the number of iterations. This provides a way
of numbering the groups, knowing how many groups there are, testing whether
the current group is the last, and so on.

@country is a property of a node. position() is not a property of a node, it
is a property of an iteration over a sequence. So it's reasonable that they
should behave differently.

Michael Kay
http://www.saxonica.com/

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-2011 All Rights Reserved.