|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Sum & Sort & Maxvalue
> -----Original Message-----
> From: Florian Mueller
>
> I have a complex problem. I dont know if i can explain it correctly.
>
Hi,
Given your input XML, the following
<xsl:key name="acts-day-name" match="activity"
use="concat(ancestor::day/@date,@name)" />
will give you a handle to the unique activity names for a given day when
used in combination with a template like
<xsl:template match="day">
<xsl:variable name="vacthelp"
select="gv/activity[generate-id(.)=
generate-id(
key('acts-day-name', concat(
current()/@date, @name)
)[1])]" />
...
</xsl:template>
The trick then seems to be to construct a variable like
<xsl:variable name="vacts">
<xsl:for-each select="$vacthelp">
<activity name="{@name}">
<hits><xsl:value-of
select="sum(ancestor::day/gv/activity[@name=current()/@name]/hits)"
/></hits>
</act>
</xsl:for-each>
</xsl:variable>
Then apply-templates, using the node-set extension function
<xsl:apply-templates select="ext:node-set($vacts)" />
I have been trying this with a sort on the hits-node, but it didn't seem to
be working. Just posting already since it seems that mainly the summing was
bothering you up to here, and in this way at least, I got the numbers
right..
Hope this helps!
Cheers,
Andreas
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








