aboutsummaryrefslogtreecommitdiffstats
path: root/stylesheets/xhtml
diff options
context:
space:
mode:
authorManuel Canales Esparcia <manuel@linuxfromscratch.org>2004-12-19 21:17:48 +0000
committerManuel Canales Esparcia <manuel@linuxfromscratch.org>2004-12-19 21:17:48 +0000
commitf7bd105db3cf74fb6d2bfed726cf5d187cb1109f (patch)
tree0077803fc32f39b293b3860f6ffa765eefcec94f /stylesheets/xhtml
parent6d3af72bf2b333798eba7b88075fccab9441519f (diff)
Updated the stylesheets and Makefile.
Removed contrib/, index-pdf.xml and goTidy. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4428 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'stylesheets/xhtml')
-rw-r--r--stylesheets/xhtml/lfs-admon.xsl13
-rw-r--r--stylesheets/xhtml/lfs-index.xsl36
-rw-r--r--stylesheets/xhtml/lfs-mixed.xsl79
-rw-r--r--stylesheets/xhtml/lfs-navigational.xsl44
-rw-r--r--stylesheets/xhtml/lfs-sections.xsl105
-rw-r--r--stylesheets/xhtml/lfs-titles.xsl37
-rw-r--r--stylesheets/xhtml/lfs-toc.xsl19
-rw-r--r--stylesheets/xhtml/lfs-xref.xsl270
8 files changed, 538 insertions, 65 deletions
diff --git a/stylesheets/xhtml/lfs-admon.xsl b/stylesheets/xhtml/lfs-admon.xsl
index e83956d12..9b03394a9 100644
--- a/stylesheets/xhtml/lfs-admon.xsl
+++ b/stylesheets/xhtml/lfs-admon.xsl
@@ -21,19 +21,20 @@
<xsl:otherwise>Note</xsl:otherwise>
</xsl:choose>
</xsl:variable>
+ <xsl:variable name="alt">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="$admon.type"/>
+ </xsl:call-template>
+ </xsl:variable>
<div class="{name(.)}">
<div class ="admonhead">
- <img alt="[{$admon.type}]">
+ <img alt="[{$alt}]">
<xsl:attribute name="src">
<xsl:call-template name="admon.graphic"/>
</xsl:attribute>
</img>
<h3 class="admontitle">
- <xsl:value-of select="$admon.type"/>
- <xsl:if test="title">
- <xsl:text>: </xsl:text>
- <xsl:value-of select="title"/>
- </xsl:if>
+ <xsl:apply-templates select="." mode="object.title.markup"/>
</h3>
</div>
<div class="admonbody">
diff --git a/stylesheets/xhtml/lfs-index.xsl b/stylesheets/xhtml/lfs-index.xsl
index 4e9a43255..15f1f07ec 100644
--- a/stylesheets/xhtml/lfs-index.xsl
+++ b/stylesheets/xhtml/lfs-index.xsl
@@ -16,16 +16,20 @@
</xsl:template>
<!--Title-->
- <xsl:param name="index-title">Index of packages and important installed files</xsl:param>
+ <xsl:param name="index-title">Index</xsl:param>
<xsl:template match="index" mode="title.markup">
- <xsl:value-of select="$index-title"/>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="$index-title"/>
+ </xsl:call-template>
</xsl:template>
-
+
<xsl:template name="index.titlepage">
<div class="titlepage">
<h1 class="index">
- <xsl:value-of select="$index-title"/>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="$index-title"/>
+ </xsl:call-template>
</h1>
</div>
</xsl:template>
@@ -42,19 +46,29 @@
<h2>
<xsl:choose>
<xsl:when test="$divtitle = 'A'">
- <xsl:text>Packages</xsl:text>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Packages</xsl:with-param>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="$divtitle = 'B'">
- <xsl:text>Programs</xsl:text>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Programs</xsl:with-param>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="$divtitle = 'C'">
- <xsl:text>Libraries</xsl:text>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Libraries</xsl:with-param>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="$divtitle = 'D'">
- <xsl:text>Scripts</xsl:text>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Scripts</xsl:with-param>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="$divtitle = 'E'">
- <xsl:text>Others</xsl:text>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Others</xsl:with-param>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$divtitle"/>
@@ -162,7 +176,9 @@
<xsl:with-param name="object" select="$target2[1]"/>
</xsl:call-template>
</xsl:attribute>
- <xsl:text>description</xsl:text>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">description</xsl:with-param>
+ </xsl:call-template>
</a>
</xsl:when>
<xsl:otherwise>
diff --git a/stylesheets/xhtml/lfs-mixed.xsl b/stylesheets/xhtml/lfs-mixed.xsl
index 0660116a4..20344d449 100644
--- a/stylesheets/xhtml/lfs-mixed.xsl
+++ b/stylesheets/xhtml/lfs-mixed.xsl
@@ -9,9 +9,7 @@
<xsl:choose>
<xsl:when test="child::* = userinput">
<pre class="userinput">
- <kbd class="command">
- <xsl:value-of select="."/>
- </kbd>
+ <xsl:apply-templates/>
</pre>
</xsl:when>
<xsl:otherwise>
@@ -22,6 +20,20 @@
</xsl:choose>
</xsl:template>
+ <xsl:template match="userinput">
+ <xsl:choose>
+ <xsl:when test="ancestor::screen">
+ <kbd class="command">
+ <xsl:apply-templates/>
+ </kbd>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
<!-- variablelist -->
<xsl:template match="variablelist">
<div class="{name(.)}">
@@ -60,48 +72,27 @@
</xsl:attribute>
</xsl:template>
- <!-- Sect1 attributes -->
- <xsl:template match="sect1">
- <div>
- <xsl:choose>
- <xsl:when test="@role">
- <xsl:attribute name="class">
- <xsl:value-of select="@role"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="class">
- <xsl:value-of select="name(.)"/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="language.attribute"/>
- <xsl:call-template name="sect1.titlepage"/>
- <xsl:apply-templates/>
- <xsl:call-template name="process.chunk.footnotes"/>
- </div>
+ <!-- External URLs in italic font -->
+ <xsl:template match="ulink" name="ulink">
+ <a>
+ <xsl:if test="@id">
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
+ <i>
+ <xsl:choose>
+ <xsl:when test="count(child::node())=0">
+ <xsl:value-of select="@url"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </i>
+ </a>
</xsl:template>
- <!-- Sect2 attributes -->
- <xsl:template match="sect2">
- <div>
- <xsl:choose>
- <xsl:when test="@role">
- <xsl:attribute name="class">
- <xsl:value-of select="@role"/>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="class">
- <xsl:value-of select="name(.)"/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="language.attribute"/>
- <xsl:call-template name="sect2.titlepage"/>
- <xsl:apply-templates/>
- <xsl:call-template name="process.chunk.footnotes"/>
- </div>
- </xsl:template>
</xsl:stylesheet>
diff --git a/stylesheets/xhtml/lfs-navigational.xsl b/stylesheets/xhtml/lfs-navigational.xsl
index cfed29ede..bab237142 100644
--- a/stylesheets/xhtml/lfs-navigational.xsl
+++ b/stylesheets/xhtml/lfs-navigational.xsl
@@ -68,14 +68,32 @@
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="title">
- <xsl:value-of select="$next/title"/>
+ <xsl:choose>
+ <xsl:when test="local-name($next)='index'">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Index</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next/title"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
<xsl:call-template name="navig.content">
<xsl:with-param name="direction" select="'next'"/>
</xsl:call-template>
</a>
<p>
- <xsl:value-of select="$next/title"/>
+ <xsl:choose>
+ <xsl:when test="local-name($next)='index'">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Index</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next/title"/>
+ </xsl:otherwise>
+ </xsl:choose>
</p>
</li>
</xsl:if>
@@ -160,14 +178,32 @@
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="title">
- <xsl:value-of select="$next/title"/>
+ <xsl:choose>
+ <xsl:when test="local-name($next)='index'">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Index</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next/title"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
<xsl:call-template name="navig.content">
<xsl:with-param name="direction" select="'next'"/>
</xsl:call-template>
</a>
<p>
- <xsl:value-of select="$next/title"/>
+ <xsl:choose>
+ <xsl:when test="local-name($next)='index'">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key">Index</xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next/title"/>
+ </xsl:otherwise>
+ </xsl:choose>
</p>
</li>
</xsl:if>
diff --git a/stylesheets/xhtml/lfs-sections.xsl b/stylesheets/xhtml/lfs-sections.xsl
new file mode 100644
index 000000000..210ea0c46
--- /dev/null
+++ b/stylesheets/xhtml/lfs-sections.xsl
@@ -0,0 +1,105 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+
+ <!-- Sect1 attributes -->
+ <xsl:template match="sect1">
+ <div>
+ <xsl:choose>
+ <xsl:when test="@role">
+ <xsl:attribute name="class">
+ <xsl:value-of select="@role"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">
+ <xsl:value-of select="name(.)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="language.attribute"/>
+ <xsl:call-template name="sect1.titlepage"/>
+ <xsl:apply-templates/>
+ <xsl:call-template name="process.chunk.footnotes"/>
+ </div>
+ </xsl:template>
+
+ <!-- Sect2 attributes -->
+ <xsl:template match="sect2">
+ <div>
+ <xsl:choose>
+ <xsl:when test="@role">
+ <xsl:attribute name="class">
+ <xsl:value-of select="@role"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">
+ <xsl:value-of select="name(.)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="language.attribute"/>
+ <xsl:call-template name="sect2.titlepage"/>
+ <xsl:apply-templates/>
+ <xsl:call-template name="process.chunk.footnotes"/>
+ </div>
+ </xsl:template>
+
+ <!-- Sections numbering -->
+ <xsl:param name="section.autolabel" select="1"/>
+ <xsl:param name="section.label.includes.component.label" select="1"/>
+
+ <!-- Skip numeraration for sections with empty title -->
+ <xsl:template match="sect2|sect3|sect4|sect5" mode="label.markup">
+ <xsl:if test="string-length(title) > 0">
+ <!-- label the parent -->
+ <xsl:variable name="parent.label">
+ <xsl:apply-templates select=".." mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="$parent.label != ''">
+ <xsl:apply-templates select=".." mode="label.markup"/>
+ <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@label">
+ <xsl:value-of select="@label"/>
+ </xsl:when>
+ <xsl:when test="$section.autolabel != 0">
+ <xsl:choose>
+ <xsl:when test="local-name(.) = 'sect2'">
+ <xsl:choose>
+ <!-- If the first sect2 isn't numbered, renumber the remainig sections -->
+ <xsl:when test="string-length(../sect2[1]/title) = 0">
+ <xsl:variable name="totalsect2">
+ <xsl:number count="sect2"/>
+ </xsl:variable>
+ <xsl:number value="$totalsect2 - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:number count="sect2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="local-name(.) = 'sect3'">
+ <xsl:number count="sect3"/>
+ </xsl:when>
+ <xsl:when test="local-name(.) = 'sect4'">
+ <xsl:number count="sect4"/>
+ </xsl:when>
+ <xsl:when test="local-name(.) = 'sect5'">
+ <xsl:number count="sect5"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>label.markup: this can't happen!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet> \ No newline at end of file
diff --git a/stylesheets/xhtml/lfs-titles.xsl b/stylesheets/xhtml/lfs-titles.xsl
index db79fdee3..be65a93ce 100644
--- a/stylesheets/xhtml/lfs-titles.xsl
+++ b/stylesheets/xhtml/lfs-titles.xsl
@@ -7,6 +7,8 @@
<xsl:template name="part.titlepage">
<div class="titlepage">
<h1 class="{name(.)}">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:text>. </xsl:text>
<xsl:value-of select="title"/>
</h1>
</div>
@@ -15,6 +17,8 @@
<xsl:template name="chapter.titlepage">
<div class="titlepage">
<h1 class="{name(.)}">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:text>. </xsl:text>
<xsl:value-of select="title"/>
</h1>
</div>
@@ -28,6 +32,16 @@
</div>
</xsl:template>
+ <xsl:template name="appendix.titlepage">
+ <div class="titlepage">
+ <h1 class="{name(.)}">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:text>. </xsl:text>
+ <xsl:value-of select="title"/>
+ </h1>
+ </div>
+ </xsl:template>
+
<xsl:template name="sect1.titlepage">
<xsl:choose>
<!-- I should find a better test -->
@@ -37,6 +51,8 @@
<a id="{@id}" name="{@id}"/>
</xsl:if>
<h2 class="{name(.)}">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:text>. </xsl:text>
<xsl:value-of select="title"/>
</h2>
</div>
@@ -44,6 +60,8 @@
<xsl:otherwise>
<div class="titlepage">
<h1 class="{name(.)}">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:text>. </xsl:text>
<xsl:value-of select="title"/>
</h1>
</div>
@@ -60,6 +78,8 @@
<a id="{@id}" name="{@id}"/>
</xsl:if>
<h2 class="{name(.)}">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:text>. </xsl:text>
<xsl:value-of select="title"/>
</h2>
</div>
@@ -75,4 +95,21 @@
</div>
</xsl:template>
+ <!-- Added the role param for proper punctuation in xref calls. -->
+ <xsl:template match="*" mode="insert.title.markup">
+ <xsl:param name="purpose"/>
+ <xsl:param name="xrefstyle"/>
+ <xsl:param name="title"/>
+ <xsl:param name="role"/>
+ <xsl:choose>
+ <xsl:when test="$purpose = 'xref' and titleabbrev">
+ <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$title"/>
+ <xsl:value-of select="$role"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>
diff --git a/stylesheets/xhtml/lfs-toc.xsl b/stylesheets/xhtml/lfs-toc.xsl
index 56ad11ebc..4fb845844 100644
--- a/stylesheets/xhtml/lfs-toc.xsl
+++ b/stylesheets/xhtml/lfs-toc.xsl
@@ -6,7 +6,7 @@
<!-- General settings -->
<xsl:param name="generate.toc">
- appendix toc
+ appendix nop
book toc,title,figure,table,example,equation
chapter nop
part toc
@@ -93,6 +93,23 @@
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</a>
</xsl:when>
+ <xsl:when test="local-name(.) = 'appendix'">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="context" select="$toc-context"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:variable name="label">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ </xsl:variable>
+ <xsl:copy-of select="$label"/>
+ <xsl:if test="$label != ''">
+ <xsl:value-of select="$autotoc.label.separator"/>
+ </xsl:if>
+ <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+ </a>
+ </xsl:when>
<xsl:when test="local-name(.) = 'chapter' or local-name(.) = 'preface'">
<h4>
<xsl:variable name="label">
diff --git a/stylesheets/xhtml/lfs-xref.xsl b/stylesheets/xhtml/lfs-xref.xsl
new file mode 100644
index 000000000..f82037fe5
--- /dev/null
+++ b/stylesheets/xhtml/lfs-xref.xsl
@@ -0,0 +1,270 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="1.0">
+
+ <!-- Making a proper punctuation in xref (only for English language).-->
+ <xsl:template match="xref" name="xref">
+ <xsl:variable name="targets" select="key('id',@linkend)"/>
+ <xsl:variable name="target" select="$targets[1]"/>
+ <xsl:variable name="refelem" select="local-name($target)"/>
+ <xsl:variable name="role" select="@role"/>
+ <xsl:call-template name="check.id.unique">
+ <xsl:with-param name="linkend" select="@linkend"/>
+ </xsl:call-template>
+ <xsl:call-template name="anchor"/>
+ <xsl:choose>
+ <xsl:when test="count($target) = 0">
+ <xsl:message>
+ <xsl:text>XRef to nonexistent id: </xsl:text>
+ <xsl:value-of select="@linkend"/>
+ </xsl:message>
+ <xsl:text>???</xsl:text>
+ </xsl:when>
+ <xsl:when test="$target/@xreflabel">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$target"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="xref.xreflabel">
+ <xsl:with-param name="target" select="$target"/>
+ </xsl:call-template>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$target"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
+ <a href="{$href}">
+ <xsl:if test="$target/title or $target/*/title">
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="$target" mode="xref-title"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="$target" mode="xref-to">
+ <xsl:with-param name="referrer" select="."/>
+ <xsl:with-param name="role" select="$role"/>
+ <xsl:with-param name="xrefstyle">
+ <xsl:value-of select="@xrefstyle"/>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </a>
+ <xsl:apply-templates select="$target" mode="xref-to-suffix"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="section|simplesect|sect1|sect2|sect3|sect4|sect5|refsect1
+ |refsect2|refsect3|refsection" mode="xref-to">
+ <xsl:param name="referrer"/>
+ <xsl:param name="xrefstyle"/>
+ <xsl:param name="role"/>
+ <xsl:apply-templates select="." mode="object.xref.markup">
+ <xsl:with-param name="purpose" select="'xref'"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="role" select="$role"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="*" mode="object.xref.markup">
+ <xsl:param name="purpose"/>
+ <xsl:param name="xrefstyle"/>
+ <xsl:param name="referrer"/>
+ <xsl:param name="role"/>
+ <xsl:variable name="template">
+ <xsl:choose>
+ <xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')">
+ <xsl:call-template name="make.gentext.template">
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="referrer" select="$referrer"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with(normalize-space($xrefstyle), 'template:')">
+ <xsl:value-of select="substring-after(normalize-space($xrefstyle), 'template:')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="object.xref.template">
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="referrer" select="$referrer"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$template = ''">
+ <xsl:message>
+ <xsl:text>object.xref.markup: empty xref template</xsl:text>
+ <xsl:text> for linkend="</xsl:text>
+ <xsl:value-of select="@id"/>
+ <xsl:text>" and @xrefstyle="</xsl:text>
+ <xsl:value-of select="$xrefstyle"/>
+ <xsl:text>"</xsl:text>
+ </xsl:message>
+ </xsl:if>
+ <xsl:call-template name="substitute-markup">
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="template" select="$template"/>
+ <xsl:with-param name="role" select="$role"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="substitute-markup">
+ <xsl:param name="template" select="''"/>
+ <xsl:param name="allow-anchors" select="'0'"/>
+ <xsl:param name="title" select="''"/>
+ <xsl:param name="subtitle" select="''"/>
+ <xsl:param name="label" select="''"/>
+ <xsl:param name="pagenumber" select="''"/>
+ <xsl:param name="purpose"/>
+ <xsl:param name="xrefstyle"/>
+ <xsl:param name="referrer"/>
+ <xsl:param name="role"/>
+ <xsl:choose>
+ <xsl:when test="contains($template, '%')">
+ <xsl:value-of select="substring-before($template, '%')"/>
+ <xsl:variable name="candidate"
+ select="substring(substring-after($template, '%'), 1, 1)"/>
+ <xsl:choose>
+ <xsl:when test="$candidate = 't'">
+ <xsl:apply-templates select="." mode="insert.title.markup">
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="role" select="$role"/>
+ <xsl:with-param name="title">
+ <xsl:choose>
+ <xsl:when test="$title != ''">
+ <xsl:copy-of select="$title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="title.markup">
+ <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$candidate = 's'">
+ <xsl:apply-templates select="." mode="insert.subtitle.markup">
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="subtitle">
+ <xsl:choose>
+ <xsl:when test="$subtitle != ''">
+ <xsl:copy-of select="$subtitle"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="subtitle.markup">
+ <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$candidate = 'n'">
+ <xsl:apply-templates select="." mode="insert.label.markup">
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="label">
+ <xsl:choose>
+ <xsl:when test="$label != ''">
+ <xsl:copy-of select="$label"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="label.markup"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$candidate = 'p'">
+ <xsl:apply-templates select="." mode="insert.pagenumber.markup">
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="pagenumber">
+ <xsl:choose>
+ <xsl:when test="$pagenumber != ''">
+ <xsl:copy-of select="$pagenumber"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="pagenumber.markup"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$candidate = 'd'">
+ <xsl:apply-templates select="." mode="insert.direction.markup">
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="direction">
+ <xsl:choose>
+ <xsl:when test="$referrer">
+ <xsl:variable name="referent-is-below">
+ <xsl:for-each select="preceding::xref">
+ <xsl:if test="generate-id(.) = generate-id($referrer)">1</xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$referent-is-below = ''">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'above'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'below'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>Attempt to use %d in gentext with no referrer!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$candidate = '%' ">
+ <xsl:text>%</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>%</xsl:text><xsl:value-of select="$candidate"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- recurse with the rest of the template string -->
+ <xsl:variable name="rest"
+ select="substring($template,
+ string-length(substring-before($template, '%'))+3)"/>
+ <xsl:call-template name="substitute-markup">
+ <xsl:with-param name="template" select="$rest"/>
+ <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+ <xsl:with-param name="title" select="$title"/>
+ <xsl:with-param name="subtitle" select="$subtitle"/>
+ <xsl:with-param name="label" select="$label"/>
+ <xsl:with-param name="pagenumber" select="$pagenumber"/>
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="role" select="$role"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$template"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>