]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Transform <columnspec><column width=".2">... hints to help latex
authorJoshua Slive <slive@apache.org>
Tue, 10 Jun 2003 20:17:51 +0000 (20:17 +0000)
committerJoshua Slive <slive@apache.org>
Tue, 10 Jun 2003 20:17:51 +0000 (20:17 +0000)
size tables properly.  Also change the html tranforms to ignore this
and add the elements to the dtd.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100207 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/style/common.dtd
docs/manual/style/latex/TODO
docs/manual/style/latex/html.xsl
docs/manual/style/xsl/common.xsl

index f8f1d1b8088eeacc05a87ae5b8cb43d6ebbec19f..34bcfecb909339e5f7fdef8c93f3d6cb466ba4d6 100644 (file)
@@ -96,7 +96,7 @@
 <!ELEMENT note (#PCDATA | title | %inlinetags; | %blocktags;)*>
 <!ATTLIST note type CDATA #IMPLIED>
 
-<!ELEMENT table (tr)+>
+<!ELEMENT table (columnspec | tr)+>
 <!ATTLIST table summary     CDATA  #IMPLIED
                 width       CDATA  #IMPLIED
                 bgcolor     CDATA  #IMPLIED
                 border      CDATA  #IMPLIED
                 style       CDATA  #IMPLIED>
 
+<!ELEMENT columnspec (column)+>
+
+<!ELEMENT column EMPTY>
+<!ATTLIST column width CDATA #IMPLIED>
+
 <!ELEMENT tr (th | td)+>
 <!ATTLIST tr valign CDATA #IMPLIED >
 
index fb0dfb7db0658f6793b51c3f90b0cabfd301d490..d55b7d83e594650938cf0e92ea70d2a8a6658499 100644 (file)
@@ -9,35 +9,6 @@ Some things that need to be done with the LaTeX transforms:
    since you can just take the existing LaTeX as an example, and combine
    it with the xslt stuff under style/xsl/.]
 
-- Fix tables
-
-  Perhaps we need to add some xml hints about the size of different
-  columns in the source files.
-
-  Here is a proposal:
-
-  xml:
-  <table>
-  <columnspec><column width=".2"/><column width=".2"/><column width=".6"/>
-  </columnspec>
-  <tr><td>1</td><td>2</td><td>3</td></tr>
-  </table>
-
-  latex:
-  \begin{tabular}{lll} % number of "l"s matches the number of <column>s.
-  \begin{minipage}{.2\linewidth}
-  1
-  \end{minipage} &
-  \begin{minipage}{.2\linewidth}
-  2
-  \end{minipage} &
-  \begin{minipage}{.6\linewidth}
-  3
-  \end{minipage} \\ % And continue in the same way if there are more rows
-  \end{tabular}
-
-  This should be enough to get an xsl expert started.
-
 - Images
 
   A quick search makes me believe that pdftex will not handle gifs.
index 3e71dad0c169d96936d40dc305c6fbfb637782a4..24338a96408e4c9786f4adeabc98f66175c43dfe 100644 (file)
@@ -116,24 +116,35 @@ interpreted in pre -->
 </xsl:template>
 
 <xsl:template match="table">
-<xsl:text>\begin{tabular}{ll}</xsl:text>
-<xsl:for-each select="tr">
-  <xsl:for-each select="td">
-    <xsl:text>\begin{minipage}{.5\linewidth}</xsl:text>
-    <xsl:apply-templates/>
-    <xsl:text>\end{minipage}</xsl:text>
-    <xsl:if test="not(last())">
-      <xsl:text> &amp; </xsl:text>
-    </xsl:if>
-  </xsl:for-each>
-  <xsl:text>\\
-</xsl:text>
+<xsl:text>\begin{tabular}{</xsl:text>
+<xsl:for-each select="columnspec/column">
+  <xsl:text>l</xsl:text>
 </xsl:for-each>
+<xsl:text>}</xsl:text>
+<xsl:apply-templates select="tr"/>
 <xsl:text>\end{tabular}
 </xsl:text>
 </xsl:template>
 
 
+<xsl:template match="tr">
+  <xsl:apply-templates select="td"/>
+  <xsl:text>\\
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="td">
+    <xsl:variable name="pos" select="position()"/>
+    <xsl:text>\begin{minipage}{</xsl:text>
+    <xsl:value-of select="../../columnspec/column[$pos]/@width"/>
+    <xsl:text>\linewidth}</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>\end{minipage}</xsl:text>
+    <xsl:if test="not(position()=last())">
+      <xsl:text> &amp; </xsl:text>
+    </xsl:if>
+</xsl:template>
+
 <!--
    This is a horrible hack, but it seems to mostly work.  It does a
    few things:
index 2e8b2b5a5f7e6b33d2e039d27fcbf6bfeb2d39f6..6fccc4cce16694bc4798ee565445a65963094945 100644 (file)
 </xsl:template>
 <!-- /helper.uri.fix -->
 
+
+<!-- ==================================================================== -->
+<!-- Ignore table hints used for latex                                    -->
+<!-- ==================================================================== -->
+<xsl:template match="columnspec">
+</xsl:template>
+
+<xsl:template match="column">
+</xsl:template>
+
 </xsl:stylesheet>