forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r358073 - /forrest/branches/forrest_07_branch/plugins/org.apache.forrest.plugin.input.simplifiedDocbook/resources/stylesheets/sdocbook2document.xsl
Date Tue, 20 Dec 2005 19:04:15 GMT
Author: josch
Date: Tue Dec 20 11:02:37 2005
New Revision: 358073

URL: http://svn.apache.org/viewcvs?rev=358073&view=rev
Log:
added support for spans in tables, fixes FOR-769

Modified:
    forrest/branches/forrest_07_branch/plugins/org.apache.forrest.plugin.input.simplifiedDocbook/resources/stylesheets/sdocbook2document.xsl

Modified: forrest/branches/forrest_07_branch/plugins/org.apache.forrest.plugin.input.simplifiedDocbook/resources/stylesheets/sdocbook2document.xsl
URL: http://svn.apache.org/viewcvs/forrest/branches/forrest_07_branch/plugins/org.apache.forrest.plugin.input.simplifiedDocbook/resources/stylesheets/sdocbook2document.xsl?rev=358073&r1=358072&r2=358073&view=diff
==============================================================================
--- forrest/branches/forrest_07_branch/plugins/org.apache.forrest.plugin.input.simplifiedDocbook/resources/stylesheets/sdocbook2document.xsl
(original)
+++ forrest/branches/forrest_07_branch/plugins/org.apache.forrest.plugin.input.simplifiedDocbook/resources/stylesheets/sdocbook2document.xsl
Tue Dec 20 11:02:37 2005
@@ -621,22 +621,68 @@
       </xsl:template>
       <xsl:template match="entry" mode="thead">
             <th>
+                  <xsl:call-template name="entry.spans"/>
                   <xsl:apply-templates/>
             </th>
       </xsl:template>
       <xsl:template match="row">
             <tr>
-                  <xsl:apply-templates/>
+              <xsl:apply-templates/>
             </tr>
       </xsl:template>
       <xsl:template match="tbody|tfoot">
             <xsl:apply-templates/>
       </xsl:template>
+
       <xsl:template match="entry">
             <td>
+                  <xsl:call-template name="entry.spans"/>
                   <xsl:apply-templates/>
             </td>
       </xsl:template>
+
+      <xsl:template name="entry.spans">
+              <xsl:if test="@morerows">
+                <xsl:attribute name="rowspan">
+                  <xsl:value-of select="number(@morerows)+1"/>
+                </xsl:attribute>
+              </xsl:if>
+              <xsl:if test="@namest and @nameend">
+                  <xsl:attribute name="colspan">
+
+                  <xsl:variable name="start">
+                    <xsl:call-template name="colspec.index">
+                      <xsl:with-param name="olist" select="ancestor::tgroup/colspec"/>
+                      <xsl:with-param name="colname" select="@namest"/>
+                    </xsl:call-template>
+                  </xsl:variable>
+                  <xsl:variable name="end">
+                    <xsl:call-template name="colspec.index">
+                      <xsl:with-param name="olist" select="ancestor::tgroup/colspec"/>
+                      <xsl:with-param name="colname" select="@nameend"/>
+                    </xsl:call-template>
+                  </xsl:variable>
+
+                  <xsl:value-of select="number($end)-number($start)+1"/>
+                </xsl:attribute>
+              </xsl:if>
+      </xsl:template>
+      <xsl:template name="colspec.index">
+        <!-- calculate the index for a given colname, e.g. from entry/@nameend -->
+        <!-- inspired from the original docbook stylesheets -->
+        <xsl:param name="olist" select="//table/tgroup/colspec"/>
+        <xsl:param name="colname" select="c1"/>
+        <xsl:for-each select="$olist">
+          <xsl:if test="@colname=$colname">
+            <xsl:choose>
+              <xsl:when test="@colnum"><xsl:value-of select="@colnum"/></xsl:when>
+              <xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise>
+            </xsl:choose>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:template>
+
+
       <xsl:template match="trademark">
             <xsl:apply-templates/>
             <sup>TM</sup>



Mime
View raw message