Subject: [xsl] 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) |
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: http://aspn.activestate.com/ASPN/Mail/Message/xsl-list/955081 and a totally different one in http://aspn.activestate.com/ASPN/Mail/Message/xsl-list/956248 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. Cheers, Dimitre. __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Assignment no, dynamic scoping , Joerg Pietschmann | Thread | [xsl] Hopefully not a terribly sill, Morgan Goeller |
Re: [xsl] unique elements from diff, Jeni Tennison | Date | RE: [xsl] Re: XPath incompatibiliti, Joerg Pietschmann |
Month |