diff options
author | Shaun McCance <shaunm@src.gnome.org> | 2003-10-23 05:36:01 +0000 |
---|---|---|
committer | Shaun McCance <shaunm@src.gnome.org> | 2003-10-23 05:36:01 +0000 |
commit | eb20843f7f61e9b166f91345d96c40aec0693949 (patch) | |
tree | a1a8ab9ebbe7068952d598f5a8e92c070ca16c56 | |
parent | 794502d7681d67144117c2a15febf69163254966 (diff) | |
download | yelp-eb20843f7f61e9b166f91345d96c40aec0693949.tar.gz |
- call-template instead of apply-templates for header
* stylesheets/db2html-header.xsl:
- call-template instead of apply-templates for header
* stylesheets/db2html-navbar.xsl:
- New navbar handlers, as necessitated by new chunk handlers
* stylesheets/db2html-html.xsl:
* stylesheets/yelp-customization.xsl:
- Using new navbar handlers
* stylesheets/db2html-xref.xsl:
- A few additional rules for xref.content
-rw-r--r-- | stylesheets/ChangeLog | 17 | ||||
-rw-r--r-- | stylesheets/db2html-header.xsl | 6 | ||||
-rw-r--r-- | stylesheets/db2html-html.xsl | 10 | ||||
-rw-r--r-- | stylesheets/db2html-navbar.xsl | 200 | ||||
-rw-r--r-- | stylesheets/db2html-xref.xsl | 25 | ||||
-rw-r--r-- | stylesheets/yelp-customization.xsl | 14 |
6 files changed, 186 insertions, 86 deletions
diff --git a/stylesheets/ChangeLog b/stylesheets/ChangeLog index 9f5b2e87..08d2dea9 100644 --- a/stylesheets/ChangeLog +++ b/stylesheets/ChangeLog @@ -1,4 +1,19 @@ -2003-10-12 Shaun McCance <shaunm@gnome.org> +2003-10-23 Shaun McCance <shaunm@gnome.org> + + * db2html-header.xsl: + - call-template instead of apply-templates for header + + * db2html-navbar.xsl: + - New navbar handlers, as necessitated by new chunk handlers + + * db2html-html.xsl: + * yelp-customization.xsl: + - Using new navbar handlers + + * db2html-xref.xsl: + - A few additional rules for xref.content + +2003-10-22 Shaun McCance <shaunm@gnome.org> * db2html-division.xsl: - Use $depth_chunk instead of $depth diff --git a/stylesheets/db2html-header.xsl b/stylesheets/db2html-header.xsl index 0cda16b3..6a92d889 100644 --- a/stylesheets/db2html-header.xsl +++ b/stylesheets/db2html-header.xsl @@ -55,7 +55,7 @@ <xsl:apply-templates mode="header.mode" select="$node"/> </xsl:template> -<!-- header --> +<!-- header.named --> <xsl:template name="header.named" mode="header.mode" match=" appendix | chapter | part | sect1 | sect2 | sect3 | sect4 | sect5 | section | simplesect"> @@ -91,7 +91,9 @@ </xsl:template> <xsl:template mode="header.mode" match="title | subtitle"> - <xsl:apply-templates mode="header.mode" select=".."/> + <xsl:call-template name="header"> + <xsl:with-param name="node" select=".."/> + </xsl:call-template> </xsl:template> <xsl:template mode="header.mode" match="appendixinfo"> diff --git a/stylesheets/db2html-html.xsl b/stylesheets/db2html-html.xsl index 80711400..3c259397 100644 --- a/stylesheets/db2html-html.xsl +++ b/stylesheets/db2html-html.xsl @@ -12,10 +12,16 @@ </xsl:param> <xsl:variable name="prevlink"> - <xsl:apply-templates select="$node" mode="navbar.prev.link.mode"/> + <xsl:call-template name="navbar.prev.link"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="depth_chunk" select="$depth_chunk"/> + </xsl:call-template> </xsl:variable> <xsl:variable name="nextlink"> - <xsl:apply-templates select="$node" mode="navbar.next.link.mode"/> + <xsl:call-template name="navbar.next.link"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="depth_chunk" select="$depth_chunk"/> + </xsl:call-template> </xsl:variable> <html> diff --git a/stylesheets/db2html-navbar.xsl b/stylesheets/db2html-navbar.xsl index ea273fb9..30184b04 100644 --- a/stylesheets/db2html-navbar.xsl +++ b/stylesheets/db2html-navbar.xsl @@ -1,4 +1,33 @@ <?xml version='1.0'?><!-- -*- Mode: fundamental; tab-width: 3 -*- --> +<!DOCTYPE xsl:stylesheet [ +<!ENTITY is-division "( + (name(.) = 'appendix') or (name(.) = 'article') or + (name(.) = 'book') or (name(.) = 'bibliography') or + (name(.) = 'chapter') or (name(.) = 'colophon') or + (name(.) = 'glossary') or (name(.) = 'index') or + (name(.) = 'part') or (name(.) = 'preface') or + (name(.) = 'reference') or (name(.) = 'refentry') or + (name(.) = 'refsect1') or (name(.) = 'refsect2') or + (name(.) = 'refsect3') or (name(.) = 'refsection') or + (name(.) = 'sect1') or (name(.) = 'sect2') or + (name(.) = 'sect3') or (name(.) = 'sect4') or + (name(.) = 'sect5') or (name(.) = 'section') or + (name(.) = 'set') or (name(.) = 'setindex') or + (name(.) = 'simplesect'))"> +<!ENTITY is-info "( + (name(.) = 'appendixinfo') or (name(.) = 'articleinfo') or + (name(.) = 'bibliographyinfo') or (name(.) = 'bookinfo') or + (name(.) = 'chapterinfo') or (name(.) = 'glossaryinfo') or + (name(.) = 'indexinfo') or (name(.) = 'partinfo') or + (name(.) = 'prefaceinfo') or (name(.) = 'refentryinfo') or + (name(.) = 'referenceinfo') or (name(.) = 'refsect1info') or + (name(.) = 'refsect2info') or (name(.) = 'refsect3info') or + (name(.) = 'refsectioninfo') or (name(.) = 'sect1info') or + (name(.) = 'sect2info') or (name(.) = 'sect3info') or + (name(.) = 'sect4info') or (name(.) = 'sect5info') or + (name(.) = 'sectioninfo') or (name(.) = 'setinfo') or + (name(.) = 'setindexinfo'))"> +]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> @@ -7,7 +36,27 @@ <xsl:template name="navbar.following.link"> <xsl:param name="node" select="."/> - <xsl:apply-templates mode="navbar.following.link.mode" select="$node"/> + <xsl:param name="depth_chunk"> + <xsl:call-template name="depth.chunk"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + </xsl:param> + <xsl:choose> + <xsl:when test=" + ($depth_chunk < $chunk_depth) and + $node/following-sibling::*[&is-division;] "> + <xsl:call-template name="xref"> + <xsl:with-param name="target" + select="$node/following-sibling::*[&is-division;][1]"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$node/.."> + <xsl:call-template name="navbar.following.link"> + <xsl:with-param name="node" select="$node/.."/> + <xsl:with-param name="depth_chunk" select="$depth_chunk - 1"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> </xsl:template> <xsl:template match="*" mode="navbar.following.link.mode"> @@ -33,109 +82,108 @@ --> </xsl:template> -<xsl:template match="*" mode="navbar.last.link.mode"> -<!-- - <xsl:variable name="depth" select="count(ancestor::*[&is-div;])"/> +<!-- == navbar.last.link =================================================== --> + +<xsl:template name="navbar.last.link"> + <xsl:param name="node" select="."/> + <xsl:param name="depth_chunk"> + <xsl:call-template name="depth.chunk"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + </xsl:param> <xsl:choose> - <xsl:when test="not(&is-div;)"> - <xsl:apply-templates mode="navbar.last.link.mode" - select="ancestor::*[&is-div;][1]"/> - </xsl:when> - <xsl:when test="$depth > $chunk_depth"> - <xsl:apply-templates select="." mode="navbar.prev.link.mode"/> - </xsl:when> - <xsl:when test="$depth = $chunk_depth"> - <xsl:call-template name="xref"> - <xsl:with-param name="linkend" select="@id"/> - <xsl:with-param name="target" select="."/> + <xsl:when test="($depth_chunk < $chunk_depth) and $node/*[&is-division;]"> + <xsl:call-template name="navbar.last.link"> + <xsl:with-param name="node" select="$node/*[&is-division;][last()]"/> + <xsl:with-param name="depth_chunk" select="$depth_chunk + 1"/> </xsl:call-template> </xsl:when> - <xsl:when test="*[&is-div;]"> - <xsl:apply-templates mode="navbar.last.link.mode" - select="*[&is-div;][last()]"/> - </xsl:when> <xsl:otherwise> <xsl:call-template name="xref"> - <xsl:with-param name="linkend" select="@id"/> - <xsl:with-param name="target" select="."/> + <xsl:with-param name="target" select="$node"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> ---> </xsl:template> -<xsl:template match="*" mode="navbar.prev.link.mode"> -<!-- - <xsl:variable name="depth" select="count(ancestor::*[&is-div;])"/> - <xsl:variable name="chunk_id"> - <xsl:apply-templates select="." mode="chunk.id.mode"/> - </xsl:variable> +<!-- == navbar.prev.link =================================================== --> + +<xsl:template name="navbar.prev.link"> + <xsl:param name="node" select="."/> + <xsl:param name="depth_chunk"> + <xsl:call-template name="depth.chunk"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + </xsl:param> <xsl:choose> - <xsl:when test="string($chunk_id) != @id"> - <xsl:apply-templates select="id($chunk_id)" mode="navbar.prev.link.mode"/> - </xsl:when> - <xsl:when test="&is-div-info;"/> - <xsl:when test="$depth > $chunk_depth"> - <xsl:apply-templates select=".." mode="navbar.prev.link.mode"/> + <xsl:when test="($node = /*)"> + <xsl:if test="$generate_titlepage and $node/*[&is-info;]"> + <xsl:call-template name="xref"> + <xsl:with-param name="target" select="$node/*[&is-info;]"/> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:when test="$node/preceding-sibling::*[&is-division;]"> + <xsl:choose> + <xsl:when test="$depth_chunk < $chunk_depth"> + <xsl:call-template name="navbar.last.link"> + <xsl:with-param name="node" + select="$node/preceding-sibling::*[&is-division;][1]"/> + <xsl:with-param name="depth_chunk" select="$depth_chunk"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="xref"> + <xsl:with-param name="target" + select="$node/preceding-sibling::*[&is-division;][1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> </xsl:when> - <xsl:when test=" - ($depth = $chunk_depth) and (preceding-sibling::*[&is-div;])"> - <xsl:variable name="prev" select="preceding-sibling::*[&is-div;][1]"/> - <xsl:call-template name="xref"> - <xsl:with-param name="linkend" select="$prev/@id"/> - <xsl:with-param name="target" select="$prev"/> - </xsl:call-template> - </xsl:when> - <xsl:when test="preceding-sibling::*[&is-div;]"> - <xsl:apply-templates mode="navbar.last.link.mode" - select="preceding-sibling::*[&is-div;][1]"/> - </xsl:when> - <xsl:when test="parent::*[&is-div;]"> - <xsl:call-template name="xref"> - <xsl:with-param name="linkend" select="../@id"/> - <xsl:with-param name="target" select=".."/> - </xsl:call-template> - </xsl:when> - <xsl:when test="$generate_titlepage and (. = /*) and *[&is-div-info;]"> - <xsl:variable name="prev" select="*[&is-div-info;][1]"/> + <xsl:otherwise> <xsl:call-template name="xref"> - <xsl:with-param name="linkend" select="$prev/@id"/> - <xsl:with-param name="target" select="$prev"/> + <xsl:with-param name="target" select="$node/.."/> </xsl:call-template> - </xsl:when> + </xsl:otherwise> </xsl:choose> ---> </xsl:template> -<xsl:template match="*" mode="navbar.next.link.mode"> -<!-- - <xsl:variable name="depth" select="count(ancestor::*[&is-div;])"/> +<!-- == navbar.next.link =================================================== --> + +<xsl:template name="navbar.next.link"> + <xsl:param name="node" select="."/> + <xsl:param name="depth_chunk"> + <xsl:call-template name="depth.chunk"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + </xsl:param> <xsl:choose> - <xsl:when test="&is-div-info;"> + <xsl:when test="$node/self::*[&is-info;]"> <xsl:call-template name="xref"> - <xsl:with-param name="linkend" select="../@id"/> - <xsl:with-param name="target" select=".."/> + <xsl:with-param name="target" select="$node/.."/> </xsl:call-template> </xsl:when> - <xsl:when test="not(&is-div;)"> - <xsl:apply-templates mode="navbar.next.link.mode" - select="ancestor::*[&is-div;][1]"/> - </xsl:when> - <xsl:when test="$depth > $chunk_depth"> - <xsl:apply-templates select="." mode="navbar.next.link.mode"/> + <xsl:when + test="$depth_chunk < $chunk_depth and $node/*[&is-division;]"> + <xsl:call-template name="xref"> + <xsl:with-param name="target" select="$node/*[&is-division;][1]"/> + </xsl:call-template> </xsl:when> - <xsl:when test="($depth < $chunk_depth) and (*[&is-div;])"> - <xsl:variable name="next" select="*[&is-div;][1]"/> + <xsl:when test="following-sibling::*[&is-division;]"> <xsl:call-template name="xref"> - <xsl:with-param name="linkend" select="$next/@id"/> - <xsl:with-param name="target" select="$next"/> + <xsl:with-param name="target" + select="following-sibling::*[&is-division;][1]"/> </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:apply-templates select="." mode="navbar.following.link.mode"/> + <xsl:call-template name="navbar.following.link"> + <xsl:with-param name="node" select="$node/.."/> + <xsl:with-param name="depth_chunk" select="$depth_chunk - 1"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> ---> </xsl:template> +<!-- ======================================================================= --> + </xsl:stylesheet> diff --git a/stylesheets/db2html-xref.xsl b/stylesheets/db2html-xref.xsl index cb82c796..aac54480 100644 --- a/stylesheets/db2html-xref.xsl +++ b/stylesheets/db2html-xref.xsl @@ -109,7 +109,30 @@ </xsl:choose> </xsl:template> -<xsl:template mode="header.mode" match="glossentry"> +<xsl:template mode="xref.content.mode" match="article | reference"> + <xsl:choose> + <xsl:when test=" + (preceding-sibling::*[name(.) = name(current())]) or + (following-sibling::*[name(.) = name(current())]) or + (parent::part/preceding-sibling::part/*[name(.) = name(current())]) or + (parent::part/following-sibling::part/*[name(.) = name(current())]) "> + <xsl:call-template name="header"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="gettext"> + <xsl:with-param name="key" select="'Table of Contents'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template mode="xref.content.mode" match="book"> + <xsl:call-template name="gettext"> + <xsl:with-param name="key" select="'Table of Contents'"/> + </xsl:call-template> +</xsl:template> + +<xsl:template mode="xref.content.mode" match="glossentry"> <xsl:apply-templates mode="xref.content.mode" select="glossterm[1]"/> </xsl:template> diff --git a/stylesheets/yelp-customization.xsl b/stylesheets/yelp-customization.xsl index 79786162..530d9a02 100644 --- a/stylesheets/yelp-customization.xsl +++ b/stylesheets/yelp-customization.xsl @@ -66,11 +66,11 @@ <xsl:otherwise><xsl:value-of select="$node/@id"/></xsl:otherwise> </xsl:choose> </xsl:param> - <xsl:variable name="depth_chunk"> + <xsl:param name="depth_chunk"> <xsl:call-template name="depth.chunk"> <xsl:with-param name="node" select="$node"/> </xsl:call-template> - </xsl:variable> + </xsl:param> <xsl:comment> Start of chunk: [<xsl:value-of select="$id"/>] </xsl:comment> <xsl:call-template name="html"> @@ -101,10 +101,16 @@ </xsl:param> <xsl:variable name="prevlink"> - <xsl:apply-templates select="$node" mode="navbar.prev.link.mode"/> + <xsl:call-template name="navbar.prev.link"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="depth_chunk" select="$depth_chunk"/> + </xsl:call-template> </xsl:variable> <xsl:variable name="nextlink"> - <xsl:apply-templates select="$node" mode="navbar.next.link.mode"/> + <xsl:call-template name="navbar.next.link"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="depth_chunk" select="$depth_chunk"/> + </xsl:call-template> </xsl:variable> <div> |