|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
XSLT Stylesheet DocBook -> LaTeX
|
|
Packit Service |
76cb02 |
############################################################################ -->
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:param name="co.tagout" select="'</t>'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="co.linkends.show" select="'1'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="callout.markup.circled" select="'1'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="callout.linkends.hot" select="'1'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="calloutlist.style" select="'leftmargin=1cm,style=sameline'"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
* \co{text}
|
|
Packit Service |
76cb02 |
* \coref{text}{label}
|
|
Packit Service |
76cb02 |
* \colabel{label}
|
|
Packit Service |
76cb02 |
* \collabel{label}
|
|
Packit Service |
76cb02 |
-->
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
find the first sequence of the form "<[try]" that is not contained in
|
|
Packit Service |
76cb02 |
the listing, to ensure that no conflict will occur with lstlisting -->
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="co-tagin-gen">
|
|
Packit Service |
76cb02 |
<xsl:param name="text" select="."/>
|
|
Packit Service |
76cb02 |
<xsl:param name="try" select="'0'"/>
|
|
Packit Service |
76cb02 |
<xsl:variable name="tag">
|
|
Packit Service |
76cb02 |
<xsl:text><</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:if test="$try > 0">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$try"/>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="contains($text, $tag)">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:call-template name="co-tagin-gen">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="text" select="$text"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="try" select="$try+1"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$tag"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="coref.link.create">
|
|
Packit Service |
76cb02 |
<xsl:param name="ref"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="rnode" select="/"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="circled" select="0"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
in the RTF, like <areaset>s -->
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
select="($rnode//*[@id=$ref or @xml:id=$ref]|
|
|
Packit Service |
76cb02 |
//*[@id=$ref or @xml:id=$ref])[1]"/>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="$coitem" mode="coref.link">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="circled" select="$circled"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="from" select="local-name(.)"/>
|
|
Packit Service |
76cb02 |
</xsl:apply-templates>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="co|area|callout" mode="coref.link">
|
|
Packit Service |
76cb02 |
<xsl:param name="circled" select="0"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="from"/>
|
|
Packit Service |
76cb02 |
<xsl:variable name="coval">
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="." mode="conumber"/>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:variable name="markup">
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$circled != 0">
|
|
Packit Service |
76cb02 |
<xsl:text>\conum{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$coval"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:when test="$from='callout' and $callout.markup.circled='1'">
|
|
Packit Service |
76cb02 |
<xsl:text>\conum{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$coval"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$coval"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$callout.linkends.hot='0' and $from='callout'">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$markup"/>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:text>\hyperref[</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
|
Packit Service |
76cb02 |
<xsl:text>]{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$markup"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="areaset" mode="coref.link">
|
|
Packit Service |
76cb02 |
<xsl:param name="circled" select="0"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="from"/>
|
|
Packit Service |
76cb02 |
<xsl:for-each select="area">
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="." mode="coref.link">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="circled" select="$circled"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="from" select="$from"/>
|
|
Packit Service |
76cb02 |
</xsl:apply-templates>
|
|
Packit Service |
76cb02 |
<xsl:if test="position()!=last()">
|
|
Packit Service |
76cb02 |
<xsl:text>, </xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:for-each>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="corefs.split">
|
|
Packit Service |
76cb02 |
<xsl:param name="refs"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="rnode" select="/"/>
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="contains($refs, ' ')">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="coref.link.create">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="ref" select="substring-before($refs, ' ')"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
<xsl:text>, </xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:call-template name="corefs.split">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="refs" select="substring-after($refs, ' ')"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:call-template name="coref.link.create">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="ref" select="$refs"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="co|area" mode="linkends.create">
|
|
Packit Service |
76cb02 |
<xsl:param name="rnode" select="/"/>
|
|
Packit Service |
76cb02 |
<xsl:if test="@linkends and $co.linkends.show='1'">
|
|
Packit Service |
76cb02 |
<xsl:text>[</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:call-template name="corefs.split">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="refs" select="normalize-space(@linkends)"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
<xsl:text>]</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="co|area" mode="latex.programlisting">
|
|
Packit Service |
76cb02 |
<xsl:param name="rnode" select="/"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="co-tagin" select="'<'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="co-tagout" select="$co.tagout"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="co-hide" select="0"/>
|
|
Packit Service |
76cb02 |
<xsl:variable name="conum">
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="." mode="conumber"/>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
<xsl:variable name="id" select="(@id|@xml:id)[1]"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:if test="$co-tagin != ''">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="concat($co-tagin, 't>')"/>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$co-hide != 0">
|
|
Packit Service |
76cb02 |
<xsl:if test="$id">
|
|
Packit Service |
76cb02 |
<xsl:text>\colabel{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$id"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:when test="$id">
|
|
Packit Service |
76cb02 |
<xsl:text>\coref{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$conum"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$id"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:text>\co{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$conum"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="." mode="linkends.create">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:apply-templates>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$co-tagout"/>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="coref" mode="latex.programlisting">
|
|
Packit Service |
76cb02 |
<xsl:param name="rnode" select="/"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="co-tagin" select="'<'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="co-tagout" select="$co.tagout"/>
|
|
Packit Service |
76cb02 |
<xsl:variable name="linkend" select="@linkend"/>
|
|
Packit Service |
76cb02 |
<xsl:variable name="co" select="$rnode//*[@id=$linkend or @xml:id=$linkend]"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$co">
|
|
Packit Service |
76cb02 |
<xsl:variable name="conum">
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="$co" mode="conumber"/>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:value-of select="concat($co-tagin, 't>')"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:text>\conum{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$conum"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="$co" mode="linkends.create">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:apply-templates>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$co-tagout"/>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:message>
|
|
Packit Service |
76cb02 |
<xsl:text>*** Invalid coref/@linkend='</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="@linkend"/>
|
|
Packit Service |
76cb02 |
<xsl:text>'</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:message>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="calloutlist">
|
|
Packit Service |
76cb02 |
<xsl:param name="rnode" select="/"/>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="title"/>
|
|
Packit Service |
76cb02 |
<xsl:text>
\begin{description}
</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:if test="$calloutlist.style != ''">
|
|
Packit Service |
76cb02 |
<xsl:text>[</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$calloutlist.style"/>
|
|
Packit Service |
76cb02 |
<xsl:text>]</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
<xsl:text>
</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="callout" mode="item">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:apply-templates>
|
|
Packit Service |
76cb02 |
<xsl:text>\end{description}
</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="callout" mode="item">
|
|
Packit Service |
76cb02 |
<xsl:param name="rnode" select="/"/>
|
|
Packit Service |
76cb02 |
<xsl:text>\item[{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:call-template name="corefs.split">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="refs" select="normalize-space(@arearefs)"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="rnode" select="$rnode"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
<xsl:text>}]</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:if test="(@id|@xml:id) and $co.linkends.show='1'">
|
|
Packit Service |
76cb02 |
<xsl:text>\collabel{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="(@id|@xml:id)[1]"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates/>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="calloutlist/title">
|
|
Packit Service |
76cb02 |
<xsl:text>
{\bf </xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates/>
|
|
Packit Service |
76cb02 |
<xsl:text>}
</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:call-template name="label.id">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="object" select=".."/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:text>\nopagebreak
</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="co|callout" mode="conumber">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
level="any"
|
|
Packit Service |
76cb02 |
format="1"/>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="area" mode="conumber">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
level="any"
|
|
Packit Service |
76cb02 |
format="1"/>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</xsl:stylesheet>
|