## Re: [xsl] Re: The Solution -- Re: how to rearrange nodes based on a dependency graph?

 Subject: Re: [xsl] Re: The Solution -- Re: how to rearrange nodes based on a dependency graph? From: Gunther Schadow Date: Fri, 21 Dec 2001 17:43:16 -0500
Dimitre Novatchev wrote:

It is true, that without the xx:node-set() function, XSLT 1.0 is 50%
crippled.

Ah well, the uglyness of reality. Sigh.

```but apparently this orders things in the document order, not
in the order specified. It's weird that the XPath spec talks
about node sets when in reality they are ordered. And all of
this only to prevent the user from rearranging the ordering.
```

Sets are un-ordered by definition. Document order is a "canonical ordering" so that
everybody will enumerate a set in a standard way. In the same way in mathematics we
may enumerate a set of numbers by their increasing value. Everybody knows that this
is just for convenience and that sets do not have order.

Obviously, there had to be such canonical ordering.

```The xx:node-set() function is necessary in case nodes must be re-ordered and used
later during the same transformation.
```

```Hmm, I wonder, however, if the notion of node *set* is really
appropriate for most of the use cases here. Why did they not
call it node-sequence? The sequence of stuff is what we're
specs, I discovered a related problem with your topological
sort. As beautiful as it is, it disturbs document order where
it isn't warranted by the dependencies. For example, let's
say I have 3 cliques of dependent nodes and no link between
them. What happens with top sort is that those three cliques
are all intermingled. The trick is to keep the document sort
order if it doesn't need to be changed. I may end up to go
back to my naive check-off list approach (recurse through
node list and walk the dependencies, always propagating a node
set of already processed nodes, and checking that a node
isn't in the done set before processing it. I couldn't make
this to work only because I refused to use the node-set function.
Now I am free to do so :-)```

```regards
-Gunther```

```--