RE: [xsl] sorted for-each: preceding::sibling is not in sort order

Subject: RE: [xsl] sorted for-each: preceding::sibling is not in sort order
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 13 Nov 2005 18:23:53 -0000
> > XSLT 2.0 allows you to use xsl:sequence
> > instead of xsl:copy-of, so you can construct a variable 
> whose value is a
> > sequence of nodes (node references) without making copies 
> of the nodes.
> 
> Wouldn't I once again have the problem with
> preceding::sibling when they are references?

Yes, this doesn't enable you to use preceding-sibling; what it does do is to
enable you to create a variable whose value is a sorted sequence of nodes,
each of which retains its original owner and children, etc, without copying
the nodes; you can then process this sequence using a variety of new XSLT
2.0 and XPath 2.0 constructs that make it unnecessary to use
preceding-sibling.

IIRC correctly, though, your problem was a grouping problem in which case
you can probably solve it directly using XSLT 2.0's for-each-group
construct.

Michael Kay
http://www.saxonica.com/

Current Thread