]> granicus.if.org Git - docbook-dsssl/commitdiff
Support formatting segmented lists as tables
authorNorman Walsh <ndw@nwalsh.com>
Wed, 28 Nov 2001 15:15:20 +0000 (15:15 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Wed, 28 Nov 2001 15:15:20 +0000 (15:15 +0000)
xsl/fo/lists.xsl
xsl/fo/param.ent
xsl/fo/param.xweb
xsl/html/lists.xsl
xsl/html/param.ent
xsl/html/param.xweb
xsl/params/segmentedlist.as.table.xml [new file with mode: 0644]

index 29ab93f1fd8a1da937282a1ad05b3ec48737500a..fa1c87ad9dd33fe1b545d2cc18469cc449bd2eb3 100644 (file)
 <!-- ==================================================================== -->
 
 <xsl:template match="segmentedlist">
-  <xsl:apply-templates/>
+  <xsl:variable name="presentation">
+    <xsl:call-template name="pi-attribute">
+      <xsl:with-param name="pis"
+                      select="processing-instruction('dbfo')"/>
+      <xsl:with-param name="attribute" select="'list-presentation'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$presentation = 'table'">
+      <xsl:apply-templates select="." mode="seglist-table"/>
+    </xsl:when>
+    <xsl:when test="$presentation = 'list'">
+      <xsl:apply-templates/>
+    </xsl:when>
+    <xsl:when test="$segmentedlist.as.table != 0">
+      <xsl:apply-templates select="." mode="seglist-table"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates/>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:template match="segmentedlist/title">
   </fo:block>
 </xsl:template>
 
+<xsl:template match="segmentedlist" mode="seglist-table">
+  <xsl:apply-templates select="title" mode="seglist-table"/>
+  <fo:table>
+    <fo:table-header>
+      <fo:table-row>
+        <xsl:apply-templates select="segtitle" mode="seglist-table"/>
+      </fo:table-row>
+    </fo:table-header>
+    <fo:table-body>
+      <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
+    </fo:table-body>
+  </fo:table>
+</xsl:template>
+
+<xsl:template match="segtitle" mode="seglist-table">
+  <fo:table-cell>
+    <fo:block>
+      <xsl:apply-templates/>
+    </fo:block>
+  </fo:table-cell>
+</xsl:template>
+
+<xsl:template match="seglistitem" mode="seglist-table">
+  <fo:table-row>
+    <xsl:apply-templates mode="seglist-table"/>
+  </fo:table-row>
+</xsl:template>
+
+<xsl:template match="seg" mode="seglist-table">
+  <fo:table-cell>
+    <fo:block>
+      <xsl:apply-templates/>
+    </fo:block>
+  </fo:table-cell>
+</xsl:template>
+
 <!-- ==================================================================== -->
 
 <xsl:template match="calloutlist">
index 4b7eaac6adb3d287c734cc2a2d8dd33dc59e5ce6..380a585a1264e01fa5af7b9aaefa226006e0189d 100644 (file)
 <!ENTITY table.entry.padding SYSTEM "../params/table.entry.padding.xml">
 
 <!ENTITY punct.honorific SYSTEM "../params/punct.honorific.xml">
+<!ENTITY segmentedlist.as.table SYSTEM "../params/segmentedlist.as.table.xml">
index 474b4bef221fdab33a73937b3082f818b104ecf6..9cefe2d81784bbc58b2d96d317e29662b5994942 100644 (file)
@@ -175,7 +175,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 &table.border.color;
 &title.margin.left;
 &punct.honorific;
-
+&segmentedlist.as.table;
 </reference>
 
 <appendix><title>The Stylesheet</title>
@@ -314,7 +314,7 @@ around all these parameters.</para>
 <src:fragref linkend="table.border.color.frag"/>
 <src:fragref linkend="title.margin.left.frag"/>
 <src:fragref linkend="punct.honorific.frag"/>
-
+<src:fragref linkend="segmentedlist.as.table.frag"/>
 </xsl:stylesheet>
 </src:fragment>
 
index 81e25925e3ce4ec36d33bfb7fb271715fe2b4580..75bc8b2f32c3e1fe3cb3169bd1b70b059a836d6d 100644 (file)
 <!-- ==================================================================== -->
 
 <xsl:template match="segmentedlist">
+  <xsl:variable name="presentation">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis"
+                      select="processing-instruction('dbhtml')"/>
+      <xsl:with-param name="attribute" select="'list-presentation'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
   <xsl:call-template name="anchor"/>
-  <xsl:apply-templates/>
+
+  <xsl:choose>
+    <xsl:when test="$presentation = 'table'">
+      <xsl:apply-templates select="." mode="seglist-table"/>
+    </xsl:when>
+    <xsl:when test="$presentation = 'list'">
+      <xsl:apply-templates/>
+    </xsl:when>
+    <xsl:when test="$segmentedlist.as.table != 0">
+      <xsl:apply-templates select="." mode="seglist-table"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates/>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:template match="segmentedlist/title">
   </p>
 </xsl:template>
 
+<xsl:template match="segmentedlist" mode="seglist-table">
+  <xsl:variable name="table-summary">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis"
+                      select="processing-instruction('dbhtml')"/>
+      <xsl:with-param name="attribute" select="'table-summary'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="list-width">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis"
+                      select="processing-instruction('dbhtml')"/>
+      <xsl:with-param name="attribute" select="'list-width'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:apply-templates select="title" mode="seglist-table"/>
+  <table border="0">
+    <xsl:if test="$list-width != ''">
+      <xsl:attribute name="width">
+        <xsl:value-of select="$list-width"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="$table-summary != ''">
+      <xsl:attribute name="summary">
+        <xsl:value-of select="$table-summary"/>
+      </xsl:attribute>
+    </xsl:if>
+    <thead>
+      <tr>
+        <xsl:apply-templates select="segtitle" mode="seglist-table"/>
+      </tr>
+    </thead>
+    <tbody>
+      <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
+    </tbody>
+  </table>
+</xsl:template>
+
+<xsl:template match="segtitle" mode="seglist-table">
+  <th><xsl:apply-templates/></th>
+</xsl:template>
+
+<xsl:template match="seglistitem" mode="seglist-table">
+  <tr>
+    <xsl:apply-templates mode="seglist-table"/>
+  </tr>
+</xsl:template>
+
+<xsl:template match="seg" mode="seglist-table">
+  <td><xsl:apply-templates/></td>
+</xsl:template>
+
 <!-- ==================================================================== -->
 
 <xsl:template match="calloutlist">
index 6f5acc47153ad95ee8a0bcf83cce43257f8137cb..14fb9afbfdde025f25fe5e7e37d8a750489a15e8 100644 (file)
 <!ENTITY htmlhelp.force.map.and.alias SYSTEM "../params/htmlhelp.force.map.and.alias.xml">
 <!ENTITY htmlhelp.map.file SYSTEM "../params/htmlhelp.map.file.xml">
 <!ENTITY htmlhelp.alias.file SYSTEM "../params/htmlhelp.alias.file.xml">
-
+<!ENTITY segmentedlist.as.table SYSTEM "../params/segmentedlist.as.table.xml">
index 561a9c1429678a785601c26a6c4d36aa8d6b118e..367b2628d11a285a8800fa76e970a88333a58836 100644 (file)
@@ -218,6 +218,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 &shade.verbatim;
 &shade.verbatim.style;
 &punct.honorific;
+&segmentedlist.as.table;
 </reference>
 
 <reference><title>Chunking</title>
@@ -403,6 +404,7 @@ around all these parameters.</para>
 <src:fragref linkend="htmlhelp.force.map.and.alias.frag"/>
 <src:fragref linkend="htmlhelp.map.file.frag"/>
 <src:fragref linkend="htmlhelp.alias.file.frag"/>
+<src:fragref linkend="segmentedlist.as.table.frag"/>
 </xsl:stylesheet>
 </src:fragment>
 
diff --git a/xsl/params/segmentedlist.as.table.xml b/xsl/params/segmentedlist.as.table.xml
new file mode 100644 (file)
index 0000000..e7ce9c8
--- /dev/null
@@ -0,0 +1,23 @@
+<refentry id="segmentedlist.as.table">
+<refmeta>
+<refentrytitle>segmentedlist.as.table</refentrytitle>
+<refmiscinfo role="type">boolean</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>segmentedlist.as.table</refname>
+<refpurpose>Format segmented lists as tables?</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='segmentedlist.as.table.frag'>
+<xsl:param name="segmentedlist.as.table" select="0"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>If non-zero, <sgmltag>segmentedlist</sgmltag>s will be formatted as
+tables.</para>
+
+</refsect1>
+</refentry>