diff options
author | John Fleck <jfleck@inkstain.net> | 2003-06-10 13:14:07 +0000 |
---|---|---|
committer | John Fleck <jfleck@src.gnome.org> | 2003-06-10 13:14:07 +0000 |
commit | b00aaf6a1b8db06ccc96300bcbc71aaad50320c1 (patch) | |
tree | c7bc322671f8dac3bc363be0303324a9e54a16e5 | |
parent | 781f3d3b3164a21cced32a93ff6a9b52aca1bc48 (diff) | |
download | yelp-b00aaf6a1b8db06ccc96300bcbc71aaad50320c1.tar.gz |
src/Makefile.am src/yelp-db2html.c src/yelp-scrollkeeper.c
2003-06-10 John Fleck <jfleck@inkstain.net>
* src/Makefile.am
* src/yelp-db2html.c
* src/yelp-scrollkeeper.c
* stylesheets/Makefile.am
* stylesheets/yelp-custom.xsl
* stylesheets/yelp-customization.xsl
added
* stylesheets/yelp-functions.xsl
patch from Shaun McCance to address bug #114117
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/yelp-db2html.c | 4 | ||||
-rw-r--r-- | src/yelp-scrollkeeper.c | 6 | ||||
-rw-r--r-- | stylesheets/Makefile.am | 1 | ||||
-rw-r--r-- | stylesheets/yelp-custom.xsl | 6 | ||||
-rw-r--r-- | stylesheets/yelp-customization.xsl | 1051 | ||||
-rw-r--r-- | stylesheets/yelp-functions.xsl | 375 |
8 files changed, 984 insertions, 475 deletions
@@ -1,3 +1,15 @@ +2003-06-10 John Fleck <jfleck@inkstain.net> + + * src/Makefile.am + * src/yelp-db2html.c + * src/yelp-scrollkeeper.c + * stylesheets/Makefile.am + * stylesheets/yelp-custom.xsl + * stylesheets/yelp-customization.xsl + added + * stylesheets/yelp-functions.xsl + patch from Shaun McCance to address bug #114117 + 2003-06-04 Mikael Hallendal <micke@codefactory.se> * Release 2.3.3 diff --git a/src/Makefile.am b/src/Makefile.am index 0d312a6e..013b1b9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,10 +64,10 @@ yelp_pregenerate_SOURCES = \ yelp-pregenerate.c yelp-pregenerate.h yelp_db2html_LDADD = \ - @DB2HTML_LIBS@ + @DB2HTML_LIBS@ -lexslt yelp_pregenerate_LDADD = \ - @YELP_LIBS@ + @YELP_LIBS@ -lexslt yelp_SOURCES = \ $(gnome_yelp_idl_sources) \ diff --git a/src/yelp-db2html.c b/src/yelp-db2html.c index 2b410cee..9e0348bc 100644 --- a/src/yelp-db2html.c +++ b/src/yelp-db2html.c @@ -42,6 +42,7 @@ #include <libxslt/xsltInternals.h> #include <libxslt/transform.h> #include <libxslt/xsltutils.h> +#include <libexslt/exslt.h> #include "yelp-error.h" @@ -80,6 +81,9 @@ main (gint argc, gchar **argv) xmlSubstituteEntitiesDefault(1); xmlLoadExtDtdDefaultValue = 1; + /* Register the EXSLT extentions */ + exsltRegisterAll(); + /* parse the stylesheet */ stylesheet = xsltParseStylesheetFile (STYLESHEET); diff --git a/src/yelp-scrollkeeper.c b/src/yelp-scrollkeeper.c index 3b50b3a4..64064f61 100644 --- a/src/yelp-scrollkeeper.c +++ b/src/yelp-scrollkeeper.c @@ -293,6 +293,12 @@ scrollkeeper_parse_toc_section (GNode *parent, return; } + /* Restrict the sidebar to be two levels deep */ + if (g_ascii_strncasecmp (xml_node->name, "tocsect1", 8) && + g_ascii_strncasecmp (xml_node->name, "tocsect2", 8)) { + return; + } + name = g_strdup (xml_str); xmlFree (xml_str); g_strstrip (name); diff --git a/stylesheets/Makefile.am b/stylesheets/Makefile.am index 7d35edb0..b01acf3d 100644 --- a/stylesheets/Makefile.am +++ b/stylesheets/Makefile.am @@ -4,6 +4,7 @@ yelpcustomizationdir=$(datadir)/sgml/docbook/yelp yelpcustomization_DATA = \ yelp-customization.xsl \ + yelp-functions.xsl \ yelp-custom.xsl \ l10n.xml diff --git a/stylesheets/yelp-custom.xsl b/stylesheets/yelp-custom.xsl index 248e6841..73606485 100644 --- a/stylesheets/yelp-custom.xsl +++ b/stylesheets/yelp-custom.xsl @@ -795,11 +795,12 @@ heading. Borrowed from Walsh's modular stylesheets --> </xsl:template> - +<!-- <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="book.titlepage.before.verso"> <img align="left" src="stylesheet/gnome-logo-icon.png" alt="GNOME Logo"/> </xsl:template> +--> <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="book.titlepage"> @@ -972,11 +973,12 @@ heading. Borrowed from Walsh's modular stylesheets --> </xsl:template> - +<!-- <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="article.titlepage.before.verso"> <img align="left" src="stylesheet/gnome-logo-icon.png" alt="GNOME Logo"/> </xsl:template> +--> <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="article.titlepage"> diff --git a/stylesheets/yelp-customization.xsl b/stylesheets/yelp-customization.xsl index 8a47754a..32cd381e 100644 --- a/stylesheets/yelp-customization.xsl +++ b/stylesheets/yelp-customization.xsl @@ -1,24 +1,29 @@ <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:func="http://exslt.org/functions" + xmlns:yelp="http://www.gnome.org/" + extension-element-prefixes="func yelp" version='1.0'> <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.48/html/docbook.xsl"/> <xsl:include href="yelp-custom.xsl"/> +<xsl:include href="yelp-functions.xsl"/> <xsl:param name="gdb_docname" /> - <xsl:param name="gdb_pathname" /> - <xsl:param name="gdb_rootid" select="''" /> - <xsl:param name="gdb_multichunk" select="0" /> - <xsl:param name="gdb_stylesheet_path" select="'No Stylesheet'" /> +<xsl:param name="gdb_max_chunk_depth" select="2" /> <xsl:output encoding="ISO-8859-1" /> <!-- Specifies the default path for admonition graphics --> -<xsl:param name="admon.graphics.path"><xsl:text>file://</xsl:text><xsl:value-of select="$gdb_stylesheet_path"/><xsl:text>/images/</xsl:text></xsl:param> +<xsl:param name="admon.graphics.path"> + <xsl:text>file://</xsl:text> + <xsl:value-of select="$gdb_stylesheet_path"/> + <xsl:text>/images/</xsl:text> +</xsl:param> <xsl:param name="table.borders.with.css" select="1"/> @@ -130,15 +135,13 @@ <!-- we are cheating here - but there isn't another way--> <xsl:template name="href.target"> - <xsl:param name="object" select="."/> - <xsl:param name="ancestor" select="$object/ancestor-or-self::*[ - local-name()='sect1' or local-name()='sect2' or local-name()='sect3' or - local-name()='book' or local-name()='part' or local-name()='chapter' or - local-name()='article' or local-name()='appendix' or local-name()='section'][1]"/> - <xsl:text>ghelp:</xsl:text> - <xsl:value-of select="$gdb_docname"/> - <xsl:text>?</xsl:text> - <xsl:value-of select="$ancestor/@id"/> + <xsl:param name="object" select="."/> + + <xsl:text>ghelp:</xsl:text> + <xsl:value-of select="$gdb_docname"/> + <xsl:text>?</xsl:text> + <xsl:value-of select="$object/ancestor-or-self::*[yelp:is-division(.)][ + yelp:get-depth(.) <= $gdb_max_chunk_depth][1]/@id"/> <!-- Uncomment if we support fragment identification <xsl:if test="$object!=$ancestor"> <xsl:text>#</xsl:text> @@ -203,8 +206,7 @@ H1 {font-size: 1.4em} H2 {font-size: 1.3em; margin-bottom: 0} H3 {font-size: 1.2em; margin-bottom: 0} - H4 {font-size: 1.1em} - DIV.sect3 H4 {margin-bottom: -0.5em} + H4 {font-size: 1.1em; margin-bottom: 0} </xsl:text> </style> </xsl:template> @@ -214,7 +216,6 @@ <xsl:attribute name="link">#0000FF</xsl:attribute> <xsl:attribute name="vlink">#840084</xsl:attribute> <xsl:attribute name="alink">#0000FF</xsl:attribute> - </xsl:template> <!-- change some formating choices --> @@ -227,7 +228,6 @@ <xsl:call-template name="inline.monoseq"/> </xsl:template> - <xsl:template match="inlinemediaobject"> <span class="{name(.)}"> <xsl:if test="@id"> @@ -238,487 +238,596 @@ <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> </xsl:template> - - -<!-- the chunking machinery --> - -<xsl:template name="next.link.cell"> - <xsl:param name="object" select="."/> - <td align="right" width="33%"><a accesskey="n"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target"> - <xsl:with-param name="object" select="$object"/> - </xsl:call-template> - </xsl:attribute> - <xsl:choose> - <xsl:when test="$object/title"> - <xsl:value-of select="$object/title/text()"/> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Next'"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - <xsl:text> >>></xsl:text> - </a></td> +<!-- ======================================================================= --> + +<xsl:template name="yelp.next.link.cell"> + <xsl:param name="object" select="."/> + <td align="right" width="33%"><a accesskey="n"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="$object"/> + </xsl:call-template> + </xsl:attribute> + <xsl:choose> + <xsl:when test="yelp:get-title-text($object)"> + <xsl:value-of select="yelp:get-title-text($object)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="gentext"> + <xsl:with-param name="key" select="'Next'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:text> >>></xsl:text> + </a></td> </xsl:template> -<xsl:template name="prev.link.cell"> - <xsl:param name="object" select="."/> - <td align="left" width="33%"><a accesskey="p"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target"> - <xsl:with-param name="object" select="$object"/> - </xsl:call-template> - </xsl:attribute> - <xsl:text><<< </xsl:text> - <xsl:choose> - <xsl:when test="$object/title"> - <xsl:value-of select="$object/title/text()"/> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Previous'"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </a></td> +<xsl:template name="yelp.prev.link.cell"> + <xsl:param name="object" select="."/> + <td align="left" width="33%"><a accesskey="p"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="$object"/> + </xsl:call-template> + </xsl:attribute> + <xsl:text><<< </xsl:text> + <xsl:choose> + <xsl:when test="yelp:get-title-text($object)"> + <xsl:value-of select="yelp:get-title-text($object)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="gentext"> + <xsl:with-param name="key" select="'Previous'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </a></td> </xsl:template> -<xsl:template name="article.toc.ref"> -<xsl:text>ghelp:</xsl:text> -<xsl:value-of select="$gdb_docname"/> +<xsl:template name="yelp.toc.ref"> + <xsl:text>ghelp:</xsl:text> + <xsl:value-of select="$gdb_docname"/> </xsl:template> -<!-- I believe indirect.*.cell can be removed --> -<xsl:template name="indirect.prev.cell"> -<xsl:param name="object" select="."/> -<xsl:choose> - <xsl:when test="count($object/sect2) > 0"> - <xsl:call-template name="prev.link.cell"> - <xsl:with-param name="object" select="$object/sect2[last()]"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="prev.link.cell"> - <xsl:with-param name="object" select="$object"/> - </xsl:call-template> - </xsl:otherwise> -</xsl:choose> +<xsl:template name="yelp.titlepage.ref"> + <xsl:text>ghelp:</xsl:text> + <xsl:value-of select="$gdb_docname"/> + <xsl:text>?title-page</xsl:text> </xsl:template> -<xsl:template name="indirect.next.cell"> -<xsl:param name="object" select="."/> -<xsl:choose> - <xsl:when test="count($object/sect2) > 0"> - <xsl:call-template name="next.link.cell"> - <xsl:with-param name="object" select="$object/sect2[1]"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="next.link.cell"> - <xsl:with-param name="object" select="$object"/> - </xsl:call-template> - </xsl:otherwise> -</xsl:choose> +<xsl:template name="yelp.navbar.prev"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="($node/preceding-sibling::*/descendant-or-self::*) + [yelp:is-division(.)] + [yelp:get-depth(.) <= $gdb_max_chunk_depth]"> + <xsl:call-template name="yelp.prev.link.cell"> + <xsl:with-param name="object" + select="($node/preceding-sibling::*/descendant-or-self::*) + [yelp:is-division(.)] + [yelp:get-depth(.) <= $gdb_max_chunk_depth][last()]"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="yelp:get-depth($node) > 1"> + <xsl:call-template name="yelp.prev.link.cell"> + <xsl:with-param name="object" + select="$node/ancestor::*[yelp:is-division(.)][1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <td><a accesskey="p"> + <xsl:attribute name="href"> + <xsl:call-template name="yelp.toc.ref"/> + </xsl:attribute> + <xsl:text><<< </xsl:text> + <xsl:call-template name="gentext"> + <xsl:with-param name="key" select="'Contents'"/> + </xsl:call-template> + </a></td> + </xsl:otherwise> + </xsl:choose> </xsl:template> -<!-- - article.chunk.prev and article.chunk.next need to be augumented - to take parents siblings children into account ---> - -<xsl:template name="article.chunk.prev"> -<xsl:param name="node" select="."/> - <xsl:choose> - <xsl:when test="local-name($node)='section'"> - <xsl:choose> - <xsl:when - test="count($node/preceding::section[count(ancestor::section)=count($node/ancestor::section)])=0"> - <td><a accesskey="p"> - <xsl:attribute name="href"> - <xsl:call-template name="article.toc.ref"/> - </xsl:attribute> - <xsl:text><<< </xsl:text> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Contents'"/> - </xsl:call-template> - </a></td> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="prev.link.cell"> - <xsl:with-param name="object" - select="$node/preceding::section[count(ancestor::section)=count($node/ancestor::section)][1]"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsl:when> - <xsl:when - test="count($node/preceding::*[local-name()=local-name($node)])=0"> - <td><a accesskey="p"> - <xsl:attribute name="href"> - <xsl:call-template name="article.toc.ref"/> - </xsl:attribute> - <xsl:text><<< </xsl:text> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Contents'"/> - </xsl:call-template> - </a></td> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="prev.link.cell"> - <xsl:with-param name="object" - select="$node/preceding::*[local-name()=local-name($node)][1]"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> +<xsl:template name="yelp.navbar.up"> + <xsl:param name="node" select="."/> + <td align="center" width="33%"><a accesskey="u"> + <xsl:attribute name="href"> + <xsl:call-template name="yelp.toc.ref"/> + </xsl:attribute> + <xsl:call-template name="gentext"> + <xsl:with-param name="key" select="'Contents'"/> + </xsl:call-template> + </a></td> </xsl:template> -<xsl:template name="article.chunk.up"> -<xsl:param name="node" select="."/> -<xsl:param name="doit" select="1"/> -<xsl:choose> - <xsl:when test="$doit=1"> - <td align="center" width="33%"> - <a accesskey="u"> - <xsl:attribute name="href"> - <xsl:call-template name="article.toc.ref"/> - </xsl:attribute> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Contents'"/> - </xsl:call-template> - </a> - </td> - </xsl:when> -</xsl:choose> +<xsl:template name="yelp.navbar.next"> + <xsl:param name="node" select="."/> + + <xsl:choose> + <xsl:when test="(yelp:get-depth($node) < $gdb_max_chunk_depth) and + (count(yelp:get-divisions($node)) > 1)"> + <xsl:call-template name="yelp.next.link.cell"> + <xsl:with-param name="object" + select="yelp:get-divisions($node)[1]"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$node/following-sibling::*[yelp:is-division(.)]"> + <xsl:call-template name="yelp.next.link.cell"> + <xsl:with-param name="object" + select="$node/following-sibling::*[yelp:is-division(.)][1]"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$node/following::*[yelp:is-division(.)]"> + <xsl:call-template name="yelp.next.link.cell"> + <xsl:with-param name="object" + select="$node/following::*[yelp:is-division(.)][1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <td align="right" width="33%"></td> + </xsl:otherwise> + </xsl:choose> </xsl:template> -<xsl:template name="article.chunk.next"> -<xsl:param name="node" select="."/> - <xsl:choose> - <xsl:when test="local-name($node)='section' and - count($node/following::section[count(ancestor::section)=count($node/ancestor::section)]) > 0"> - <xsl:call-template name="next.link.cell"> - <xsl:with-param name="object" - select="$node/following::section[count(ancestor::section)=count($node/ancestor::section)][1]"/> - </xsl:call-template> - </xsl:when> - <xsl:when test="count($node/following::*[local-name()=local-name($node)]) > 0"> - <xsl:call-template name="next.link.cell"> - <xsl:with-param name="object" - select="$node/following::*[local-name()=local-name($node)][1]"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <td align="right" width="33%"> - </td> - </xsl:otherwise> - </xsl:choose> +<!-- ======================================================================= --> + +<xsl:template name="yelp.navbar"> + <xsl:param name="node" select="."/> + <xsl:param name="link-toc" select="false()"/> + <table width="100%"><tr> + <xsl:call-template name="yelp.navbar.prev"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + <xsl:if test="$link-toc"> + <xsl:call-template name="yelp.navbar.up"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + </xsl:if> + <xsl:call-template name="yelp.navbar.next"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + </tr></table> </xsl:template> -<xsl:template name="article.chunk.navigate"> -<xsl:param name="node" select="."/> -<xsl:param name="link-toc" select="1"/> - <tr> - <xsl:call-template name="article.chunk.prev"> - <xsl:with-param name="node" select="$node"/> - </xsl:call-template> - <xsl:call-template name="article.chunk.up"> - <xsl:with-param name="node" select="$node"/> - <xsl:with-param name="doit" select="$link-toc"/> - </xsl:call-template> - <xsl:call-template name="article.chunk.next"> - <xsl:with-param name="node" select="$node"/> - </xsl:call-template> - </tr> +<xsl:template name="yelp.toc.navbar"> + <table width="100%"> + <tr> + <td width="33%"><a accesskey="p"> + <xsl:attribute name="href"> + <xsl:call-template name="yelp.titlepage.ref"/> + </xsl:attribute> + <xsl:text><<< </xsl:text> + <xsl:call-template name="gentext.template"> + <xsl:with-param name="context" select="'title'"/> + <xsl:with-param name="name" select="'bookinfo'"/> + </xsl:call-template> + </a></td> + <xsl:choose> + <!-- Hackery for the User's Guide, which I don't like --> + <xsl:when test="(local-name(.) = 'part') and (count(chapter) = 1)"> + <xsl:call-template name="yelp.next.link.cell"> + <xsl:with-param name="object" + select="yelp:get-divisions(yelp:get-divisions(.)[1])[1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="yelp.next.link.cell"> + <xsl:with-param name="object" select="yelp:get-divisions(.)[1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </tr> + </table> </xsl:template> -<xsl:template name="titlepage.ref"> - <xsl:text>ghelp:</xsl:text> - <xsl:value-of select="$gdb_docname"/> - <xsl:text>?title-page</xsl:text> +<xsl:template name="yelp.titlep.navbar"> + <table width="100%"> + <tr> + <td align="right"><a accesskey="n"> + <xsl:attribute name="href"> + <xsl:call-template name="yelp.toc.ref"/> + </xsl:attribute> + <xsl:call-template name="gentext"> + <xsl:with-param name="key" select="'Contents'"/> + </xsl:call-template> + <xsl:text> >>></xsl:text> + </a></td> + </tr> + </table> </xsl:template> -<xsl:template name="article.render.chunk"> -<xsl:param name="node" select="."/> -<xsl:param name="title" select="/article/articleinfo/title"/> - <p class="header-title"><xsl:value-of select="$title"/></p> - <table width="100%" align="justify"> - <xsl:call-template name="article.chunk.navigate"> - <xsl:with-param name="node" select="$node"/> - <xsl:with-param name="link-toc" select="0"/> - </xsl:call-template> - </table> - <xsl:element name="hr" /> - <xsl:apply-templates select="$node"/> - <xsl:element name="hr"> - <xsl:attribute name="class"><xsl:text>bottom</xsl:text></xsl:attribute> - </xsl:element> - <table width="100%" align="justify"> - <xsl:call-template name="article.chunk.navigate"> - <xsl:with-param name="node" select="$node"/> - <xsl:with-param name="link-toc" select="1"/> - </xsl:call-template> - </table> -</xsl:template> - -<xsl:template name="make.toc.navbar"> - <table width="100%"> - <tr> - <td width="33%"><a accesskey="p"> - <xsl:attribute name="href"> - <xsl:call-template name="titlepage.ref"/> - </xsl:attribute> - <xsl:text><<< </xsl:text> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Previous'"/> - </xsl:call-template> - </a></td> - <!-- No extra td due to GtkHTML bug - <td></td> - --> - <xsl:choose> - <xsl:when test="local-name(.) = 'part'"> - <xsl:call-template name="next.link.cell"> - <xsl:with-param name="object" select="chapter[1]/sect1[1]"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="next.link.cell"> - <xsl:with-param name="object" select="sect1[1]"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </tr> - </table> -</xsl:template> - -<xsl:template name="make.titlep.navbar"> - <table width="100%"> - <tr> - <td align="right"><a accesskey="n"> - <xsl:attribute name="href"> - <xsl:call-template name="article.toc.ref"/> - </xsl:attribute> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Contents'"/> - </xsl:call-template> - <xsl:text> >>></xsl:text> - </a></td> - </tr> - </table> -</xsl:template> - - -<xsl:template name="article.render.titlepage"> -<xsl:param name="container" select="."/> - <xsl:call-template name="make.titlep.navbar"/> - <xsl:apply-templates select="$container/*" mode="titlepage.mode"/> - <xsl:call-template name="make.titlep.navbar"/> -</xsl:template> - -<xsl:template name="yelp.render.toc"> -<xsl:param name="title" select="''" /> - <xsl:call-template name="make.toc.navbar"/> - <xsl:element name="hr"/> - <H1 class="title"><xsl:value-of select="$title"/></H1> - <p class="about"><a> - <xsl:attribute name="href"> - <xsl:call-template name="titlepage.ref"/> - </xsl:attribute> - <xsl:call-template name="gentext.template"> - <xsl:with-param name="context" select="'title'"/> - <xsl:with-param name="name" select="'bookinfo'"/> - </xsl:call-template> - </a></p> - <xsl:choose> - <xsl:when test="local-name(.)='part'"> - <xsl:for-each select="chapter"> - <xsl:call-template name="component.toc"/> - </xsl:for-each> - </xsl:when> - <xsl:when test="local-name(.)='book'"> - <xsl:call-template name="division.toc"/> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="component.toc"/> - </xsl:otherwise> - </xsl:choose> - <xsl:element name="hr"/> - <xsl:call-template name="make.toc.navbar"/> -</xsl:template> - -<xsl:template name="yelp.book.multichunk"> -<xsl:param name="root" select="."/> - -<xsl:for-each select="$root/part"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="division.toc"/> - <xsl:comment> End of chunk </xsl:comment> -</xsl:for-each> - -<xsl:for-each select="$root/part/chapter"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="component.toc"/> - <xsl:comment> End of chunk </xsl:comment> -</xsl:for-each> - -<xsl:for-each select="$root/part/appendix"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="component.toc"/> - <xsl:comment> End of chunk </xsl:comment> -</xsl:for-each> - -<xsl:for-each select="$root/chapter"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="component.toc"/> - <xsl:comment> End of chunk </xsl:comment> -</xsl:for-each> - -<xsl:for-each select="$root/appendix"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="component.toc"/> - <xsl:comment> End of chunk </xsl:comment> -</xsl:for-each> -</xsl:template> - -<xsl:template name="yelp.multichunk"> - <xsl:param name="type"/> - <xsl:param name="container"/> - <xsl:param name="root" select="."/> - - <xsl:comment> End of header </xsl:comment> - - <xsl:comment> Start of chunk: [title-page] </xsl:comment> - <xsl:choose> - <xsl:when test="$type = 'book'"> - <xsl:call-template name="book.titlepage"/> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="article.render.titlepage"> - <xsl:with-param name="container" select="$container"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - <xsl:comment> End of chunk </xsl:comment> - - <xsl:comment> Start of chunk: [toc] </xsl:comment> - <xsl:call-template name="yelp.render.toc"> - <xsl:with-param name="title" select="$container/title"/> - </xsl:call-template> - <xsl:comment> End of chunk </xsl:comment> - - <xsl:if test="$type = 'book'"> - <xsl:call-template name="yelp.book.multichunk"/> - </xsl:if> - - <xsl:for-each select="//sect1"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="article.render.chunk"> - <xsl:with-param name="title" select="$container/title"/> - </xsl:call-template> - <xsl:comment> End of chunk </xsl:comment> - </xsl:for-each> - - <xsl:for-each select="//sect2"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="article.render.chunk"> - <xsl:with-param name="title" select="$container/title"/> - </xsl:call-template> - <xsl:comment> End of chunk </xsl:comment> - </xsl:for-each> - - <xsl:for-each select="//sect3"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="article.render.chunk"> - <xsl:with-param name="title" select="$container/title"/> - </xsl:call-template> - <xsl:comment> End of chunk </xsl:comment> - </xsl:for-each> - - <xsl:for-each select="//section[count(ancestor::section) < 3]"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="article.render.chunk"> - <xsl:with-param name="title" select="$container/title"/> - </xsl:call-template> - <xsl:comment> End of chunk </xsl:comment> - </xsl:for-each> - - <xsl:for-each select="//appendix"> - <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> - <xsl:call-template name="article.render.chunk"> - <xsl:with-param name="title" select="$container/title"/> - </xsl:call-template> - <xsl:comment> End of chunk </xsl:comment> - </xsl:for-each> - - <xsl:comment> Start of footer </xsl:comment> -</xsl:template> <!-- yelp.multichunk --> - -<xsl:template match="/article"> -<xsl:call-template name="yelp.generic.root"> -<xsl:with-param name="container" select="/article/articleinfo"/> -<xsl:with-param name="type" select="'article'"/> -</xsl:call-template> +<!-- ======================================================================= --> + +<xsl:template name="yelp.title"> + <xsl:choose> + <xsl:when test="yelp:get-title(.)"> + <xsl:apply-templates select="yelp:get-title(.)" mode="titlepage.mode"/> + </xsl:when> + <xsl:when test="yelp:get-title-text(.)"> + <h2 class="title"> + <a><xsl:attribute name="href"> + <xsl:call-template name="yelp.titlepage.ref"/> + </xsl:attribute></a> + <xsl:value-of select="yelp:get-title-text(.)"/> + </h2> + </xsl:when> + </xsl:choose> </xsl:template> -<xsl:template match="/part"> -<xsl:call-template name="yelp.generic.root"> -<xsl:with-param name="container" select="/part/partinfo"/> -<xsl:with-param name="type" select="'part'"/> -<xsl:with-param name="root" select="chapter"/> -</xsl:call-template> +<xsl:template name="yelp.titlepage.chunk"> + <xsl:choose> + <xsl:when test="self::article/articleinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="article.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::appendix/appendixinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="appendix.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::chapter/chapterinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="chapter.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::preface/prefaceinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="preface.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::sect1/sect1info"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="sect1.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::sect2/sect2info"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="sect2.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::sect3/sect3info"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="sect3.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::sect4/sect4info"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="sect4.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::sect5/sect5info"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="sect5.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::section/sectioninfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="section.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::set/setinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="set.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::book/bookinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="book.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::part/partinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="part.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::reference/referenceinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="reference.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::glossary/glossaryinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="glossary.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::index/indexinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="index.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::bibliography/bibliographyinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="bibliography.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::refentry/refentryinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="refentry.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:when test="self::simplesect/simplesectinfo"> + <xsl:comment> Start of chunk: [title-page] </xsl:comment> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="simplesect.titlepage"/> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.titlep.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + </xsl:when> + <xsl:otherwise> + <xsl:message>Could not construct a titlepage for <xsl:value-of + select="local-name(.)"/>.</xsl:message> + </xsl:otherwise> + </xsl:choose> </xsl:template> -<xsl:template match="/book"> -<xsl:call-template name="yelp.generic.root"> -<xsl:with-param name="container" select="."/> -<xsl:with-param name="type" select="'book'"/> -</xsl:call-template> +<xsl:template name="yelp.component.chunk"> + <xsl:param name="depth" select="0"/> + + <xsl:if test="($depth != 0) or ($gdb_max_chunk_depth = 0)"> + <xsl:comment> Start of chunk: [<xsl:value-of select="@id"/>] </xsl:comment> + <xsl:call-template name="yelp.navbar"> + <xsl:with-param name="node" select="."/> + <xsl:with-param name="link-toc" select="false()"/> + </xsl:call-template> + <xsl:element name="hr"/> + <div class="{local-name(.)}"> + <xsl:call-template name="yelp.title"/> + <xsl:apply-templates select="yelp:get-content(.)"/> + <xsl:choose> + <xsl:when test="($depth < $gdb_max_chunk_depth) + and (count(yelp:get-divisions(.)) > 1)"> + <div class="toc"> + <p><b> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">TableofContents</xsl:with-param> + </xsl:call-template> + </b></p> + <xsl:apply-templates select="yelp:get-divisions(.)" mode="toc"/> + </div> + </xsl:when> + <xsl:when test="count(yelp:get-divisions(.)) > 1"> + <xsl:apply-templates select="yelp:get-divisions(.)"/> + </xsl:when> + </xsl:choose> + </div> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.navbar"> + <xsl:with-param name="node" select="."/> + <xsl:with-param name="link-toc" select="true()"/> + </xsl:call-template> + <xsl:comment> End of chunk </xsl:comment> + </xsl:if> + + <xsl:if test="($depth < $gdb_max_chunk_depth) + and (count(yelp:get-divisions(.)) > 1)"> + <xsl:for-each select="yelp:get-divisions(.)"> + <xsl:call-template name="yelp.component.chunk"> + <xsl:with-param name="depth" select="$depth + 1"/> + </xsl:call-template> + </xsl:for-each> + </xsl:if> </xsl:template> -<xsl:template name="yelp.generic.root"> -<xsl:param name="type"/> -<xsl:param name="container"/> -<xsl:param name="root" select="."/> - <xsl:choose> - <xsl:when test="$gdb_multichunk=1"> - <xsl:call-template name="yelp.multichunk"> - <xsl:with-param name="type" select="$type"/> - <xsl:with-param name="container" select="$container"/> - <xsl:with-param name="root" select="$root"/> - </xsl:call-template> - </xsl:when> - <xsl:when test="$gdb_rootid = ''"> - <xsl:call-template name="yelp.render.toc"> - <xsl:with-param name="title"> - <xsl:value-of select="$container/title"/> - </xsl:with-param> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="yelp.render.chunk"> - <xsl:with-param name="container" select="$container"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> +<xsl:template match="/*"> + <xsl:call-template name="yelp.root"/> </xsl:template> -<xsl:template name="yelp.render.chunk"> -<xsl:param name="container" select="."/> - <xsl:choose> - <xsl:when test="$gdb_rootid='title-page'"> - <xsl:call-template name="article.render.titlepage"> - <xsl:with-param name="container" select="$container"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="article.render.chunk"> - <xsl:with-param name="node" select="descendant::*[attribute::id=$gdb_rootid]" /> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> +<xsl:template name="yelp.root"> + <xsl:comment> End of header </xsl:comment> + + <xsl:call-template name="yelp.titlepage.chunk"/> + + <xsl:comment> Start of chunk: [toc] </xsl:comment> + <xsl:call-template name="yelp.toc.navbar"/> + <xsl:element name="hr"/> + <xsl:call-template name="yelp.title"/> + <p class="about"><a> + <xsl:attribute name="href"> + <xsl:call-template name="yelp.titlepage.ref"/> + </xsl:attribute> + <xsl:call-template name="gentext.template"> + <xsl:with-param name="context" select="'title'"/> + <xsl:with-param name="name" select="'bookinfo'"/> + </xsl:call-template> + </a></p> + <xsl:apply-templates select="yelp:get-content(.)"/> + <div class="toc"> + <p><b> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">TableofContents</xsl:with-param> + </xsl:call-template> + </b></p> + <xsl:choose> + <!-- Hackery for the User's Guide, which I don't like --> + <xsl:when test="(local-name(.) = 'part') and (count(chapter) = 1)"> + <xsl:for-each select="yelp:get-divisions(.)"> + <xsl:apply-templates select="yelp:get-divisions(.)" mode="toc"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="yelp:get-divisions(.)" mode="toc"/> + </xsl:otherwise> + </xsl:choose> + </div> + <xsl:element name="hr"> + <xsl:attribute name="class"> + <xsl:text>bottom</xsl:text> + </xsl:attribute> + </xsl:element> + <xsl:call-template name="yelp.toc.navbar"/> + <xsl:comment> End of chunk </xsl:comment> + + <xsl:choose> + <!-- Hackery for the User's Guide, which I don't like --> + <xsl:when test="(local-name(.) = 'part') and (count(chapter) = 1)"> + <xsl:for-each select="yelp:get-divisions(yelp:get-divisions(.))"> + <xsl:call-template name="yelp.component.chunk"> + <xsl:with-param name="depth" select="1"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="yelp.component.chunk"> + <xsl:with-param name="depth" select="0"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + + <xsl:comment> Start of footer </xsl:comment> </xsl:template> </xsl:stylesheet> diff --git a/stylesheets/yelp-functions.xsl b/stylesheets/yelp-functions.xsl new file mode 100644 index 00000000..55c1ddd5 --- /dev/null +++ b/stylesheets/yelp-functions.xsl @@ -0,0 +1,375 @@ +<?xml version='1.0'?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:func="http://exslt.org/functions" + xmlns:yelp="http://www.gnome.org/" + extension-element-prefixes="func yelp" + version='1.0'> + +<func:function name="yelp:get-depth"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="/part and (count(/part/chapter) = 1)"> + <func:result select="count($node/ancestor::*[yelp:is-division(.)]) - 1"/> + </xsl:when> + <xsl:otherwise> + <func:result select="count($node/ancestor::*[yelp:is-division(.)])"/> + </xsl:otherwise> + </xsl:choose> +</func:function> + +<func:function name="yelp:get-title-text"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="yelp:get-title($node)"> + <func:result select="yelp:get-title($node)/text()"/> + </xsl:when> + <xsl:when test="$node/self::abstract"> + <func:result> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Abstract</xsl:with-param> + </xsl:call-template> + </func:result> + </xsl:when> + <xsl:when test="$node/self::colophon"> + <func:result> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Colophon</xsl:with-param> + </xsl:call-template> + </func:result> + </xsl:when> + <xsl:when test="$node/self::dedication"> + <func:result> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Dedication</xsl:with-param> + </xsl:call-template> + </func:result> + </xsl:when> + <xsl:when test="$node/self::glossary"> + <func:result> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Glossary</xsl:with-param> + </xsl:call-template> + </func:result> + </xsl:when> + <xsl:when test="$node/self::index"> + <func:result> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Index</xsl:with-param> + </xsl:call-template> + </func:result> + </xsl:when> + <xsl:when test="$node/self::preface"> + <func:result> + <xsl:call-template name="gentext"> + <xsl:with-param name="key">Preface</xsl:with-param> + </xsl:call-template> + </func:result> + </xsl:when> + </xsl:choose> +</func:function> + +<func:function name="yelp:get-title"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="$node/title"> + <func:result select="$node/title"/> + </xsl:when> + <xsl:when test="$node/self::appendix/appendixinfo/title"> + <func:result select="$node/appendixinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::article/articleinfo/title"> + <func:result select="$node/articleinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::bibliography/bibliographyinfo/title"> + <func:result select="$node/bibliographyinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::book/bookinfo/title"> + <func:result select="$node/bookinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::chapter/chapterinfo/title"> + <func:result select="$node/chapterinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::glossary/glossaryinfo/title"> + <func:result select="$node/glossaryinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::index/indexinfo/title"> + <func:result select="$node/indexinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::part/partinfo/title"> + <func:result select="$node/partinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::preface/prefaceinfo/title"> + <func:result select="$node/prefaceinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::refentry/refentryinfo/title"> + <func:result select="$node/refentryinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::reference/referenceinfo/title"> + <func:result select="$node/referenceinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::sect1/sect1info/title"> + <func:result select="$node/sect1info/title"/> + </xsl:when> + <xsl:when test="$node/self::sect2/sect2info/title"> + <func:result select="$node/sect2info/title"/> + </xsl:when> + <xsl:when test="$node/self::sect3/sect3info/title"> + <func:result select="$node/sect3info/title"/> + </xsl:when> + <xsl:when test="$node/self::sect4/sect4info/title"> + <func:result select="$node/sect4info/title"/> + </xsl:when> + <xsl:when test="$node/self::sect5/sect5info/title"> + <func:result select="$node/sect5info/title"/> + </xsl:when> + <xsl:when test="$node/self::section/sectioninfo/title"> + <func:result select="$node/sectioninfo/title"/> + </xsl:when> + <xsl:when test="$node/self::set/setinfo/title"> + <func:result select="$node/setinfo/title"/> + </xsl:when> + <xsl:when test="$node/self::setindex/setindexinfo/title"> + <func:result select="$node/setindexinfo/title"/> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>yelp:get-title could not determine the title </xsl:text> + <xsl:text>of node with type "</xsl:text> + <xsl:value-of select="local-name($node)"/> + <xsl:text>"</xsl:text> + </xsl:message> + <func:result select="/foo"/> + </xsl:otherwise> + </xsl:choose> +</func:function> + +<func:function name="yelp:get-divisions"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="$node/self::appendix | $node/self::chapter + | $node/self::preface"> + <func:result select="$node/sect1 | $node/refentry | $node/simplesect + | $node/section | $node/index | $node/glossary | $node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::article"> + <func:result select="$node/sect1 | $node/refentry | $node/simplesect + | $node/section | $node/index | $node/glossary | $node/bibliography + | $node/appendix"/> + </xsl:when> + <xsl:when test="$node/self::sect1"> + <func:result select="$node/sect2 | $node/simplesect | $node/refentry + | $node/index | $node/glossary | $node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::sect2"> + <func:result select="$node/sect3 | $node/simplesect | $node/refentry + | $node/index | $node/glossary | $node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::sect3"> + <func:result select="$node/sect4 | $node/simplesect | $node/refentry + | $node/index | $node/glossary | $node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::sect4"> + <func:result select="$node/sect5 | $node/simplesect | $node/refentry + | $node/index | $node/glossary | $node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::sect5"> + <func:result select="$node/simplesect | $node/refentry + | $node/index | $node/glossary | $node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::section"> + <func:result select="$node/section | $node/simplesect | $node/refentry + | $node/index | $node/glossary | $node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::set"> + <func:result select="$node/book | $node/setindex"/> + </xsl:when> + <xsl:when test="$node/self::book"> + <func:result select="$node/glossary | $node/bibliography + | $node/preface | $node/chapter | $node/reference | $node/part + | $node/article | $node/appendix | $node/index | $node/setindex + | $node/colophon"/> + </xsl:when> + <xsl:when test="$node/self::part"> + <func:result select="$node/appendix | $node/chapter | $node/index + | $node/glossary | $node/bibliography | $node/article + | $node/preface | $node/refentry | $node/reference"/> + </xsl:when> + <xsl:when test="$node/self::reference"> + <func:result select="refentry"/> + </xsl:when> + <xsl:when test="$node/self::glossary"> + <func:result select="$node/bibliography"/> + </xsl:when> + <xsl:when test="$node/self::index | $node/self::setindex + | $node/self::bibliography | $node/self::colophon + | $node/self::refentry | $node/self::simplesect"> + <func:result select="/foo"/> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>yelp:get-divisions called on unknown </xsl:text> + <xsl:text>node with type "</xsl:text> + <xsl:value-of select="local-name($node)"/> + <xsl:text>"</xsl:text> + </xsl:message> + <func:result select="/foo"/> + </xsl:otherwise> + </xsl:choose> +</func:function> + +<func:function name="yelp:is-division"> + <xsl:param name="node" select="."/> + <func:result select=" + (local-name($node) = 'appendix') or (local-name($node) = 'chapter') or + (local-name($node) = 'preface') or (local-name($node) = 'article') or + (local-name($node) = 'sect1') or (local-name($node) = 'sect2') or + (local-name($node) = 'sect3') or (local-name($node) = 'sect4') or + (local-name($node) = 'sect5') or (local-name($node) = 'section') or + (local-name($node) = 'set') or (local-name($node) = 'book') or + (local-name($node) = 'part') or (local-name($node) = 'reference') or + (local-name($node) = 'glossary') or (local-name($node) = 'index') or + (local-name($node) = 'setindex') or (local-name($node) = 'bibliography') or + (local-name($node) = 'colophon') or (local-name($node) = 'refentry') or + (local-name($node) = 'simplesect')"/> +</func:function> + +<func:function name="yelp:get-content"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="$node/self::appendix | $node/self::article + | $node/self::chapter | $node/self::preface | $node/self::sect1 + | $node/self::sect2 | $node/self::sect3 | $node/self::sect4 + | $node/self::sect5 | $node/self::section | $node/self::simplesect"> + <func:result select="yelp:get-divcomponent.mix($node)"/> + </xsl:when> + <xsl:when test="$node/self::bibliography"> + <func:result select="yelp:get-component.mix($node) + | ($node/bibliodiv | $node/biblioentry | $node/bibliomixed)"/> + </xsl:when> + <xsl:when test="$node/self::glossary"> + <func:result select="yelp:get-component.mix($node) + | ($node/glossdiv | $node/glossentry)"/> + </xsl:when> + <xsl:when test="$node/self::index | $node/self::setindex"> + <func:result select="yelp:get-component.mix($node)"/> + </xsl:when> + <xsl:when test="$node/self::book"> + <func:result select="$node/dedication"/> + </xsl:when> + <xsl:when test="$node/self::colophon"> + <func:result select="yelp:get-textobject.mix($node)"/> + </xsl:when> + <xsl:when test="$node/self::part | $node/self::reference"> + <func:result select="$node/partintro"/> + </xsl:when> + <xsl:when test="$node/self::refentry"> + <func:result select="yelp:get-ndxterm.class($node) + | ($node/refsect1 | $node/refsection)"/> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>yelp:get-content called on unknown node </xsl:text> + <xsl:value-of select="local-name($node)"/> + </xsl:message> + <func:result select="/foo"/> + </xsl:otherwise> + </xsl:choose> +</func:function> + +<!-- ======================================================================= --> +<func:function name="yelp:get-textobject.mix"> + <xsl:param name="node" select="."/> + <func:result select=" + yelp:get-list.class($node) | yelp:get-admon.class($node) | + yelp:get-linespecific.class($node) | yelp:get-para.class($node) | + ($node/blockquote)"/> +</func:function> +<func:function name="yelp:get-component.mix"> + <xsl:param name="node" select="."/> + <func:result select=" + yelp:get-list.class($node) | yelp:get-admon.class($node) | + yelp:get-linespecific.class($node) | yelp:get-synop.class($node) | + yelp:get-para.class($node) | yelp:get-informal.class($node) | + yelp:get-formal.class($node) | yelp:get-compound.class($node) | + yelp:get-genobj.class($node) | yelp:get-descobj.class($node) | + yelp:get-ndxterm.class($node)"/> +</func:function> +<func:function name="yelp:get-divcomponent.mix"> + <xsl:param name="node" select="."/> + <func:result select=" + yelp:get-list.class($node) | yelp:get-admon.class($node) | + yelp:get-linespecific.class($node) | yelp:get-synop.class($node) | + yelp:get-para.class($node) | yelp:get-informal.class($node) | + yelp:get-formal.class($node) | yelp:get-compound.class($node) | + yelp:get-genobj.class($node) | yelp:get-descobj.class($node) | + yelp:get-ndxterm.class($node)"/> +</func:function> +<func:function name="yelp:get-refcomponent.mix"> + <xsl:param name="node" select="."/> + <func:result select=" + yelp:get-list.class($node) | yelp:get-admon.class($node) | + yelp:get-linespecific.class($node) | yelp:get-synop.class($node) | + yelp:get-para.class($node) | yelp:get-informal.class($node) | + yelp:get-formal.class($node) | yelp:get-compound.class($node) | + yelp:get-genobj.class($node) | yelp:get-descobj.class($node) | + yelp:get-ndxterm.class($node)"/> +</func:function> + +<!-- ======================================================================= --> +<func:function name="yelp:get-list.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/calloutlist | $node/glosslist + | $node/itemizedlist | $node/orderedlist | $node/segmentedlist + | $node/simplelist | $node/variablelist"/> +</func:function> +<func:function name="yelp:get-admon.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/caution/important/note/tip.warning"/> +</func:function> +<func:function name="yelp:get-linespecific.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/literallayout | $node/programlisting + | $node/programlistingco | $node/screen | $node/screenco + | $node/screenshot"/> +</func:function> +<func:function name="yelp:get-synop.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/construcotsynopsis | $node/destructorsynopsis + | $node/synopsis | $node/cmdsynopsis | $node/funcsynopsis + | $node/classsynopsis | $node/fieldsynopsis"/> +</func:function> +<func:function name="yelp:get-para.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/formalpara | $node/para | $node/simpara"/> +</func:function> +<func:function name="yelp:get-informal.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/address | $node/graphic | $node/graphicco + | $node/medaiobject | $node/mediaobjectco | $node/informalequation + | $node/informalexample | $node/informalfigure | $node/informaltable"/> +</func:function> +<func:function name="yelp:get-formal.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/equation | $node/example | $node/figure + | $node/table"/> +</func:function> +<func:function name="yelp:get-compound.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/msgset | $node/procedure | $node/sidebar + | $node/qandaset"/> +</func:function> +<func:function name="yelp:get-genobj.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/anchor | $node/bridgehead | $node/remark + | $node/highlights"/> +</func:function> +<func:function name="yelp:get-descobj.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/abstract | $node/authorblurb | $node/epigraph"/> +</func:function> +<func:function name="yelp:get-ndxterm.class"> + <xsl:param name="node" select="."/> + <func:result select="$node/indexterm"/> +</func:function> + +</xsl:stylesheet>
\ No newline at end of file |