[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: The Solution -- Re: how to rearrange nodes bas

Subject: Re: Re: The Solution -- Re: how to rearrange nodes based on a dependency graph?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 3 Jan 2002 08:23:37 -0800 (PST)
bas code for permutation
Joerg Pietschmann <joerg dot pietschmann at zkb dot ch> wrote:

> > - --- Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> > > As beautifully as this is designed, the only sad thing is that
> > > it can't work without using some Microsoft (or other) extension.
> There is a XSLT code for topological sort available which doesn't
> rely on xx:node-set(), last seen at
>  http://www.dpawson.co.uk/xsl/sect2/N6461.html#d195e853

This is the same algorithm as the one I used in:


and a totally different one in


the latter solution takes care not to mix together the different components of
connectivity. It requires a non-document-order, which means that an RTF must be
produced and the xx:node-set() function used, if the results are not simply to be
output, but available for use during the same transformation.

> Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> > It is true, that without the xx:node-set() function, XSLT 1.0 is 50%
> > crippled.
> Well, that's somewhat bold. I was able to get rid of xx:node-set() i
> most cases i was tempted to use it, by sacrificing readability.
> I agree that abandoning RTFs is a good idea in general, but variables
> holding constructed node sets have it's own set of pitfalls attached,
> and we'll see a lot of abuse of this feature once it is the standard.

The xx:node-set() function is necessary in case nodes must be re-ordered and used
later during the same transformation -- an alternative is to keep them in several
xsl:variable s in document order and to process the variables in the desired order.
However, in the general (dynamic) case, when the number of inversions can be any
arbitrary possible number, this will not work. For example, if all permutations of N
nodes have to be produced and used later in the same transformation.

One could, as an extreme case, work with a string concatenation of nodes indexes
(e.g. their generate-id()). However, this is difficult and error-prone, and the
resulting code is hardly readable.

To sacrifice so much simply to get rid of the almost standard xx:node-set() function
is, in my opinion, simply not worth the effort.


Do You Yahoo!?
Send your FREE holiday greetings online!

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.