Re: [xsl] Comparing and re-assigning variables.

Subject: Re: [xsl] Comparing and re-assigning variables.
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Mon, 24 Feb 2003 14:22:09 +0000
Have you considered a two-pass approach, reading and sorting your information in the first step into an intermediate result tree and then chaining to a second step that can address your information in the new already-sorted intermediate as a source node tree?

A computationally intensive one-pass approach that may be a candidate for you if the sorted collection is small is to revisit the sorted node list repeatedly for each member of the sorted node list in order to extract into result tree fragment variables indexed members based on their position relative to the position of the current node in the sorted list. This is not typically advised though because of the many many loops through the source information.

I hope this helps.

.......................... Ken

Just a newbie question concerning this issue...

I have never tried putting a for-each inside a variable, but if that is possible in the specs, could you then not do something like:

<xsl:variable name="SorterList">
 <xsl:for-each select="report-root/txns">
   <xsl:sort select="cpmBI"/>
   <xsl:sort select="date"/>

<xsl:variable name="SortList2" select="document('')/xsl:stylesheet/xsl:template/xsl:variable[@name='SortList']/cpmMemBI"/>

Then loop trough SortList2 and get the values of the current and preceding cpmMemBI element?

I don't know if this is at all possible (and if the syntax should differ), but I think this would be easier than a two-pass solution.


Ragulf Pickaxe :)

The new MSN 8: advanced junk mail protection and 2 months FREE*

XSL-List info and archive:

Current Thread