summaryrefslogtreecommitdiff
path: root/tests/docbook/html/footnote.xsl
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-02-24 17:21:58 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-02-24 17:21:58 +0000
commit2dd3ac6cc5ad82c0435e293f091faab4638158ef (patch)
tree14b2ead479f3dee1dbc420709bc22884e054c13d /tests/docbook/html/footnote.xsl
parent294ccb6850f153440bdfc5c8936d9871f6f0a123 (diff)
downloadlibxslt-2dd3ac6cc5ad82c0435e293f091faab4638158ef.tar.gz
libxslt-2dd3ac6cc5ad82c0435e293f091faab4638158ef.tar.bz2
libxslt-2dd3ac6cc5ad82c0435e293f091faab4638158ef.zip
Oops seems I forgot to commit the stylesheets themselves ... Daniel
Diffstat (limited to 'tests/docbook/html/footnote.xsl')
-rw-r--r--tests/docbook/html/footnote.xsl138
1 files changed, 138 insertions, 0 deletions
diff --git a/tests/docbook/html/footnote.xsl b/tests/docbook/html/footnote.xsl
new file mode 100644
index 00000000..a5c7ec7d
--- /dev/null
+++ b/tests/docbook/html/footnote.xsl
@@ -0,0 +1,138 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<!-- ********************************************************************
+ $Id$
+ ********************************************************************
+
+ This file is part of the XSL DocBook Stylesheet distribution.
+ See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+ and other information.
+
+ ******************************************************************** -->
+
+<xsl:template match="footnote">
+ <xsl:variable name="name">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:text>#ftn.</xsl:text>
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="ancestor::table|ancestor::informaltable">
+ <sup>
+ <xsl:text>[</xsl:text>
+ <a name="{$name}" href="{$href}">
+ <xsl:apply-templates select="." mode="footnote.number"/>
+ </a>
+ <xsl:text>]</xsl:text>
+ </sup>
+ </xsl:when>
+ <xsl:otherwise>
+ <sup>
+ <xsl:text>[</xsl:text>
+ <a name="{$name}" href="{$href}">
+ <xsl:apply-templates select="." mode="footnote.number"/>
+ </a>
+ <xsl:text>]</xsl:text>
+ </sup>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="footnoteref">
+ <xsl:variable name="targets" select="id(@linkend)"/>
+ <xsl:variable name="footnote" select="$targets[1]"/>
+ <xsl:variable name="href">
+ <xsl:text>#ftn.</xsl:text>
+ <xsl:call-template name="object.id">
+ <xsl:with-param name="object" select="$footnote"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <sup>
+ <xsl:text>[</xsl:text>
+ <a href="{$href}">
+ <xsl:apply-templates select="$footnote" mode="footnote.number"/>
+ </a>
+ <xsl:text>]</xsl:text>
+ </sup>
+</xsl:template>
+
+<xsl:template match="footnote" mode="footnote.number">
+ <xsl:choose>
+ <xsl:when test="ancestor::table|ancestor::informaltable">
+ <xsl:number level="any" from="table|informaltable" format="a"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:number level="any" format="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="footnote/para[1]">
+ <!-- this only works if the first thing in a footnote is a para, -->
+ <!-- which is ok, because it usually is. -->
+ <xsl:variable name="name">
+ <xsl:text>ftn.</xsl:text>
+ <xsl:call-template name="object.id">
+ <xsl:with-param name="object" select="ancestor::footnote"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:text>#</xsl:text>
+ <xsl:call-template name="object.id">
+ <xsl:with-param name="object" select="ancestor::footnote"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <p>
+ <sup>
+ <xsl:text>[</xsl:text>
+ <a name="{$name}" href="{$href}">
+ <xsl:apply-templates select="ancestor::footnote"
+ mode="footnote.number"/>
+ </a>
+ <xsl:text>] </xsl:text>
+ </sup>
+ <xsl:apply-templates/>
+ </p>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process.footnotes">
+ <xsl:variable name="footnotes" select=".//footnote"/>
+ <xsl:variable name="table.footnotes"
+ select=".//table//footnote|.//informaltable//footnote"/>
+
+ <!-- Only bother to do this if there's at least one non-table footnote -->
+ <xsl:if test="count($footnotes)>count($table.footnotes)">
+ <div class="footnotes">
+ <br/>
+ <hr width="100" align="left"/>
+ <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="footnote" mode="process.footnote.mode">
+ <div class="{name(.)}">
+ <xsl:apply-templates/>
+ </div>
+</xsl:template>
+
+<xsl:template match="informaltable//footnote|table//footnote"
+ mode="process.footnote.mode">
+</xsl:template>
+
+<xsl:template match="footnote" mode="table.footnote.mode">
+ <div class="{name(.)}">
+ <xsl:apply-templates/>
+ </div>
+</xsl:template>
+
+</xsl:stylesheet>