This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: sorting using a precalculated value



> I was ready to build a temporary tree but was wondering if I there was a
> cleaner solution.

looking at your example code it looks like you are trying to build a
sort key that is just the concatenation of the name attributes
from ancestor class elements.

Isn't sorting on such a concatenation would seem the same as 
sorting at each level of the tree separately.
then you could use a sort key of @name.

so instead of


<xsl:for-each select=".//class">

do 

<xsl:apply templates select="class">
  <xsl:sort select="@name"/>
</xsl:apply-templates>

together with something like

<xsl:template match="class">
   do whatever you want to do for this class, then do its children
  <xsl:apply templates select="class">
    <xsl:sort select="@name"/>
  </xsl:apply-templates>
</xsl:template>

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]