Re: [xsl] grouping

Subject: Re: [xsl] grouping
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 2 Jan 2026 15:04:01 -0000
this?

<!DOCTYPE HTML>
<html>
   <p>12-01:0 3.32516625</p>
   <p>12-01:3 11.899479375</p>
   <p>12-01:6 122.236542015</p>
   <p>12-01:9 66.41845759499999</p>
   <p>12-01:12 48.98321693999999</p>
   <p>12-01:15 113.2815999</p>
   <p>12-01:18 28.573543214999997</p>
   <p>12-01:21 25.968715394999997</p>
   <p>12-02:0 0.6300315</p>
</html>


from

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:dp="data:,dp"
exclude-result-prefixes="dp xs"
>

  <xsl:template match="data">
    <html>
      <xsl:for-each-group group-by="dp:s(.)" select="period">
<p>
 <xsl:value-of select="current-grouping-key()"/>
 <xsl:text> </xsl:text>
 <xsl:value-of select="sum(current-group()/cost)"/>
</p>
      </xsl:for-each-group>
    </html>
  </xsl:template>

  <xsl:function name="dp:s">
    <xsl:param name="p" as="element(period)"/>
    <xsl:sequence select="$p/concat(start/date,':', 3 *
(xs:int(substring-before(start/time,':')) idiv 3))"/>
  </xsl:function>

</xsl:stylesheet>




On Fri, 2 Jan 2026 at 14:50, Dave Pawson dave.pawson@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Even easier
>
> https://privatebin.net/?1306eef3a715a90d#75Jfu1qzHcNaEdno9PyuBj4mq4N695bUJB8WPHwAhoAw
>
> a full months worth.
>
> I'd forgotten about pastebin!
>
> regards
>
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

Current Thread