You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "Johannes Schaefer (JIRA)" <ji...@apache.org> on 2005/12/20 14:12:30 UTC

[jira] Commented: (FOR-769) tables don't support row/colspan

    [ http://issues.apache.org/jira/browse/FOR-769?page=comments#action_12360915 ] 

Johannes Schaefer commented on FOR-769:
---------------------------------------

I implemented this, but have a question before comitting.

I would like to avoid code duplication as is the case in the match for <entry> in sdocbook2document.xsl from the plugin, see the code snippet below. The same template exists for <entry> with mode="thead" the only difference beeing <th> instead of <td>. I look for an option to avoid duplication and see the following:
1. use a named template and call this
2. match <entry> without node and check name(..) to insert <td> or <th>
3. pass "td" or "th" as a parameter to the template
What would be the best way?
Johannes

      <xsl:template match="entry">
            <td>
              <!-- this code is duplicated in template match="entry" mode="thead" -->
              <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:apply-templates/>
              <!-- end code duplication -->
            </td>
      </xsl:template>


> tables don't support row/colspan
> --------------------------------
>
>          Key: FOR-769
>          URL: http://issues.apache.org/jira/browse/FOR-769
>      Project: Forrest
>         Type: Bug
>   Components: Plugin: Simplified Docbook
>     Versions: 0.7
>  Environment: all
>     Reporter: Johannes Schaefer
>     Assignee: Johannes Schaefer
>  Attachments: index.xml
>
> the plugin should support the sDocBook attributes to span rows and columns in a table; see attached file and below
> <table>
> ...
>   <colspec  colname='c1'/>
>   <colspec  colname='c2'/>
>   <colspec  colname='c3'/>
>   <colspec colnum='5' colname='c5'/>
> ...
>   <entry morerows='1>
>   <entry namest="c2" nameend="c5">span to c5</entry>
>   <entry namest="c2" nameend="c3" morerows='1'>
> </table>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira