Re[2]: [xsl] Can sets have order?

Subject: Re[2]: [xsl] Can sets have order?
From: Steven.C.Kienle@xxxxxxxxxx
Date: Thu, 25 Jan 2001 14:03:09 -0500
  OK, my turn to jump in.
  My understanding of XPath is that once you have performed the 
  <xsl:variable name="x" select="attribute::*"/>
  Then the node returned by $x[1] will always be the same.  Similarly, 
  the node returned by $x[last()] will always be the same.
  Therefore node-sets DO HAVE ORDER.  Once created, all node sets have 
  an intrinsic ordering, as defined by the [] operand.  The fact that 
  node-sets are ordered, via the [] operand, is very important for 
  nearly all XSLT algorithms.
  What the XSLT recommendation does not do, however, is clearly define 
  what the document, or _external_, related ordering is.
  When a mathematician says a set is unordered, he really means that 
  there is _no way_ to determine if one set element comes before 
  another.  In XSLT, at least in theory, it is possible by walking 
  through the node set until one or the other is found.  The first one 
  found is before the one not found.
  Alright, I'll get of my mathematical soapbox.

______________________________ Reply Separator _________________________________
Subject: Re: [xsl] Can sets have order?
Author:  David Carlisle <davidc@xxxxxxxxx> at Internet-America
Date:    25-01-2001 5:47 PM

Just noticed you said:
> > It just constructs the set of ancestors.
> In a particular order, right?  Do you claim that it can return a node set in 
> any order besides reverse document order?
YES!!! If you want to claim that it returns a node set that is ordered, 
it is ordered in document order.
<xsl:variable name="x" select="attribute::*"/>
OK so $x is a node set. If it is ordered, then presumably
<xsl:copy-of select="$x[1]"/>
is it's first element, no?
well it gets the outer most element, the relevant order being document 
order not reverse document order.
If $x was an odered set ordered by reverse document order, then 
<xsl:copy-of select="$x[1]"/>
would be the same as
<xsl:copy-of select="ancestor::*[1]"/>
and select the parent.
It is in explaining why 
<xsl:copy-of select="$x[1]"/>
isn't the same as
<xsl:copy-of select="ancestor::*[1]"/>
that it is helpful to stress that the node set $x is just a set, that it 
doesn't "remember" that it was constructed in reverse order. In other 
words the ordering isn't a property of the set $x.
 XSL-List info and archive:

 XSL-List info and archive:

Current Thread