• Added basic longtable support to enable tabulars to break over pages.
• Renamed row/@no-page-break to row/@page-break, and reversed sense of value to match.
1 parent e13caaa commit 7e8d6b03d4fc630ba65d61912f5e476c8fcfa1e1
Nigel Stanger authored on 13 Feb 2017
Showing 2 changed files
View
35
modules/tabular.xml
@scale (LaTeX only): Scaling factor for the tabular.
@rotate (LaTeX only): Rotation angle of tabular in degrees anti-clockwise.
@long-table (LaTeX only): Use the longtable environment instead of tabular so it can span multiple pages.
'no' [default]
'yes'
@caption (LaTeX only): Only valid for long tables (@long-table = 'yes'); ignored otherwise.
-->
<template name="tabular" match="tabular">
<common formats="/latex/xelatex/">
<!-- spacing -->
<xsl:value-of select="@scale" />
<xsl:text>}{</xsl:text>
</xsl:if>
 
<xsl:text>\begin{tabular}</xsl:text>
<xsl:text>\begin{</xsl:text>
<xsl:value-of select="
if (@long-table = ('yes', 'y', 'true', 't', '1')) then 'longtable'
else 'tabular'" />
<xsl:text>}</xsl:text>
<!-- vertical alignment -->
<xsl:if test="@valign = ('top', 'bottom')">
<xsl:text>[</xsl:text>
<xsl:value-of select="substring(@valign, 1, 1)" />
</xsl:if>
<xsl:text>{</xsl:text>
<xsl:apply-templates select="tabular-columns" />
<xsl:text>}</xsl:text>
<xsl:if test="(@long-table = ('yes', 'y', 'true', 't', '1')) and @caption">
<xsl:text>\caption{</xsl:text>
<xsl:value-of select="@caption" />
<xsl:text>} \\</xsl:text>
</xsl:if>
<xsl:apply-templates select="tabular-header" />
<xsl:apply-templates select="tabular-body" />
<xsl:apply-templates select="tabular-footer" />
<xsl:text>\end{tabular}</xsl:text>
<xsl:text>\end{</xsl:text>
<xsl:value-of select="
if (@long-table = ('yes', 'y', 'true', 't', '1')) then 'longtable'
else 'tabular'" />
<xsl:text>}</xsl:text>
 
<xsl:if test="@scale"><xsl:text>}</xsl:text></xsl:if>
 
<xsl:if test="@rotate"><xsl:text>}</xsl:text></xsl:if>
<!--
A single row of a tabular.
@no-page-break: Inhibit page breaks after this row (LaTeX only).
@page-break: Inhibit page breaks after this row (LaTeX only).
-->
<template name="row" match="row">
<common formats="/latex/xelatex/">
<xsl:apply-templates />
<xsl:text> \\</xsl:text>
<xsl:if test="@no-page-break = ('yes', 'y', 'true', 't', '1')"><xsl:text>*</xsl:text></xsl:if>
<xsl:if test="@page-break = ('no', 'n', 'false', 'f', '0')"><xsl:text>*</xsl:text></xsl:if>
<xsl:text> </xsl:text>
</common>
<common formats="/html/xhtml/">
<tr>
View
1
■■■■
xml2xslt.xsl
\@ifpackageloaded{geometry}{}{\usepackage[margin=1in]{geometry}}
\makeatother
 
\usepackage{multirow}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{verbatim} % needed for \verbatiminput
\usepackage{relalg} % needed for join operators
\usepackage{pifont}