Re: [xsl] Sequences in XSLT 2.0..

Subject: Re: [xsl] Sequences in XSLT 2.0..
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 14 Mar 2005 17:18:45 GMT
> Now everything is a sequence.
> Earlier everything was a node-set.

not quite true. In XSLT2 everything is a sequence but in xslt1 atomic
values such as numbers and strings were not in a node set or a sequence.

One advantage of sequences is that you can store sequences of strings
etc ("a","b", ....)

The other is that sequences become first class objects that may be saved
in variables and re-used. XSLT1 had sequences (called lists there)
but these were just transient objects "the current node list"
that could not be stored.

If you go select="ancestor::*[2]" then just inside the step the current
node list is the ancestors in reverse document order so [2] selects your
grandparent, but this could not be stored, 
,xsl:variable name="x" select="ancestor::*"/>
selects the unordered set of ancestors then 
orders that set in document order so [2] selects teh grandchild of the
document element.

Similarly inside
<xsl:for-each select="zzzz">
 <xsl:sort select="mmm"/>

the current node list is the ordered list sorted by mmm but that list
can not be saved in order, if you need it again later you have to
re-sort. In XSLT2 sorted sequences can be saved.

Other reasons have to do with alignment with xsd schema but they are,
natutrally:-) almost all bad, but on balance ordered sequences are
probably a good thing (although perhaps they might have been better
still if they had allowed sequences of sequences)


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:

Current Thread