Re: [xsl] Grouping based on the sum of an attribute

Subject: Re: [xsl] Grouping based on the sum of an attribute
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 26 Jan 2007 17:40:53 GMT
<xsl:variable name="tcols" select="@cols"/>
<xsl:for-each-group select="*"
group-by="sum(@cols,preceding-sibling::*/@cols) idiv $tcols">

then:


$ saxon8 st.xml st.xsl \!indent=yes
<?xml version="1.0" encoding="UTF-8"?>
<table>
   <tr>
      <th colspan="3" rowspan="1">
                Head
        </th>
   </tr>
   <tr>
      <td colspan="1" rowspan="1">
                Column 1
        </td>
      <td colspan="1" rowspan="1">
                Column 2
        </td>
      <td colspan="1" rowspan="1">
                Column 3
        </td>
   </tr>
</table>

Current Thread