xsl-list
[Top] [All Lists]

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

2008-02-09 03:14:23

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/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>