Subject: RE: About position() in xsl:for-each-group
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 9 Feb 2008 10:13:57 -0000
|
> 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/
|