|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
-->
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
|
|
Packit |
e4b6da |
xmlns="http://docbook2x.sourceforge.net/xmlns/Texi-XML"
|
|
Packit |
e4b6da |
exclude-result-prefixes="doc"
|
|
Packit |
e4b6da |
version='1.0'
|
|
Packit |
e4b6da |
xml:lang="en">
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
$Id: table.xsl,v 1.17 2004/08/22 22:46:07 stevecheng Exp $
|
|
Packit |
e4b6da |
********************************************************************
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
(C) 2000-2004 Steve Cheng <stevecheng@users.sourceforge.net>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
This file is part of the docbook2X XSLT stylesheets for
|
|
Packit |
e4b6da |
converting DocBook to Texinfo.
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
See ../../COPYING for the copyright status of this software.
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
******************************************************************** -->
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<doc:reference xmlns="">
|
|
Packit |
e4b6da |
<title>Table support</title>
|
|
Packit |
e4b6da |
</doc:reference>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="tgroup">
|
|
Packit |
e4b6da |
<xsl:call-template name="anchor" />
|
|
Packit |
e4b6da |
<multitable cols="{@cols}">
|
|
Packit |
e4b6da |
<xsl:apply-templates select="colspec" />
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:apply-templates select="thead" />
|
|
Packit |
e4b6da |
<xsl:apply-templates select="tbody" />
|
|
Packit |
e4b6da |
<xsl:apply-templates select="tfoot" />
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
</multitable>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="colspec">
|
|
Packit |
e4b6da |
<colspec>
|
|
Packit |
e4b6da |
<xsl:attribute name="colwidth">
|
|
Packit |
e4b6da |
<xsl:call-template name="get-proportional-colwidth" />
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:attribute name="colnum">
|
|
Packit |
e4b6da |
<xsl:value-of select="@colnum" />
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
</colspec>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="spanspec">
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
namest="{@namest}"
|
|
Packit |
e4b6da |
nameend="{@nameend}" />
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="thead|tfoot|tbody">
|
|
Packit |
e4b6da |
<xsl:apply-templates />
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="thead/colspec">
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="tfoot/colspec">
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="row">
|
|
Packit |
e4b6da |
<row>
|
|
Packit |
e4b6da |
<xsl:apply-templates />
|
|
Packit |
e4b6da |
</row>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="entry">
|
|
Packit |
e4b6da |
<entry>
|
|
Packit |
e4b6da |
<xsl:if test="@colname">
|
|
Packit |
e4b6da |
<xsl:attribute name="colname">
|
|
Packit |
e4b6da |
<xsl:value-of select="@colname" />
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
</xsl:if>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:if test="@spanname">
|
|
Packit |
e4b6da |
<xsl:attribute name="spanname">
|
|
Packit |
e4b6da |
<xsl:value-of select="@spanname" />
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
</xsl:if>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:if test="@namest">
|
|
Packit |
e4b6da |
<xsl:attribute name="namest">
|
|
Packit |
e4b6da |
<xsl:value-of select="@namest" />
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
</xsl:if>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:if test="@nameend">
|
|
Packit |
e4b6da |
<xsl:attribute name="nameend">
|
|
Packit |
e4b6da |
<xsl:value-of select="@nameend" />
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
</xsl:if>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:apply-templates mode="coerce-into-inline" />
|
|
Packit |
e4b6da |
</entry>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<doc:template name="get-proportional-colwidth" xmlns="">
|
|
Packit |
e4b6da |
<refpurpose>
|
|
Packit |
e4b6da |
Get the proportional width as specified in the given <sgmltag class="element">colspec</sgmltag>
|
|
Packit |
e4b6da |
</refpurpose>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<refdescription>
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
In CALS tables, the <sgmltag class="element">colspec</sgmltag> has
|
|
Packit |
e4b6da |
the attribute <sgmltag class="attribute">colwidth</sgmltag>
|
|
Packit |
e4b6da |
which can specify either absolute column widths, relative column widths,
|
|
Packit |
e4b6da |
or a mixture of both measures. Texinfo only supports relative column widths.
|
|
Packit |
e4b6da |
This template coerces all absolute column widths into relative ones,
|
|
Packit |
e4b6da |
as follows:
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<variablelist>
|
|
Packit |
e4b6da |
<varlistentry>
|
|
Packit |
e4b6da |
<term>No width is specified</term>
|
|
Packit |
e4b6da |
<listitem>
|
|
Packit |
e4b6da |
<para>Then the column is assumed to have a relative column width of one.</para>
|
|
Packit |
e4b6da |
</listitem>
|
|
Packit |
e4b6da |
</varlistentry>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<varlistentry>
|
|
Packit |
e4b6da |
<term>Absolute widths</term>
|
|
Packit |
e4b6da |
<listitem>
|
|
Packit |
e4b6da |
<para>These are simply translated to a relative column width of one.</para>
|
|
Packit |
e4b6da |
</listitem>
|
|
Packit |
e4b6da |
</varlistentry>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<varlistentry>
|
|
Packit |
e4b6da |
<term>Mixture</term>
|
|
Packit |
e4b6da |
<listitem>
|
|
Packit |
e4b6da |
<para>These are of the form <literal><replaceable>P</replaceable>*+<replaceable>M</replaceable></literal>, where <replaceable>P</replaceable> is the relative column width, and <replaceable>M</replaceable> is an absolute column width.
|
|
Packit |
e4b6da |
The sign may also be minus instead of plus, with the obvious meaning.
|
|
Packit |
e4b6da |
This template drops the <replaceable>M</replaceable> part and its sign.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
</listitem>
|
|
Packit |
e4b6da |
</varlistentry>
|
|
Packit |
e4b6da |
</variablelist>
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
</refdescription>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<refparameter>
|
|
Packit |
e4b6da |
<variablelist>
|
|
Packit |
e4b6da |
<varlistentry>
|
|
Packit |
e4b6da |
<term><parameter>colspec</parameter></term>
|
|
Packit |
e4b6da |
<listitem><para>
|
|
Packit |
e4b6da |
A node-set that is the <sgmltag class="element">colspec</sgmltag>
|
|
Packit |
e4b6da |
element to determine widths for.
|
|
Packit |
e4b6da |
</para></listitem>
|
|
Packit |
e4b6da |
</varlistentry>
|
|
Packit |
e4b6da |
</variablelist>
|
|
Packit |
e4b6da |
</refparameter>
|
|
Packit |
e4b6da |
</doc:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template name="get-proportional-colwidth">
|
|
Packit |
e4b6da |
<xsl:param name="colspec" select="." />
|
|
Packit |
e4b6da |
<xsl:variable name="colwidth" select="$colspec/@colwidth" />
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:choose>
|
|
Packit |
e4b6da |
<xsl:when test="$colwidth = ''">
|
|
Packit |
e4b6da |
<xsl:value-of select="1" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:when test="not(contains($colwidth,'*'))">
|
|
Packit |
e4b6da |
<xsl:call-template name="user-message">
|
|
Packit |
e4b6da |
<xsl:with-param name="node" select="$colspec" />
|
|
Packit |
e4b6da |
<xsl:with-param name="key">absolute table column widths not supported</xsl:with-param>
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
<xsl:value-of select="1" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:when test="$colwidth = '*'">
|
|
Packit |
e4b6da |
<xsl:value-of select="1" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:otherwise>
|
|
Packit |
e4b6da |
<xsl:if test="contains($colwidth,'+') or contains($colwidth,'-')">
|
|
Packit |
e4b6da |
<xsl:call-template name="user-message">
|
|
Packit |
e4b6da |
<xsl:with-param name="node" select="$colspec" />
|
|
Packit |
e4b6da |
<xsl:with-param name="key">absolute table column widths not supported</xsl:with-param>
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:if>
|
|
Packit |
e4b6da |
<xsl:value-of select="substring-before($colwidth,'*')" />
|
|
Packit |
e4b6da |
</xsl:otherwise>
|
|
Packit |
e4b6da |
</xsl:choose>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
</xsl:stylesheet>
|