html.xsl revision 58842e03db54033d15cc224d997f467abc88a97a
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<?xml version="1.0"?>
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
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- ==================================================================== -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- Ordinary HTML that must be converted to latex -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!-- ==================================================================== -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="ul">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\begin{itemize}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\end{itemize}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="ol">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\begin{enumerate}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\end{enumerate}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="li">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\item </xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="dl">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\begin{description}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\end{description}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
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
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. -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="br">
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])='')">
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <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])='')">
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive <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/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\par
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="code">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\texttt{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="strong">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\textbf{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="em">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\textit{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
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 -->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="pre">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\begin{verbatim}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:value-of select="."/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\end{verbatim}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="blockquote">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\begin{quotation}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\end{quotation}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
39926890ef5576499f1bd78a1412b43e79f2f694slive<!-- XXX: We need to deal with table headers -->
39926890ef5576499f1bd78a1412b43e79f2f694slive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="table">
87ea898bcffe2ef490e833dc246a1cc0465d783fslive<xsl:text>\fbox{\begin{tabular}{</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>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive<xsl:text>}</xsl:text>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive<xsl:apply-templates select="tr"/>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive<xsl:text>\end{tabular}}
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:text>
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>
87ea898bcffe2ef490e833dc246a1cc0465d783fslive <xsl:text>
04ff03c2d7e0ff45ee181eb1fa5bf7649ffcf6bfslive</xsl:text>
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>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:text>\linewidth}\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>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:text>\linewidth}\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-->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:template match="a">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:apply-templates/>
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" />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="fileref">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:when test="contains(@href, '.html')">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:value-of select="substring-before(@href, '.html')"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:when>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <xsl:value-of select="concat(@href, 'index')"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:otherwise>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </xsl:choose>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:variable>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:choose>
39926890ef5576499f1bd78a1412b43e79f2f694slive
39926890ef5576499f1bd78a1412b43e79f2f694slive<xsl:when test="starts-with(@href, 'http:') 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">
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:with-param name="text" select="@href"/>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:with-param name="replace" select="'#'"/>
58842e03db54033d15cc224d997f467abc88a97aslive <xsl:with-param name="with" select="'\#'"/>
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">
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>[Image not coverted]</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!--
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:variable name="path" select="document(/*/@metafile)/metafile/path" />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>\includegraphics{</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:value-of select="concat('.',$path,@src)"/>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<xsl:text>}</xsl:text>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive-->
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:template>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive</xsl:stylesheet>