Michael Kay wrote:
> you can get the Nth item in a sequence using SEQ[N].
> In the rare cases where that's inconvenient because
> it changes the evaluation context, you can use
> subsequence(SEQ, N, 1).
When can this happen? Can you show an example?
Regards,
--drkm
Michael meant that to be a meta-expression with SEQ and N standing for
Xpath expressions, but if you take them as real examples with SEQ and N
being Xpath expressions selecting elements SEQ and N respectively then
you have an example where SEQ[N] and subsequence(SEQ, N, 1) are not
equivalent, as in the first N selects children of the current node (and
may have a different value for each SEQ element) and in the second N selects
an N element child from the current node (which will then be a sibling
not a child of SEQ) and this value will be cast to an integer.
so
<x>
<N>1</N>
<SEQ>1<N>6</N></SEQ>
<SEQ>2</SEQ>
<SEQ>3<N>3</N></SEQ>
</x>
SEQ[N] selects the first and third SEQ (as they have N children)
SEQ[number(N)] selects the third SEQ (as that is the only one with an N
child equal to its position())
SEQ[N] selects the first SEQ child as N selects an element whose value
can be cast to the integer 1.
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
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--