Subject: Sorting with variable
From: Florian Mueller <jjdm@xxxxxxxx>
Date: Thu, 04 Mar 2004 15:50:19 +0100
|
Hello everybody
<xsl:for-each select="//day">
<xsl:variable name="day" select="."/>
<xsl:for-each select="//gv/activity[generate-id()=generate-id(key('activity_key',@name))]">
<xsl:sort select="./hits" data-type="number" order="descending"/>
<xsl:variable name="uname" select="@name"/>
<xsl:variable name="activity" select="$day/gv/activity[@name=$uname]/@name"/>
<xsl:variable name="summe" select="sum($activity/../..//activity[@name=$uname]/hits)"/>
<!-- $summe has the right value -->
<xsl:sort select="$summe" data-type="number" order="descending"/>
<!-- print unsorted -->
<xsl:value-of select="$summe"/>
</xsl:for-each>
</xsl:for-each>
My goal is, to sort the "activity" with the "summe". So i want to have for example the following result:
act1 34
act2 12
act3 1
But the script doesnt work. Maybe because i use a variable in the sort-statement?
Anyone knows something about this?
Kindly regards
Florian Mueller
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|