html.xsl revision b7b3763e47df6eb4445f465b178c93fccff0adbf
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<?xml version="1.0"?>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<!DOCTYPE xsl:stylesheet [
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd <!ENTITY lf SYSTEM "/xsl/util/lf.xml">
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd]>
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end<!--
db878466c5e95073429dda0bdd001f45e9486e16fielding Licensed to the Apache Software Foundation (ASF) under one or more
db878466c5e95073429dda0bdd001f45e9486e16fielding contributor license agreements. See the NOTICE file distributed with
db878466c5e95073429dda0bdd001f45e9486e16fielding this work for additional information regarding copyright ownership.
db878466c5e95073429dda0bdd001f45e9486e16fielding The ASF licenses this file to You under the Apache License, Version 2.0
db878466c5e95073429dda0bdd001f45e9486e16fielding (the "License"); you may not use this file except in compliance with
db878466c5e95073429dda0bdd001f45e9486e16fielding the License. You may obtain a copy of the License at
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end http://www.apache.org/licenses/LICENSE-2.0
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end Unless required by applicable law or agreed to in writing, software
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end distributed under the License is distributed on an "AS IS" BASIS,
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end See the License for the specific language governing permissions and
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end limitations under the License.
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end-->
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:stylesheet version="1.0"
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive xmlns="http://www.w3.org/1999/xhtml">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
f0528cfc93da36692a5fb7898d7e4a9e95150318nd<!-- load utility snippets -->
b93889871ef8513dd6bb00a0f05bfb7df326a21bnd<xsl:include href="/xsl/util/pretrim.xsl" />
f0528cfc93da36692a5fb7898d7e4a9e95150318nd
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- ==================================================================== -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Ordinary HTML that must be converted to latex -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- ==================================================================== -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="ul">
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\begin{itemize}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\end{itemize}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="ol">
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\begin{enumerate}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\end{enumerate}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="li">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\item </xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="dl">
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\begin{description}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\end{description}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="dt">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\item[</xsl:text><xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>] </xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="dd">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="br">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:call-template name="br">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:with-param name="result" select="'\\'" />
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:call-template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="br" mode="tabular">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:call-template name="br">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:with-param name="result" select="'\newline'" />
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:call-template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Latex doesn't like successive line breaks, so replace any
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive sequence of two or more br separated only by white-space with
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive one line break followed by smallskips. -->
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template name="br">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:param name="result" />
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:choose>
58842e03db54033d15cc224d997f467abc88a97aslive<xsl:when test="name(preceding-sibling::node()[1])='br' or name(preceding-sibling::node()[1])='indent'">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\smallskip </xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:when>
58842e03db54033d15cc224d997f467abc88a97aslive<xsl:when test="name(preceding-sibling::node()[2])='br' or name(preceding-sibling::node()[2])='indent'">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:when test="normalize-space(preceding-sibling::node()[1])=''">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:text>\smallskip </xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:otherwise>
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <!-- Don't put a line break if we are the last thing -->
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <xsl:if test="not(position()=last()) and not(position()=last()-1 and normalize-space(following-sibling::node()[1])='')">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd <xsl:value-of select="$result" />
97d4d9527b64d7491543a12a3d21134b857cbe4bnd <xsl:text> </xsl:text>
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive </xsl:if>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:otherwise>
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <!-- Don't put a line break if we are the last thing -->
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <xsl:if test="not(position()=last()) and not(position()=last()-1 and normalize-space(following-sibling::node()[1])='')">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd <xsl:value-of select="$result" />
97d4d9527b64d7491543a12a3d21134b857cbe4bnd <xsl:text> </xsl:text>
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive </xsl:if>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="p">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\par</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="code|program">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\texttt{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="code|program" mode="tabular">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:text>\texttt{</xsl:text>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:apply-templates mode="tabular"/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:text>}</xsl:text>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="strong">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\textbf{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="strong" mode="tabular">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:text>\textbf{</xsl:text>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:apply-templates mode="tabular"/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:text>}</xsl:text>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="em|var|cite|q|dfn">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\textit{</xsl:text>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:apply-templates mode="tabular"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Value-of used here explicitly because we don't wan't latex-escaping
3fa58e00171aebf3b2cfa90035ed530f5b1f651dsliveperformed. Of course, this will conflict with html where some tags are
3fa58e00171aebf3b2cfa90035ed530f5b1f651dsliveinterpreted in pre -->
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:template match="pre|highlight">
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\begin{verbatim}</xsl:text>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd
b7b3763e47df6eb4445f465b178c93fccff0adbfnd<!-- If it's a one-liner, trim the initial indentation as well -->
b7b3763e47df6eb4445f465b178c93fccff0adbfnd<!-- it's most likely an accident -->
b7b3763e47df6eb4445f465b178c93fccff0adbfnd<xsl:call-template name="pre-ltrim-one">
b93889871ef8513dd6bb00a0f05bfb7df326a21bnd <xsl:with-param name="string">
b7b3763e47df6eb4445f465b178c93fccff0adbfnd <xsl:call-template name="pre-rtrim">
b93889871ef8513dd6bb00a0f05bfb7df326a21bnd <xsl:with-param name="string">
b7b3763e47df6eb4445f465b178c93fccff0adbfnd <xsl:call-template name="pre-ltrim">
b7b3763e47df6eb4445f465b178c93fccff0adbfnd <xsl:with-param name="string">
b7b3763e47df6eb4445f465b178c93fccff0adbfnd <xsl:value-of select="." />
b7b3763e47df6eb4445f465b178c93fccff0adbfnd </xsl:with-param>
b7b3763e47df6eb4445f465b178c93fccff0adbfnd </xsl:call-template>
b93889871ef8513dd6bb00a0f05bfb7df326a21bnd </xsl:with-param>
b93889871ef8513dd6bb00a0f05bfb7df326a21bnd </xsl:call-template>
b93889871ef8513dd6bb00a0f05bfb7df326a21bnd </xsl:with-param>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd</xsl:call-template>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\end{verbatim}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="blockquote">
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\begin{quotation}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>\end{quotation}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
39926890ef5576499f1bd78a1412b43e79f2f694slive<!-- XXX: We need to deal with table headers -->
39926890ef5576499f1bd78a1412b43e79f2f694slive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="table">
368bcafaedaee463f769c1b5f3547b9970df90d0slive<xsl:variable name="table-type">
368bcafaedaee463f769c1b5f3547b9970df90d0slive <xsl:choose>
368bcafaedaee463f769c1b5f3547b9970df90d0slive <xsl:when test="count(tr) &gt; 15">longtable</xsl:when>
368bcafaedaee463f769c1b5f3547b9970df90d0slive <xsl:otherwise>tabular</xsl:otherwise>
368bcafaedaee463f769c1b5f3547b9970df90d0slive </xsl:choose>
368bcafaedaee463f769c1b5f3547b9970df90d0slive</xsl:variable>
368bcafaedaee463f769c1b5f3547b9970df90d0slive
368bcafaedaee463f769c1b5f3547b9970df90d0slive<xsl:text>\begin{</xsl:text><xsl:value-of select="$table-type"/>
368bcafaedaee463f769c1b5f3547b9970df90d0slive<xsl:text>}{|</xsl:text>
39926890ef5576499f1bd78a1412b43e79f2f694slive<xsl:choose>
39926890ef5576499f1bd78a1412b43e79f2f694slive<xsl:when test="columnspec">
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:for-each select="columnspec/column">
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:text>l</xsl:text>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:if test="../../@border and not(position()=last())">
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:text>|</xsl:text>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive </xsl:if>
39926890ef5576499f1bd78a1412b43e79f2f694slive </xsl:for-each>
39926890ef5576499f1bd78a1412b43e79f2f694slive</xsl:when>
39926890ef5576499f1bd78a1412b43e79f2f694slive<xsl:otherwise>
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:for-each select="tr[1]/*">
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:text>l</xsl:text>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:if test="../../@border and not(position()=last())">
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:text>|</xsl:text>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive </xsl:if>
39926890ef5576499f1bd78a1412b43e79f2f694slive </xsl:for-each>
39926890ef5576499f1bd78a1412b43e79f2f694slive</xsl:otherwise>
39926890ef5576499f1bd78a1412b43e79f2f694slive</xsl:choose>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>|}\hline</xsl:text>&lf;
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive<xsl:apply-templates select="tr"/>
368bcafaedaee463f769c1b5f3547b9970df90d0slive<xsl:text>\hline\end{</xsl:text>
368bcafaedaee463f769c1b5f3547b9970df90d0slive<xsl:value-of select="$table-type"/>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd<xsl:text>}</xsl:text>&lf;
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive<xsl:template match="tr">
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:apply-templates select="td|th"/>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:text>\\</xsl:text>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:if test="../@border and not(position()=last())">
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:text>\hline</xsl:text>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive </xsl:if>
8794d6ba53e0d88bb9d6bee4d7e79c1a8b265444nd &lf;
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive</xsl:template>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive
58842e03db54033d15cc224d997f467abc88a97aslive<xsl:template match="td">
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive <xsl:variable name="pos" select="position()"/>
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:text>\begin{minipage}[t]{</xsl:text>
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:choose>
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:when test="/columnspec">
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:value-of select="/columnspec/column[$pos]/@width"/>
39926890ef5576499f1bd78a1412b43e79f2f694slive </xsl:when>
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:otherwise>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:value-of select=".95 div last()"/>
39926890ef5576499f1bd78a1412b43e79f2f694slive </xsl:otherwise>
39926890ef5576499f1bd78a1412b43e79f2f694slive </xsl:choose>
1cb160a981947e75a8353da3fe40a653aa87100eslive <xsl:text>\textwidth}\small </xsl:text>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:apply-templates/>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:text>\end{minipage}</xsl:text>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:if test="not(position()=last())">
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:text> &amp; </xsl:text>
58842e03db54033d15cc224d997f467abc88a97aslive </xsl:if>
58842e03db54033d15cc224d997f467abc88a97aslive</xsl:template>
58842e03db54033d15cc224d997f467abc88a97aslive
58842e03db54033d15cc224d997f467abc88a97aslive<xsl:template match="th">
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:variable name="pos" select="position()"/>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:text>\begin{minipage}[t]{</xsl:text>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:choose>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:when test="/columnspec">
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:value-of select="/columnspec/column[$pos]/@width"/>
58842e03db54033d15cc224d997f467abc88a97aslive </xsl:when>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:otherwise>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:value-of select=".95 div last()"/>
58842e03db54033d15cc224d997f467abc88a97aslive </xsl:otherwise>
58842e03db54033d15cc224d997f467abc88a97aslive </xsl:choose>
1cb160a981947e75a8353da3fe40a653aa87100eslive <xsl:text>\textwidth}\bfseries </xsl:text>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive <xsl:apply-templates/>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive <xsl:text>\end{minipage}</xsl:text>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive <xsl:if test="not(position()=last())">
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive <xsl:text> &amp; </xsl:text>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive </xsl:if>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive</xsl:template>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive<!--
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive This is a horrible hack, but it seems to mostly work. It does a
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive few things:
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive 1. Transforms references starting in http:// to footnotes with the
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive appropriate hyperref macro to make them clickable. (This needs
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive to be expanded to deal with news: and needs to be adjusted to
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive deal with "#", which is creating bad links at the moment.)
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive 2. For intra-document references, constructs the appropriate absolute
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive reference using a latex \pageref.
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive This involves applying a simplified version of the
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive general URL resolution rules to deal with ../. It only works for
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive one level of subdirectory.
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive 3. It is also necessary to deal with the fact that index pages
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive get references as "/".
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive-->
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="a" mode="tabular">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:apply-templates mode="tabular"/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:call-template name="a"/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="a">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:call-template name="a"/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template name="a">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:if test="@href">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="relpath" select="document(/*/@metafile)/metafile/relpath" />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="path" select="document(/*/@metafile)/metafile/path" />
16e03b5486a143424f332b912df99c0ef6e10130nd<xsl:variable name="href">
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:choose>
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:when test="starts-with(@href, './')">
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:value-of select="substring(@href, 3)" />
16e03b5486a143424f332b912df99c0ef6e10130nd </xsl:when>
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:otherwise>
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:value-of select="@href" />
16e03b5486a143424f332b912df99c0ef6e10130nd </xsl:otherwise>
16e03b5486a143424f332b912df99c0ef6e10130nd </xsl:choose>
16e03b5486a143424f332b912df99c0ef6e10130nd</xsl:variable>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="fileref">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:choose>
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:when test="contains($href, '.html')">
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:value-of select="substring-before($href, '.html')"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:otherwise>
16e03b5486a143424f332b912df99c0ef6e10130nd <xsl:value-of select="concat($href, 'index')"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:variable>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:choose>
39926890ef5576499f1bd78a1412b43e79f2f694slive
05bc0ffcc324385e6110d3f3fd0e17e172378343nd<xsl:when test="starts-with(@href, 'http:') or starts-with(@href, 'https:') or starts-with(@href, 'ftp:') or starts-with(@href, 'news:') or starts-with(@href, 'mailto:')">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:if test="not(.=@href)">
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:text>\footnote{</xsl:text>
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:text>\href{</xsl:text>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:call-template name="replace-string">
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="replace" select="'%'"/>
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="with" select="'\%'"/>
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="text">
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:call-template name="replace-string">
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="replace" select="'_'"/>
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="with" select="'\_'"/>
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="text">
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:call-template name="replace-string">
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="replace" select="'#'"/>
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="with" select="'\#'"/>
9effaa6977a494fc6477fed772df0377b65db169nd <xsl:with-param name="text" select="@href"/>
9effaa6977a494fc6477fed772df0377b65db169nd </xsl:call-template>
9effaa6977a494fc6477fed772df0377b65db169nd </xsl:with-param>
9effaa6977a494fc6477fed772df0377b65db169nd </xsl:call-template>
9effaa6977a494fc6477fed772df0377b65db169nd </xsl:with-param>
58842e03db54033d15cc224d997f467abc88a97aslive </xsl:call-template>
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:text>}{</xsl:text>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:call-template name="ltescape">
39926890ef5576499f1bd78a1412b43e79f2f694slive <xsl:with-param name="string" select="@href"/>
39926890ef5576499f1bd78a1412b43e79f2f694slive </xsl:call-template>
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive <xsl:text>}}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:if>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:when test="starts-with(@href, '#')">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Don't do inter-section references -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:text> (p.\ \pageref{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:call-template name="replace-string">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:with-param name="replace" select="'#'"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:with-param name="with" select="':'"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:with-param name="text">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:when test="$relpath='.'">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:value-of select="concat('/',$fileref)"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:when test="starts-with($fileref,'..')">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:value-of select="substring-after($fileref,'..')"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:value-of select="concat($path,$fileref)"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:with-param>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:call-template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:text>}) </xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:if>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="img">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:call-template name="img"/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template match="img" mode="tabular">
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:call-template name="img"/>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd</xsl:template>
97d4d9527b64d7491543a12a3d21134b857cbe4bnd
97d4d9527b64d7491543a12a3d21134b857cbe4bnd<xsl:template name="img">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="path" select="document(/*/@metafile)/metafile/path" />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\includegraphics{</xsl:text>
0097a4f3e468c0192a2ce52ffee7bc8cea0a620bslive <xsl:call-template name="replace-string">
0097a4f3e468c0192a2ce52ffee7bc8cea0a620bslive <xsl:with-param name="text" select="concat('.',$path,@src)"/>
0097a4f3e468c0192a2ce52ffee7bc8cea0a620bslive <xsl:with-param name="replace" select="'.gif'"/>
0097a4f3e468c0192a2ce52ffee7bc8cea0a620bslive <xsl:with-param name="with" select="''"/>
0097a4f3e468c0192a2ce52ffee7bc8cea0a620bslive </xsl:call-template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end</xsl:stylesheet>