This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
XPath function after grouping
- From: "Michael Bauerfeld" <michael at socialchange dot net dot au>
- To: <XSL-List at lists dot mulberrytech dot com>
- Date: Mon, 21 Jan 2002 11:12:07 +1100
- Subject: [xsl] XPath function after grouping
- Reply-to: xsl-list at lists dot mulberrytech dot com
I would like to use XPath function like sum() or count() for groups I've
created with the Muenchian Method but I can't get it right to run a e.g.
sum() for all members of a sub-group.
Could someone give me a hint how to get it working?!
Thanks,
-Michael
<?xml version="1.0" encoding="UTF-8"?>
<Result>
<Observation>
<SiteNumber>1</SiteNumber>
<Cond>
<value>10.4</value>
</Cond>
</Observation>
<Observation>
<SiteNumber>130001</SiteNumber>
<Cond>
<value>10.2</value>
</Cond>
</Observation>
<Observation>
<SiteNumber>1</SiteNumber>
<Cond>
<value>9.0</value>
</Cond>
</Observation>
<Observation>
<SiteNumber>2</SiteNumber>
<Cond>
<value>0</value>
</Cond>
</Observation>
</Result>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:key name="site_" match="Members/Observation" use="SiteNumber"/>
<xsl:template match="Result">
<xsl:apply-templates select="Members/Observation[generate-id(.) =
generate-id(key('site_', SiteNumber))]"/>
</xsl:template>
<xsl:template match="Observation">
<xsl:value-of select="SiteNumber"/><br/>
<xsl:value-of select="sum(????)"/>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list