xsl-list
[Top] [All Lists]

Re: Comparing and re-assigning variables.

2003-02-24 07:22:09
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>

<xsl:variable name="SortList2" select="document('')/xsl:stylesheet/xsl:template/xsl:variable[(_at_)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.

Comments...?

Ragulf Pickaxe :)


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


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