<?xml version="1.0" encoding="ASCII"?> <!--This file was created automatically by html2xhtml--> <!--from the HTML stylesheets.--> <xsl:stylesheet exclude-result-prefixes="d" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> <!-- ******************************************************************** $Id: sections.xsl 9392 2012-06-02 20:10:58Z bobstayton $ ******************************************************************** This file is part of the XSL DocBook Stylesheet distribution. See ../README or http://docbook.sf.net/release/xsl/current/ for copyright and other information. ******************************************************************** --> <!-- ==================================================================== --> <xsl:template match="d:section"> <xsl:variable name="depth" select="count(ancestor::d:section)+1"/> <xsl:call-template name="id.warning"/> <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="common.html.attributes"> <xsl:with-param name="inherit" select="1"/> </xsl:call-template> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:call-template name="section.titlepage"/> <xsl:variable name="toc.params"> <xsl:call-template name="find.path.params"> <xsl:with-param name="table" select="normalize-space($generate.toc)"/> </xsl:call-template> </xsl:variable> <xsl:if test="contains($toc.params, 'toc') and $depth <= $generate.section.toc.level"> <xsl:call-template name="section.toc"> <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> </xsl:call-template> <xsl:call-template name="section.toc.separator"/> </xsl:if> <xsl:apply-templates/> <xsl:call-template name="process.chunk.footnotes"/> </xsl:element> </xsl:template> <xsl:template name="section.title"> <!-- the context node should be the title of a section when called --> <xsl:variable name="section" select="(ancestor::d:section |ancestor::d:simplesect |ancestor::d:sect1 |ancestor::d:sect2 |ancestor::d:sect3 |ancestor::d:sect4 |ancestor::d:sect5)[last()]"/> <xsl:variable name="renderas"> <xsl:choose> <xsl:when test="$section/@renderas = 'sect1'">1</xsl:when> <xsl:when test="$section/@renderas = 'sect2'">2</xsl:when> <xsl:when test="$section/@renderas = 'sect3'">3</xsl:when> <xsl:when test="$section/@renderas = 'sect4'">4</xsl:when> <xsl:when test="$section/@renderas = 'sect5'">5</xsl:when> <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="level"> <xsl:choose> <xsl:when test="$renderas != ''"> <xsl:value-of select="$renderas"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="section.level"> <xsl:with-param name="node" select="$section"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:call-template name="section.heading"> <xsl:with-param name="section" select="$section"/> <xsl:with-param name="level" select="$level"/> <xsl:with-param name="title"> <xsl:apply-templates select="$section" mode="object.title.markup"> <xsl:with-param name="allow-anchors" select="1"/> </xsl:apply-templates> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template match="d:section/d:title |d:section/d:info/d:title |d:sectioninfo/d:title" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.title"/> </xsl:template> <xsl:template match="d:sect1"> <xsl:call-template name="id.warning"/> <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="common.html.attributes"> <xsl:with-param name="inherit" select="1"/> </xsl:call-template> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:choose> <xsl:when test="@renderas = 'sect2'"> <xsl:call-template name="sect2.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect3'"> <xsl:call-template name="sect3.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect4'"> <xsl:call-template name="sect4.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect5'"> <xsl:call-template name="sect5.titlepage"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="sect1.titlepage"/> </xsl:otherwise> </xsl:choose> <xsl:variable name="toc.params"> <xsl:call-template name="find.path.params"> <xsl:with-param name="table" select="normalize-space($generate.toc)"/> </xsl:call-template> </xsl:variable> <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 1"> <xsl:call-template name="section.toc"> <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> </xsl:call-template> <xsl:call-template name="section.toc.separator"/> </xsl:if> <xsl:apply-templates/> <xsl:call-template name="process.chunk.footnotes"/> </xsl:element> </xsl:template> <xsl:template match="d:sect1/d:title |d:sect1/d:info/d:title |d:sect1info/d:title" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.title"/> </xsl:template> <xsl:template match="d:sect2"> <xsl:call-template name="id.warning"/> <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="common.html.attributes"> <xsl:with-param name="inherit" select="1"/> </xsl:call-template> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:choose> <xsl:when test="@renderas = 'sect1'"> <xsl:call-template name="sect1.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect3'"> <xsl:call-template name="sect3.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect4'"> <xsl:call-template name="sect4.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect5'"> <xsl:call-template name="sect5.titlepage"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="sect2.titlepage"/> </xsl:otherwise> </xsl:choose> <xsl:variable name="toc.params"> <xsl:call-template name="find.path.params"> <xsl:with-param name="table" select="normalize-space($generate.toc)"/> </xsl:call-template> </xsl:variable> <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 2"> <xsl:call-template name="section.toc"> <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> </xsl:call-template> <xsl:call-template name="section.toc.separator"/> </xsl:if> <xsl:apply-templates/> <xsl:call-template name="process.chunk.footnotes"/> </xsl:element> </xsl:template> <xsl:template match="d:sect2/d:title |d:sect2/d:info/d:title |d:sect2info/d:title" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.title"/> </xsl:template> <xsl:template match="d:sect3"> <xsl:call-template name="id.warning"/> <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="common.html.attributes"> <xsl:with-param name="inherit" select="1"/> </xsl:call-template> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:choose> <xsl:when test="@renderas = 'sect1'"> <xsl:call-template name="sect1.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect2'"> <xsl:call-template name="sect2.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect4'"> <xsl:call-template name="sect4.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect5'"> <xsl:call-template name="sect5.titlepage"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="sect3.titlepage"/> </xsl:otherwise> </xsl:choose> <xsl:variable name="toc.params"> <xsl:call-template name="find.path.params"> <xsl:with-param name="table" select="normalize-space($generate.toc)"/> </xsl:call-template> </xsl:variable> <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 3"> <xsl:call-template name="section.toc"> <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> </xsl:call-template> <xsl:call-template name="section.toc.separator"/> </xsl:if> <xsl:apply-templates/> <xsl:call-template name="process.chunk.footnotes"/> </xsl:element> </xsl:template> <xsl:template match="d:sect3/d:title |d:sect3/d:info/d:title |d:sect3info/d:title" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.title"/> </xsl:template> <xsl:template match="d:sect4"> <xsl:call-template name="id.warning"/> <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="common.html.attributes"> <xsl:with-param name="inherit" select="1"/> </xsl:call-template> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:choose> <xsl:when test="@renderas = 'sect1'"> <xsl:call-template name="sect1.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect2'"> <xsl:call-template name="sect2.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect3'"> <xsl:call-template name="sect3.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect5'"> <xsl:call-template name="sect5.titlepage"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="sect4.titlepage"/> </xsl:otherwise> </xsl:choose> <xsl:variable name="toc.params"> <xsl:call-template name="find.path.params"> <xsl:with-param name="table" select="normalize-space($generate.toc)"/> </xsl:call-template> </xsl:variable> <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 4"> <xsl:call-template name="section.toc"> <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> </xsl:call-template> <xsl:call-template name="section.toc.separator"/> </xsl:if> <xsl:apply-templates/> <xsl:call-template name="process.chunk.footnotes"/> </xsl:element> </xsl:template> <xsl:template match="d:sect4/d:title |d:sect4/d:info/d:title |d:sect4info/d:title" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.title"/> </xsl:template> <xsl:template match="d:sect5"> <xsl:call-template name="id.warning"/> <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="common.html.attributes"> <xsl:with-param name="inherit" select="1"/> </xsl:call-template> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:choose> <xsl:when test="@renderas = 'sect1'"> <xsl:call-template name="sect1.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect2'"> <xsl:call-template name="sect2.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect3'"> <xsl:call-template name="sect3.titlepage"/> </xsl:when> <xsl:when test="@renderas = 'sect4'"> <xsl:call-template name="sect4.titlepage"/> </xsl:when> <xsl:otherwise> <xsl:call-template name="sect5.titlepage"/> </xsl:otherwise> </xsl:choose> <xsl:variable name="toc.params"> <xsl:call-template name="find.path.params"> <xsl:with-param name="table" select="normalize-space($generate.toc)"/> </xsl:call-template> </xsl:variable> <xsl:if test="contains($toc.params, 'toc') and $generate.section.toc.level >= 5"> <xsl:call-template name="section.toc"> <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> </xsl:call-template> <xsl:call-template name="section.toc.separator"/> </xsl:if> <xsl:apply-templates/> <xsl:call-template name="process.chunk.footnotes"/> </xsl:element> </xsl:template> <xsl:template match="d:sect5/d:title |d:sect5/d:info/d:title |d:sect5info/d:title" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.title"/> </xsl:template> <xsl:template match="d:simplesect"> <xsl:call-template name="id.warning"/> <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="common.html.attributes"> <xsl:with-param name="inherit" select="1"/> </xsl:call-template> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:call-template name="simplesect.titlepage"/> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="d:simplesect/d:title|d:simplesect/d:info/d:title" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.title"/> </xsl:template> <xsl:template match="d:section/d:title"/> <xsl:template match="d:section/d:titleabbrev"/> <xsl:template match="d:section/d:subtitle"/> <xsl:template match="d:sectioninfo"/> <xsl:template match="d:section/d:info"/> <xsl:template match="d:sect1/d:title"/> <xsl:template match="d:sect1/d:titleabbrev"/> <xsl:template match="d:sect1/d:subtitle"/> <xsl:template match="d:sect1info"/> <xsl:template match="d:sect1/d:info"/> <xsl:template match="d:sect2/d:title"/> <xsl:template match="d:sect2/d:subtitle"/> <xsl:template match="d:sect2/d:titleabbrev"/> <xsl:template match="d:sect2info"/> <xsl:template match="d:sect2/d:info"/> <xsl:template match="d:sect3/d:title"/> <xsl:template match="d:sect3/d:subtitle"/> <xsl:template match="d:sect3/d:titleabbrev"/> <xsl:template match="d:sect3info"/> <xsl:template match="d:sect3/d:info"/> <xsl:template match="d:sect4/d:title"/> <xsl:template match="d:sect4/d:subtitle"/> <xsl:template match="d:sect4/d:titleabbrev"/> <xsl:template match="d:sect4info"/> <xsl:template match="d:sect4/d:info"/> <xsl:template match="d:sect5/d:title"/> <xsl:template match="d:sect5/d:subtitle"/> <xsl:template match="d:sect5/d:titleabbrev"/> <xsl:template match="d:sect5info"/> <xsl:template match="d:sect5/d:info"/> <xsl:template match="d:simplesect/d:title"/> <xsl:template match="d:simplesect/d:subtitle"/> <xsl:template match="d:simplesect/d:titleabbrev"/> <xsl:template match="d:simplesect/d:info"/> <!-- ==================================================================== --> <xsl:template name="section.heading"> <xsl:param name="section" select="."/> <xsl:param name="level" select="1"/> <xsl:param name="allow-anchors" select="1"/> <xsl:param name="title"/> <xsl:param name="class" select="'title'"/> <xsl:variable name="id"> <xsl:choose> <!-- Make sure the subtitle doesn't get the same id as the title --> <xsl:when test="self::d:subtitle"> <xsl:call-template name="object.id"> <xsl:with-param name="object" select="."/> </xsl:call-template> </xsl:when> <!-- if title is in an *info wrapper, get the grandparent --> <xsl:when test="contains(local-name(..), 'info')"> <xsl:call-template name="object.id"> <xsl:with-param name="object" select="../.."/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="object.id"> <xsl:with-param name="object" select=".."/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- HTML H level is one higher than section level --> <xsl:variable name="hlevel"> <xsl:choose> <!-- highest valid HTML H level is H6; so anything nested deeper than 5 levels down just becomes H6 --> <xsl:when test="$level > 5">6</xsl:when> <xsl:otherwise> <xsl:value-of select="$level + 1"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml"> <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> <xsl:if test="$css.decoration != '0'"> <xsl:if test="$hlevel<3"> <xsl:attribute name="style">clear: both</xsl:attribute> </xsl:if> </xsl:if> <xsl:if test="$allow-anchors != 0"> <xsl:call-template name="anchor"> <xsl:with-param name="node" select="$section"/> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> </xsl:if> <xsl:copy-of select="$title"/> </xsl:element> </xsl:template> <!-- ==================================================================== --> <xsl:template match="d:bridgehead"> <xsl:variable name="container" select="(ancestor::d:appendix |ancestor::d:article |ancestor::d:bibliography |ancestor::d:chapter |ancestor::d:glossary |ancestor::d:glossdiv |ancestor::d:index |ancestor::d:partintro |ancestor::d:preface |ancestor::d:refsect1 |ancestor::d:refsect2 |ancestor::d:refsect3 |ancestor::d:sect1 |ancestor::d:sect2 |ancestor::d:sect3 |ancestor::d:sect4 |ancestor::d:sect5 |ancestor::d:section |ancestor::d:setindex |ancestor::d:simplesect)[last()]"/> <xsl:variable name="clevel"> <xsl:choose> <xsl:when test="local-name($container) = 'appendix' or local-name($container) = 'chapter' or local-name($container) = 'article' or local-name($container) = 'bibliography' or local-name($container) = 'glossary' or local-name($container) = 'index' or local-name($container) = 'partintro' or local-name($container) = 'preface' or local-name($container) = 'setindex'">1</xsl:when> <xsl:when test="local-name($container) = 'glossdiv'"> <xsl:value-of select="count(ancestor::d:glossdiv)+1"/> </xsl:when> <xsl:when test="local-name($container) = 'sect1' or local-name($container) = 'sect2' or local-name($container) = 'sect3' or local-name($container) = 'sect4' or local-name($container) = 'sect5' or local-name($container) = 'refsect1' or local-name($container) = 'refsect2' or local-name($container) = 'refsect3' or local-name($container) = 'section' or local-name($container) = 'simplesect'"> <xsl:variable name="slevel"> <xsl:call-template name="section.level"> <xsl:with-param name="node" select="$container"/> </xsl:call-template> </xsl:variable> <xsl:value-of select="$slevel + 1"/> </xsl:when> <xsl:otherwise>1</xsl:otherwise> </xsl:choose> </xsl:variable> <!-- HTML H level is one higher than section level --> <xsl:variable name="hlevel"> <xsl:choose> <xsl:when test="@renderas = 'sect1'">2</xsl:when> <xsl:when test="@renderas = 'sect2'">3</xsl:when> <xsl:when test="@renderas = 'sect3'">4</xsl:when> <xsl:when test="@renderas = 'sect4'">5</xsl:when> <xsl:when test="@renderas = 'sect5'">6</xsl:when> <xsl:otherwise> <xsl:value-of select="$clevel + 1"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml"> <xsl:call-template name="id.attribute"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:call-template name="anchor"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="d:section/d:subtitle" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.subtitle"/> </xsl:template> <xsl:template match="d:simplesect/d:subtitle" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.subtitle"/> </xsl:template> <xsl:template match="d:sect1/d:subtitle" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.subtitle"/> </xsl:template> <xsl:template match="d:sect2/d:subtitle" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.subtitle"/> </xsl:template> <xsl:template match="d:sect3/d:subtitle" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.subtitle"/> </xsl:template> <xsl:template match="d:sect4/d:subtitle" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.subtitle"/> </xsl:template> <xsl:template match="d:sect5/d:subtitle" mode="titlepage.mode" priority="2"> <xsl:call-template name="section.subtitle"/> </xsl:template> <xsl:template name="section.subtitle"> <!-- the context node should be the subtitle of a section when called --> <xsl:variable name="section" select="(ancestor::d:section |ancestor::d:simplesect |ancestor::d:sect1 |ancestor::d:sect2 |ancestor::d:sect3 |ancestor::d:sect4 |ancestor::d:sect5)[last()]"/> <xsl:variable name="level"> <xsl:call-template name="section.level"> <xsl:with-param name="node" select="$section"/> </xsl:call-template> </xsl:variable> <xsl:call-template name="section.heading"> <xsl:with-param name="section" select=".."/> <xsl:with-param name="allow-anchors" select="0"/> <!-- subtitle heading level one higher than section level --> <xsl:with-param name="level" select="$level + 1"/> <xsl:with-param name="class" select="'subtitle'"/> <xsl:with-param name="title"> <xsl:apply-templates select="$section" mode="object.subtitle.markup"> <xsl:with-param name="allow-anchors" select="0"/> </xsl:apply-templates> </xsl:with-param> </xsl:call-template> </xsl:template> </xsl:stylesheet>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13895 | Paul Allen | Copying using p4convert-docbook | ||
//guest/perforce_software/doc_build/main/docbook-xsl-ns-1.78.1/xhtml-1_1/sections.xsl | |||||
#1 | 12728 | eedwards |
Upgrade ANT doc build infrastructure to assemble PDFs: - remove non-namespaced DocBook source and add namespaced DocBook source. - add Apache FOP 1.1 - copy fonts, images, XSL into _build, establishing new asset structure. The original structure remains until all guides using it can be upgraded, and several other issues can be resolved. - updated build.xml to allow for per-target build properties. - upgraded the P4SAG to use the new infrastructure. - tweaked admonition presentation in PDFs to remove admonition graphics, and resemble closely the presentation used in the new HTML layout, including the same colors. With these changes, building PDFs involves using a shell, navigating into the guide's directory (just P4SAG for now), and executing "ant pdf". Issues still to be resolved: - PDF generation encounters several warnings about missing fonts (bold versions of Symbol and ZapfDingbats), and a couple of locations where the page content exceeds the defined content area. - Due to issues within Apache FOP, PDF generation emits a substantial amount of output that is not easily suppressed without losing important warning information. - Apache FOP's interface to ANT does not expose a way to set the font base directory. The current configuration does work under Mac OSX, but further testing on Windows will need to be done to determine if the relative paths defined continue to work. The workaround is for Windows users to customize the fop-config.xml to provide absolute system paths to the required fonts. - HTML generation needs further browser testing, and exhibits broken navigation on iOS browsers within the TOC sidebar. - A number of PDF and HTML presentation tweaks still need to be made, for example: sidebars, gui* DocBook tags, whitespace, section separation, etc. |