Add separator rows to the sorted part of clicky tables.
authorNick Bowler <nbowler@draconx.ca>
Tue, 23 Feb 2021 01:46:43 +0000 (20:46 -0500)
committerNick Bowler <nbowler@draconx.ca>
Wed, 24 Feb 2021 03:48:54 +0000 (22:48 -0500)
Normally these rows are hidden, but if styles are not applied, then
they will help visually separate the default-ordered table from the
jumble of rows representing all other orderings.

layouts/clickytable.xsl

index 4858b7fbbfebd0eb3412d9a9fcad68f6d3892771..f06fef309146d89d90f952db5aacda20204f0daf 100644 (file)
       </xsl:if>
       <xsl:text>display: none</xsl:text>
     </xsl:attribute>
-    <xsl:apply-templates select='node()|@*[local-name() != "style"]' />
+    <xsl:apply-templates select='@*[local-name() != "style"]' />
+    <tr>
+      <td>
+        <xsl:for-each select='../*/xhtml:tr'>
+          <xsl:sort select='count(*)' data-type='number' order='descending' />
+          <xsl:if test='position()=1'>
+            <xsl:attribute name='colspan'>
+              <xsl:value-of select='count(*)' />
+            </xsl:attribute>
+          </xsl:if>
+        </xsl:for-each>
+        <hr/>
+      </td>
+    </tr>
+    <tr>
+      <xsl:for-each select='../xhtml:thead[1]/xhtml:tr[1]/*'>
+        <xsl:copy>
+          <xsl:value-of select='.' />
+        </xsl:copy>
+      </xsl:for-each>
+    </tr>
+    <xsl:apply-templates select='node()' />
   </xsl:copy>
 </xsl:template>