|
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="titleabbrev.in.toc">1</xsl:param>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="mapheading">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="makeheading">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="command">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="sec-map">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="keyword" select="local-name(.)"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:with-param>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="makeheading">
|
|
Packit Service |
76cb02 |
<xsl:param name="num" select="'1'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="allnum" select="'0'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="level"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="name"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="command"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:param name="title" select="(title|info/title)[1]"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:variable name="rcommand">
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$command=''">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="map.sect.level">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="name" select="$name"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="level" select="$level"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="num" select="$num"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="allnum" select="$allnum"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$command"/>
|
|
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:if test="@label and @label!=''">
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="string(number(@label))='NaN' or floor(@label)!=@label">
|
|
Packit Service |
76cb02 |
<xsl:message>
|
|
Packit Service |
76cb02 |
<xsl:text>Warning: only an integer in @label can be processed: '</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="@label"/>
|
|
Packit Service |
76cb02 |
<xsl:text>'</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:message>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:text>\setcounter{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="substring-after($rcommand, '\')"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="number(@label)-1"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}
</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$rcommand"/>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="$title" mode="format.title">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="allnum" select="$allnum"/>
|
|
Packit Service |
76cb02 |
</xsl:apply-templates>
|
|
Packit Service |
76cb02 |
<xsl:call-template name="label.id"/>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="$title" mode="foottext"/>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\section{title string}\label{label.id}
|
|
Packit Service |
76cb02 |
-->
|
|
Packit Service |
76cb02 |
<xsl:template name="maketitle">
|
|
Packit Service |
76cb02 |
<xsl:param name="num" select="'1'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="allnum" select="'0'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="with-label" select="1"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="level"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="name"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="command"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="title"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:variable name="rcommand">
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$command=''">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="map.sect.level">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="name" select="$name"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="level" select="$level"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="num" select="$num"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="allnum" select="$allnum"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$command"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$rcommand"/>
|
|
Packit Service |
76cb02 |
<xsl:text>{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$title"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}
</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:if test="$with-label != 0">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="label.id"/>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="label.id">
|
|
Packit Service |
76cb02 |
<xsl:param name="object" select="."/>
|
|
Packit Service |
76cb02 |
<xsl:param name="string" select="''"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="inline" select="0"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:variable name="id">
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$object/@id">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$object/@id"/>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:when test="$object/@xml:id">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$object/@xml:id"/>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$string"/>
|
|
Packit Service |
76cb02 |
<xsl:if test="$id!=''">
|
|
Packit Service |
76cb02 |
<xsl:text>\label{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="normalize-space($id)"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:text>\hyperlabel{</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="normalize-space($id)"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:if test="$inline=0">
|
|
Packit Service |
76cb02 |
<xsl:text>%
</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
It gives something like:
|
|
Packit Service |
76cb02 |
[{string in TOC}]{heading string}
|
|
Packit Service |
76cb02 |
-->
|
|
Packit Service |
76cb02 |
<xsl:template match="title|table/caption" mode="format.title">
|
|
Packit Service |
76cb02 |
<xsl:param name="allnum" select="'0'"/>
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="." mode="toc">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="allnum" select="$allnum"/>
|
|
Packit Service |
76cb02 |
</xsl:apply-templates>
|
|
Packit Service |
76cb02 |
<xsl:text>{</xsl:text>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:apply-templates select="." mode="content"/>
|
|
Packit Service |
76cb02 |
<xsl:text>}
</xsl:text>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
title if the title contains unsupported things like hot links
|
|
Packit Service |
76cb02 |
or graphics, or if some titleabbrev is provided and should be used
|
|
Packit Service |
76cb02 |
for the TOC.
|
|
Packit Service |
76cb02 |
-->
|
|
Packit Service |
76cb02 |
<xsl:template match="title|table/caption" mode="toc">
|
|
Packit Service |
76cb02 |
<xsl:param name="allnum" select="0"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="pre" select="'[{'"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="post" select="'}]'"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:variable name="abbrev">
|
|
Packit Service |
76cb02 |
<xsl:if test="$titleabbrev.in.toc='1'">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
mode="toc.skip"
|
|
Packit Service |
76cb02 |
select="(../titleabbrev
|
|
Packit Service |
76cb02 |
|../sect1info/titleabbrev
|
|
Packit Service |
76cb02 |
|../sect2info/titleabbrev
|
|
Packit Service |
76cb02 |
|../sect3info/titleabbrev
|
|
Packit Service |
76cb02 |
|../sect4info/titleabbrev
|
|
Packit Service |
76cb02 |
|../sect5info/titleabbrev
|
|
Packit Service |
76cb02 |
|../sectioninfo/titleabbrev
|
|
Packit Service |
76cb02 |
|../chapterinfo/titleabbrev
|
|
Packit Service |
76cb02 |
|../partinfo/titleabbrev
|
|
Packit Service |
76cb02 |
|../refsect1info/titleabbrev
|
|
Packit Service |
76cb02 |
|../refsect2info/titleabbrev
|
|
Packit Service |
76cb02 |
|../refsect3info/titleabbrev
|
|
Packit Service |
76cb02 |
|../refsectioninfo/titleabbrev
|
|
Packit Service |
76cb02 |
|../referenceinfo/titleabbrev
|
|
Packit Service |
76cb02 |
)[1]"/>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
select="parent::refsect1
|
|
Packit Service |
76cb02 |
|parent::refsect2
|
|
Packit Service |
76cb02 |
|parent::refsect3
|
|
Packit Service |
76cb02 |
|parent::refsection
|
|
Packit Service |
76cb02 |
|ancestor::preface
|
|
Packit Service |
76cb02 |
|parent::colophon
|
|
Packit Service |
76cb02 |
|parent::dedication"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
($abbrev!='' or
|
|
Packit Service |
76cb02 |
(descendant::footnote|
|
|
Packit Service |
76cb02 |
descendant::xref|
|
|
Packit Service |
76cb02 |
descendant::link|
|
|
Packit Service |
76cb02 |
descendant::ulink|
|
|
Packit Service |
76cb02 |
descendant::anchor|
|
|
Packit Service |
76cb02 |
descendant::glossterm[@linkend]|
|
|
Packit Service |
76cb02 |
descendant::inlinegraphic|
|
|
Packit Service |
76cb02 |
descendant::inlinemediaobject) or
|
|
Packit Service |
76cb02 |
(descendant::glossterm and $glossterm.auto.link != 0))">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$pre"/>
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$abbrev!=''">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:value-of select="normalize-space($abbrev)"/>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:variable name="s">
|
|
Packit Service |
76cb02 |
<xsl:apply-templates mode="toc.skip"/>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="normalize-space($s)"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$post"/>
|
|
Packit Service |
76cb02 |
</xsl:if>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template match="title|table/caption" mode="content">
|
|
Packit Service |
76cb02 |
<xsl:apply-templates/>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</xsl:stylesheet>
|