D-Bus API: generate docs using local copy of docbook XSL

Nightly builds with --enable-doc tended to fail occassionally due to
download errors of the current docbook XSL from SourceForge. Using
a local copy of those files avoids that problem, speeds up compilation
and gives us some control over potentially incompatible changes
in the upstream docbook XSL.
This commit is contained in:
Patrick Ohly 2012-07-03 11:26:41 +02:00
parent fafc158ebd
commit 3ac2b73ffb
60 changed files with 39064 additions and 2 deletions

48
build/xsl/COPYING Normal file
View File

@ -0,0 +1,48 @@
Copyright
---------
Copyright (C) 1999-2007 Norman Walsh
Copyright (C) 2003 Jiří Kosek
Copyright (C) 2004-2007 Steve Ball
Copyright (C) 2005-2008 The DocBook Project
Copyright (C) 2011-2012 O'Reilly Media
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the ``Software''), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Except as contained in this notice, the names of individuals
credited with contribution to this software shall not be used in
advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization
from the individuals in question.
Any stylesheet derived from this Software that is publically
distributed will be identified with a different name and the
version strings in any derived Software will be changed so that
no possibility of confusion between the derived package and this
Software will exist.
Warranty
--------
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER
CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Contacting the Author
---------------------
The DocBook XSL stylesheets are maintained by Norman Walsh,
<ndw@nwalsh.com>, and members of the DocBook Project,
<docbook-developers@sf.net>

173
build/xsl/README Normal file
View File

@ -0,0 +1,173 @@
----------------------------------------------------------------------
README file for the DocBook XSL Stylesheets
----------------------------------------------------------------------
$Id: README 9397 2012-06-02 22:35:07Z bobstayton $
These are XSL stylesheets for transforming DocBook XML document
instances into various output formats.
This README file provides only very minimal documentation on using
the stylesheets. For more complete information, see Bob Stayton's
book "DocBook XSL: The Complete Guide", available online at:
http://www.sagehill.net/docbookxsl/
----------------------------------------------------------------------
Installation
----------------------------------------------------------------------
See the INSTALL file for information about installing this release.
----------------------------------------------------------------------
How to use the stylesheets
----------------------------------------------------------------------
The base canonical URI for these stylesheets is:
http://docbook.sourceforge.net/release/xsl/current/
You call any of the stylesheets in this distribution by doing one
of the following:
- Use the base canonical URI in combination with one of the
pathnames below. For example, for "chunked" HTML, output:
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
If your system has a working XML Catalog or SGML Catalog setup
(most Linux systems do), then that URI will automatically be
resolved and replaced with a local pathname on your system.
- Use a "real" local system base path in combination with one of
the pathnames below. For example, for "chunked" HTML, output:
/usr/share/xml/docbook/stylesheet/nwalsh/html/chunk.xsl
To transform documents created with the standard DocBook
schema/DTD, use one of the following stylesheets:
fo/docbook.xsl - for XSL-FO
html/docbook.xsl - for HTML (as a single file)
html/chunk.xsl - for HTML (chunked into multiple files)
html/onechunk.xsl - for HTML (chunked output in single file)
xhtml/*.xsl - for XHTML versions of the above
xhtml-1_1/*.xsl - for XHTML 1.1 versions of the above
xhtml5/*.xsl - for XHTML5 versions of the above
epub/docbook.xsl - for .epub version 2 and earlier
epub3/docbook.xsl - for .epub version 3 and later
htmlhelp/htmlhelp.xsl - for HTML Help
javahelp/javahelp.xsl - for JavaHelp
eclipse/eclipse.xsl - for Eclipse Help
manpages/docbook.xsl - for groff/nroff man pages
*/profile-* - single-pass-profiling versions of all above
roundtrip/*.xsl - for DocBook to WordML, etc., to DocBook
assembly/assemble.xsl - converts an assembly into a DocBook document
assembly/topic-maker-chunk.xsl
- converts a DocBook document into an assembly
with topic files.
To transform documents created with the DocBook Slides schema/DTD,
use one of the following stylesheets:
slides/html/*.xsl - for HTML slides of various kinds
slides/xhtml/*.xsl - for XHTML slides of various kinds
slides/fo/plain.xsl - for XSL-FO slides
slides/htmlhelp/... - for HTML Help slides
To transform documents created with the DocBook Website
schema/DTD, use one of the following stylesheets:
website/website.xsl - for non-tabular, non-chunked output
website/tabular.xsl - for tabular, non-chunked output
website/chunk-* - for chunked output
To generate a titlepage customization layer from a titlepage spec:
template/titlepage.xsl
For fo titlepage customizations, set the stylesheet parameter named 'ns'
to 'http://www.w3.org/1999/XSL/Format' when using this stylesheet.
For xhtml titlepage customizations, set the stylesheet parameter named 'ns'
to 'http://www.w3.org/1999/xhtml' when using this stylesheet.
For details about creating titlepage spec files and generating and
using titlepage customization layers, see "DocBook XSL: The
Complete Guide" <http://www.sagehill.net/docbookxsl/>
----------------------------------------------------------------------
Manifest
----------------------------------------------------------------------
AUTHORS contact information
BUGS about known problems
COPYING copyright information
INSTALL installation instructions
README this file
RELEASE.* per-release cumulative summaries of user-visible changes
TODO about planned features not yet implemented
VERSION release metadata, including the current version
number (note that the VERSION file is an XSL stylesheet)
NEWS changes since the last public release (for a cumulative list of
changes, see the ChangeHistory.xml file)
assembly/ for making and processing DocBook assemblies.
common/ code used among several output formats (HTML, FO, manpages,...)
docsrc/ documentation sources
eclipse/ for producing Eclipse Help
epub/ for producing .epub version 2.
epub3/ for producing .epub version 3 and beyond.
extensions/ DocBook XSL Java extensions
fo/ for producing XSL-FO
highlighting files used for adding source-code syntax highlighting in output
html/ for producing HTML
htmlhelp/ for producing HTML Help
images/ images used in callouts and graphical admonitions
javahelp/ for producing Java Help
lib/ utility stylesheets with schema-independent functions
manpages/ for producing groff/troff man pages
profiling/ for profiling (omitting/including conditional text)
roundtrip/ for "round trip" conversion among DocBook and
various word-processor formats (WordML, etc.)
slides/ for producing slides output (from Slides source)
template/ templates for building stylesheet customization layers
tools/ assorted supplementary tools
website/ for producing website output (from Website source)
xhtml/ for producing XHTML
xhtml-1_1/ for producing (stricter) XHTML 1.1
xhtml5/ for producing XHTML5
----------------------------------------------------------------------
Changes
----------------------------------------------------------------------
See the NEWS file for changes made since the previous release.
See the RELEASE-NOTES.html or RELEASE-NOTES.txt or RELEASE-NOTES.pdf
files for per-release cumulative summaries of significant
user-visible changes.
For online access to a hyperlinked view of all changes made over
the entire history of the codebase, see the following:
http://docbook.svn.sourceforge.net/viewvc/docbook/trunk/xsl/?view=log
WARNING: That above change history is a very long list and may
take a long time to load/download.
You can also create an XML-formatted "ChangeHistory.xml" copy of
the complete change history for the codebase by running the
following commands:
svn checkout https://docbook.svn.sf.net/svnroot/docbook/trunk/xsl
svn log --xml --verbose xsl > ChangeHistory.xml
----------------------------------------------------------------------
Copyright information
----------------------------------------------------------------------
See the accompanying file named COPYING.

115
build/xsl/VERSION.xsl Normal file
View File

@ -0,0 +1,115 @@
<?xml version='1.0'?> <!-- -*- nxml -*- vim: set foldlevel=2: -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fm="http://freshmeat.net/projects/freshmeat-submit/"
xmlns:sf="http://sourceforge.net/"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:saxon="http://icl.com/saxon"
exclude-result-prefixes="fm sf"
version='1.0'>
<xsl:param name="get"/>
<xsl:param name="VERSION" select="string(document('')//fm:Version[1])"/>
<xsl:param name="Tag" select="concat('V',translate(string(document('')//fm:Version[1]),'.',''))"/>
<xsl:param name="DistroTitle" select="string(document('')//fm:Branch[1])"/>
<xsl:param name="sf-relid" select="0"/>
<xsl:param name="DistroName">docbook-xsl</xsl:param>
<xsl:param name="PreviousRelease">1.77.0</xsl:param>
<xsl:param name="PreviousReleaseRevision">9371</xsl:param>
<xsl:param name="Revision">$Revision: 9399 $</xsl:param>
<xsl:param name="VersionFileURL">$URL: https://docbook.svn.sourceforge.net/svnroot/docbook/trunk/xsl/VERSION $</xsl:param>
<xsl:strip-space elements="fm:*"/>
<fm:project>
<fm:Project>DocBook</fm:Project>
<fm:Branch>XSL Stylesheets</fm:Branch>
<!-- * set/keep fm:version as N.NN.N-pre except for official releases, -->
<!-- * then after the release, revert it to N.NN.N-pre & check back in -->
<fm:Version>1.77.1</fm:Version>
<!--
<fm:License>MIT/X Consortium License</fm:License>
-->
<fm:Release-Focus>
<!-- * Initial freshmeat announcement -->
<!-- * Documentation -->
<!-- * Code cleanup -->
<!-- * Minor feature enhancements -->
* Major feature enhancements
<!-- * Minor bugfixes -->
<!-- * Major bugfixes -->
<!-- * Minor security fixes -->
<!-- * Major security fixes -->
</fm:Release-Focus>
<fm:Home-Page-URL>http://sourceforge.net/projects/docbook/</fm:Home-Page-URL>
<fm:Gzipped-Tar-URL>http://prdownloads.sourceforge.net/docbook/{DISTRONAME-VERSION}.tar.gz?download</fm:Gzipped-Tar-URL>
<fm:Zipped-Tar-URL>http://prdownloads.sourceforge.net/docbook/{DISTRONAME-VERSION}.zip?download</fm:Zipped-Tar-URL>
<fm:Bzipped-Tar-URL>http://prdownloads.sourceforge.net/docbook/{DISTRONAME-VERSION}.bz2?download</fm:Bzipped-Tar-URL>
<fm:Changelog-URL>http://sourceforge.net/project/shownotes.php?release_id={SFRELID}</fm:Changelog-URL>
<fm:CVS-URL>http://docbook.svn.sourceforge.net/viewvc/docbook/</fm:CVS-URL>
<fm:Mailing-List-URL>http://lists.oasis-open.org/archives/docbook-apps/</fm:Mailing-List-URL>
<fm:Changes>This is a release with bugfixes and some enhancements.</fm:Changes>
</fm:project>
<xsl:template match="/" priority="-100">
<xsl:choose>
<xsl:when test="$get = 'Tag'">
<xsl:value-of select="$Tag"/>
</xsl:when>
<xsl:when test="$get = 'PreviousRelease'">
<xsl:value-of select="$PreviousRelease"/>
</xsl:when>
<xsl:when test="$get = 'PreviousReleaseRevision'">
<xsl:value-of select="$PreviousReleaseRevision"/>
</xsl:when>
<xsl:when test="$get = 'DistroTitle'">
<xsl:value-of select="$DistroTitle"/>
</xsl:when>
<xsl:when test="$get = 'VERSION'">
<xsl:value-of select="$VERSION"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$sf-relid = 0">
<xsl:message terminate="yes">
<xsl:text>You must specify the sf-relid as a parameter.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:apply-templates select="//fm:project"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="fm:project">
<xsl:apply-templates/>
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="fm:Changes" mode="text"/>
</xsl:template>
<xsl:template match="fm:Changes"/>
<xsl:template match="fm:Gzipped-Tar-URL|fm:Zipped-Tar-URL|fm:Bzipped-Tar-URL">
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="substring-before(., '{DISTRONAME-VERSION}')"/>
<xsl:value-of select="concat($DistroName, '-', $VERSION)"/>
<xsl:value-of select="substring-after(., '{DISTRONAME-VERSION}')"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="fm:Changelog-URL">
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="substring-before(., '{SFRELID}')"/>
<xsl:value-of select="$sf-relid"/>
<xsl:value-of select="substring-after(., '{SFRELID}')"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="fm:*">
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>

2110
build/xsl/common/common.xsl Normal file

File diff suppressed because it is too large Load Diff

1247
build/xsl/common/en.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
<!-- ********************************************************************
$Id: entities.ent 9286 2012-04-19 10:10:58Z bobstayton $
********************************************************************
This file contains common entity declarations used for
sorting (and other things) by various templates.
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.
******************************************************************** -->
<!-- ==================================================================== -->
<!ENTITY lowercase "'Aa&#192;&#224;&#193;&#225;&#194;&#226;&#195;&#227;&#196;&#228;&#197;&#229;&#256;&#257;&#258;&#259;&#260;&#261;&#461;&#462;&#478;&#479;&#480;&#481;&#506;&#507;&#512;&#513;&#514;&#515;&#550;&#551;&#7680;&#7681;&#7834;&#7840;&#7841;&#7842;&#7843;&#7844;&#7845;&#7846;&#7847;&#7848;&#7849;&#7850;&#7851;&#7852;&#7853;&#7854;&#7855;&#7856;&#7857;&#7858;&#7859;&#7860;&#7861;&#7862;&#7863;Bb&#384;&#385;&#595;&#386;&#387;&#7682;&#7683;&#7684;&#7685;&#7686;&#7687;Cc&#199;&#231;&#262;&#263;&#264;&#265;&#266;&#267;&#268;&#269;&#391;&#392;&#597;&#7688;&#7689;Dd&#270;&#271;&#272;&#273;&#394;&#599;&#395;&#396;&#453;&#498;&#545;&#598;&#7690;&#7691;&#7692;&#7693;&#7694;&#7695;&#7696;&#7697;&#7698;&#7699;Ee&#200;&#232;&#201;&#233;&#202;&#234;&#203;&#235;&#274;&#275;&#276;&#277;&#278;&#279;&#280;&#281;&#282;&#283;&#516;&#517;&#518;&#519;&#552;&#553;&#7700;&#7701;&#7702;&#7703;&#7704;&#7705;&#7706;&#7707;&#7708;&#7709;&#7864;&#7865;&#7866;&#7867;&#7868;&#7869;&#7870;&#7871;&#7872;&#7873;&#7874;&#7875;&#7876;&#7877;&#7878;&#7879;Ff&#401;&#402;&#7710;&#7711;Gg&#284;&#285;&#286;&#287;&#288;&#289;&#290;&#291;&#403;&#608;&#484;&#485;&#486;&#487;&#500;&#501;&#7712;&#7713;Hh&#292;&#293;&#294;&#295;&#542;&#543;&#614;&#7714;&#7715;&#7716;&#7717;&#7718;&#7719;&#7720;&#7721;&#7722;&#7723;&#7830;Ii&#204;&#236;&#205;&#237;&#206;&#238;&#207;&#239;&#296;&#297;&#298;&#299;&#300;&#301;&#302;&#303;&#304;&#407;&#616;&#463;&#464;&#520;&#521;&#522;&#523;&#7724;&#7725;&#7726;&#7727;&#7880;&#7881;&#7882;&#7883;Jj&#308;&#309;&#496;&#669;Kk&#310;&#311;&#408;&#409;&#488;&#489;&#7728;&#7729;&#7730;&#7731;&#7732;&#7733;Ll&#313;&#314;&#315;&#316;&#317;&#318;&#319;&#320;&#321;&#322;&#410;&#456;&#564;&#619;&#620;&#621;&#7734;&#7735;&#7736;&#7737;&#7738;&#7739;&#7740;&#7741;Mm&#625;&#7742;&#7743;&#7744;&#7745;&#7746;&#7747;Nn&#209;&#241;&#323;&#324;&#325;&#326;&#327;&#328;&#413;&#626;&#414;&#544;&#459;&#504;&#505;&#565;&#627;&#7748;&#7749;&#7750;&#7751;&#7752;&#7753;&#7754;&#7755;Oo&#210;&#242;&#211;&#243;&#212;&#244;&#213;&#245;&#214;&#246;&#216;&#248;&#332;&#333;&#334;&#335;&#336;&#337;&#415;&#416;&#417;&#465;&#466;&#490;&#491;&#492;&#493;&#510;&#511;&#524;&#525;&#526;&#527;&#554;&#555;&#556;&#557;&#558;&#559;&#560;&#561;&#7756;&#7757;&#7758;&#7759;&#7760;&#7761;&#7762;&#7763;&#7884;&#7885;&#7886;&#7887;&#7888;&#7889;&#7890;&#7891;&#7892;&#7893;&#7894;&#7895;&#7896;&#7897;&#7898;&#7899;&#7900;&#7901;&#7902;&#7903;&#7904;&#7905;&#7906;&#7907;Pp&#420;&#421;&#7764;&#7765;&#7766;&#7767;Qq&#672;Rr&#340;&#341;&#342;&#343;&#344;&#345;&#528;&#529;&#530;&#531;&#636;&#637;&#638;&#7768;&#7769;&#7770;&#7771;&#7772;&#7773;&#7774;&#7775;Ss&#346;&#347;&#348;&#349;&#350;&#351;&#352;&#353;&#536;&#537;&#642;&#7776;&#7777;&#7778;&#7779;&#7780;&#7781;&#7782;&#7783;&#7784;&#7785;Tt&#354;&#355;&#356;&#357;&#358;&#359;&#427;&#428;&#429;&#430;&#648;&#538;&#539;&#566;&#7786;&#7787;&#7788;&#7789;&#7790;&#7791;&#7792;&#7793;&#7831;Uu&#217;&#249;&#218;&#250;&#219;&#251;&#220;&#252;&#360;&#361;&#362;&#363;&#364;&#365;&#366;&#367;&#368;&#369;&#370;&#371;&#431;&#432;&#467;&#468;&#469;&#470;&#471;&#472;&#473;&#474;&#475;&#476;&#532;&#533;&#534;&#535;&#7794;&#7795;&#7796;&#7797;&#7798;&#7799;&#7800;&#7801;&#7802;&#7803;&#7908;&#7909;&#7910;&#7911;&#7912;&#7913;&#7914;&#7915;&#7916;&#7917;&#7918;&#7919;&#7920;&#7921;Vv&#434;&#651;&#7804;&#7805;&#7806;&#7807;Ww&#372;&#373;&#7808;&#7809;&#7810;&#7811;&#7812;&#7813;&#7814;&#7815;&#7816;&#7817;&#7832;Xx&#7818;&#7819;&#7820;&#7821;Yy&#221;&#253;&#255;&#376;&#374;&#375;&#435;&#436;&#562;&#563;&#7822;&#7823;&#7833;&#7922;&#7923;&#7924;&#7925;&#7926;&#7927;&#7928;&#7929;Zz&#377;&#378;&#379;&#380;&#381;&#382;&#437;&#438;&#548;&#549;&#656;&#657;&#7824;&#7825;&#7826;&#7827;&#7828;&#7829;&#7829;'">
<!ENTITY uppercase "'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPPPPPPPPQQQRRRRRRRRRRRRRRRRRRRRRRRSSSSSSSSSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTTTTTTTTUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVWWWWWWWWWWWWWWWXXXXXXYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZ'">
<!-- The following three entities are used for sorting and grouping
indexterms, not in presentation of them. -->
<!-- If @sortas is present, sort and group by combination of
@sortas, space and entry to keep it separate from other entries
with the same @sortas.
If @sortas is not present, the first item is empty, and the added space
is removed when normalize-space is applied, leaving just the entry -->
<!ENTITY primary 'normalize-space(concat(primary/@sortas, " ", primary))'>
<!ENTITY secondary 'normalize-space(concat(secondary/@sortas, " ", secondary))'>
<!ENTITY tertiary 'normalize-space(concat(tertiary/@sortas, " ", tertiary))'>
<!ENTITY section '(ancestor-or-self::set|ancestor-or-self::book|ancestor-or-self::part|ancestor-or-self::reference|ancestor-or-self::partintro|ancestor-or-self::chapter|ancestor-or-self::appendix|ancestor-or-self::preface|ancestor-or-self::article|ancestor-or-self::section|ancestor-or-self::sect1|ancestor-or-self::sect2|ancestor-or-self::sect3|ancestor-or-self::sect4|ancestor-or-self::sect5|ancestor-or-self::refentry|ancestor-or-self::refsect1|ancestor-or-self::refsect2|ancestor-or-self::refsect3|ancestor-or-self::simplesect|ancestor-or-self::bibliography|ancestor-or-self::glossary|ancestor-or-self::index|ancestor-or-self::webpage|ancestor-or-self::topic)[last()]'>
<!ENTITY section.id 'generate-id(&section;)'>
<!ENTITY sep '" "'>
<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))'>
<!ENTITY setup-language-variable '
<xsl:variable name="language" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:call-template name="l10n.language"/>
</xsl:variable>
<xsl:variable name="lowercase" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:call-template name="gentext">
<xsl:with-param name="key">normalize.sort.input</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="uppercase" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:call-template name="gentext">
<xsl:with-param name="key">normalize.sort.output</xsl:with-param>
</xsl:call-template>
</xsl:variable>
'>
<!-- Entity used in html/inline.xsl and fo/inline.xsl -->
<!ENTITY comment.block.parents "parent::answer|parent::appendix|parent::article|parent::bibliodiv|
parent::bibliography|parent::blockquote|parent::caution|parent::chapter|
parent::glossary|parent::glossdiv|parent::important|parent::index|
parent::indexdiv|parent::listitem|parent::note|parent::orderedlist|
parent::partintro|parent::preface|parent::procedure|parent::qandadiv|
parent::qandaset|parent::question|parent::refentry|parent::refnamediv|
parent::refsect1|parent::refsect2|parent::refsect3|parent::refsection|
parent::refsynopsisdiv|parent::sect1|parent::sect2|parent::sect3|parent::sect4|
parent::sect5|parent::section|parent::setindex|parent::sidebar|
parent::simplesect|parent::taskprerequisites|parent::taskrelated|
parent::tasksummary|parent::warning|parent::topic">

View File

@ -0,0 +1,839 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: gentext.xsl 9286 2012-04-19 10: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="*" mode="object.title.template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="chapter" mode="object.title.template">
<xsl:choose>
<xsl:when test="string($chapter.autolabel) != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="appendix" mode="object.title.template">
<xsl:choose>
<xsl:when test="string($appendix.autolabel) != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="part" mode="object.title.template">
<xsl:choose>
<xsl:when test="string($part.autolabel) != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section|sect1|sect2|sect3|sect4|sect5|simplesect
|bridgehead|topic"
mode="object.title.template">
<xsl:variable name="is.numbered">
<xsl:call-template name="label.this.section"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$is.numbered != 0">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="procedure" mode="object.title.template">
<xsl:choose>
<xsl:when test="$formal.procedures != 0 and title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
<xsl:text>.formal</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.subtitle.template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'subtitle'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="is.autonumber">
<xsl:value-of select="'0'"/>
</xsl:template>
<xsl:template match="section|sect1|sect2|sect3|sect4|sect5"
mode="is.autonumber">
<xsl:call-template name="label.this.section"/>
</xsl:template>
<xsl:template match="figure|example|table|equation" mode="is.autonumber">
<xsl:value-of select="'1'"/>
</xsl:template>
<xsl:template match="appendix" mode="is.autonumber">
<xsl:value-of select="$appendix.autolabel"/>
</xsl:template>
<xsl:template match="chapter" mode="is.autonumber">
<xsl:value-of select="$chapter.autolabel"/>
</xsl:template>
<xsl:template match="part" mode="is.autonumber">
<xsl:value-of select="$part.autolabel"/>
</xsl:template>
<xsl:template match="preface" mode="is.autonumber">
<xsl:value-of select="$preface.autolabel"/>
</xsl:template>
<xsl:template match="question|answer" mode="is.autonumber">
<xsl:choose>
<xsl:when test="$qanda.defaultlabel = 'number'
and not(label)">
<xsl:value-of select="'1'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'0'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="qandadiv" mode="is.autonumber">
<xsl:value-of select="$qandadiv.autolabel"/>
</xsl:template>
<xsl:template match="bridgehead" mode="is.autonumber">
<xsl:value-of select="$section.autolabel"/>
</xsl:template>
<xsl:template match="procedure" mode="is.autonumber">
<xsl:value-of select="$formal.procedures"/>
</xsl:template>
<xsl:template match="*" mode="object.xref.template">
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<!-- Is autonumbering on? -->
<xsl:variable name="autonumber">
<xsl:apply-templates select="." mode="is.autonumber"/>
</xsl:variable>
<xsl:variable name="number-and-title-template">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'xref-number-and-title'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="number-template">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'xref-number'"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="context">
<xsl:choose>
<xsl:when test="self::equation and not(title) and not(info/title)">
<xsl:value-of select="'xref-number'"/>
</xsl:when>
<xsl:when test="string($autonumber) != 0
and $number-and-title-template != 0
and $xref.with.number.and.title != 0">
<xsl:value-of select="'xref-number-and-title'"/>
</xsl:when>
<xsl:when test="string($autonumber) != 0
and $number-template != 0">
<xsl:value-of select="'xref-number'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'xref'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name">
<xsl:call-template name="xpath.location"/>
</xsl:with-param>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="template">
<xsl:apply-templates select="." mode="object.title.template"/>
</xsl:variable>
<!--
<xsl:message>
<xsl:text>object.title.markup: </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="$template"/>
</xsl:message>
-->
<xsl:call-template name="substitute-markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="*" mode="object.title.markup.textonly">
<xsl:variable name="title">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:variable>
<xsl:value-of select="normalize-space($title)"/>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<!-- Just for consistency in template naming -->
<xsl:apply-templates select="." mode="titleabbrev.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.subtitle.markup">
<xsl:variable name="template">
<xsl:apply-templates select="." mode="object.subtitle.template"/>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="object.xref.markup">
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="template">
<xsl:choose>
<xsl:when test="starts-with(normalize-space($xrefstyle), 'select:')">
<xsl:call-template name="make.gentext.template">
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="starts-with(normalize-space($xrefstyle), 'template:')">
<xsl:value-of select="substring-after(normalize-space($xrefstyle), 'template:')"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="object.xref.template">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--
<xsl:message>
<xsl:text>object.xref.markup: </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text>(</xsl:text>
<xsl:value-of select="$xrefstyle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$purpose"/>
<xsl:text>)</xsl:text>
<xsl:text>: [</xsl:text>
<xsl:value-of select="$template"/>
<xsl:text>]</xsl:text>
</xsl:message>
-->
<xsl:if test="$template = '' and $verbose != 0">
<xsl:message>
<xsl:text>object.xref.markup: empty xref template</xsl:text>
<xsl:text> for linkend="</xsl:text>
<xsl:value-of select="@id|@xml:id"/>
<xsl:text>" and @xrefstyle="</xsl:text>
<xsl:value-of select="$xrefstyle"/>
<xsl:text>"</xsl:text>
</xsl:message>
</xsl:if>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="template" select="$template"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="listitem" mode="object.xref.markup">
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<xsl:when test="parent::orderedlist">
<xsl:variable name="template">
<xsl:apply-templates select="." mode="object.xref.template"/>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$verbose != 0">
<xsl:message>
<xsl:text>Xref is only supported to listitems in an</xsl:text>
<xsl:text> orderedlist: </xsl:text>
<xsl:value-of select=".//@id|.//@xml:id"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="question" mode="object.xref.markup">
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:variable name="deflabel">
<xsl:choose>
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
/@defaultlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="template">
<xsl:choose>
<!-- This avoids double Q: Q: in xref when defaultlabel=qanda -->
<xsl:when test="$deflabel = 'qanda' and not(label)">%n</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="object.xref.template">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="template" select="$template"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="substitute-markup">
<xsl:param name="template" select="''"/>
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="title" select="''"/>
<xsl:param name="subtitle" select="''"/>
<xsl:param name="docname" select="''"/>
<xsl:param name="label" select="''"/>
<xsl:param name="pagenumber" select="''"/>
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="verbose"/>
<xsl:choose>
<xsl:when test="contains($template, '%')">
<xsl:value-of select="substring-before($template, '%')"/>
<xsl:variable name="candidate"
select="substring(substring-after($template, '%'), 1, 1)"/>
<xsl:choose>
<xsl:when test="$candidate = 't'">
<xsl:apply-templates select="." mode="insert.title.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="title">
<xsl:choose>
<xsl:when test="$title != ''">
<xsl:copy-of select="$title"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 's'">
<xsl:apply-templates select="." mode="insert.subtitle.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="subtitle">
<xsl:choose>
<xsl:when test="$subtitle != ''">
<xsl:copy-of select="$subtitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'n'">
<xsl:apply-templates select="." mode="insert.label.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="label">
<xsl:choose>
<xsl:when test="$label != ''">
<xsl:copy-of select="$label"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'p'">
<xsl:apply-templates select="." mode="insert.pagenumber.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="pagenumber">
<xsl:choose>
<xsl:when test="$pagenumber != ''">
<xsl:copy-of select="$pagenumber"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="pagenumber.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'o'">
<!-- olink target document title -->
<xsl:apply-templates select="." mode="insert.olink.docname.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="docname">
<xsl:choose>
<xsl:when test="$docname != ''">
<xsl:copy-of select="$docname"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="olink.docname.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = 'd'">
<xsl:apply-templates select="." mode="insert.direction.markup">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="direction">
<xsl:choose>
<xsl:when test="$referrer">
<xsl:variable name="referent-is-below">
<xsl:for-each select="preceding::xref">
<xsl:if test="generate-id(.) = generate-id($referrer)">1</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="$referent-is-below = ''">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'above'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'below'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:message>Attempt to use %d in gentext with no referrer!</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$candidate = '%' ">
<xsl:text>%</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>%</xsl:text><xsl:value-of select="$candidate"/>
</xsl:otherwise>
</xsl:choose>
<!-- recurse with the rest of the template string -->
<xsl:variable name="rest"
select="substring($template,
string-length(substring-before($template, '%'))+3)"/>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$rest"/>
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="title" select="$title"/>
<xsl:with-param name="subtitle" select="$subtitle"/>
<xsl:with-param name="docname" select="$docname"/>
<xsl:with-param name="label" select="$label"/>
<xsl:with-param name="pagenumber" select="$pagenumber"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$template"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="make.gentext.template">
<xsl:param name="xrefstyle" select="''"/>
<xsl:param name="purpose"/>
<xsl:param name="referrer"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:param name="target.elem" select="local-name(.)"/>
<!-- parse xrefstyle to get parts -->
<xsl:variable name="parts"
select="substring-after(normalize-space($xrefstyle), 'select:')"/>
<xsl:variable name="labeltype">
<xsl:choose>
<xsl:when test="contains($parts, 'labelnumber')">
<xsl:text>labelnumber</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'labelname')">
<xsl:text>labelname</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'label')">
<xsl:text>label</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="titletype">
<xsl:choose>
<xsl:when test="contains($parts, 'quotedtitle')">
<xsl:text>quotedtitle</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'title')">
<xsl:text>title</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="pagetype">
<xsl:choose>
<xsl:when test="$insert.olink.page.number = 'no' and
local-name($referrer) = 'olink'">
<!-- suppress page numbers -->
</xsl:when>
<xsl:when test="$insert.xref.page.number = 'no' and
local-name($referrer) != 'olink'">
<!-- suppress page numbers -->
</xsl:when>
<xsl:when test="contains($parts, 'nopage')">
<xsl:text>nopage</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'pagenumber')">
<xsl:text>pagenumber</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'pageabbrev')">
<xsl:text>pageabbrev</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'Page')">
<xsl:text>Page</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'page')">
<xsl:text>page</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="docnametype">
<xsl:choose>
<xsl:when test="($olink.doctitle = 0 or
$olink.doctitle = 'no') and
local-name($referrer) = 'olink'">
<!-- suppress docname -->
</xsl:when>
<xsl:when test="contains($parts, 'nodocname')">
<xsl:text>nodocname</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'docnamelong')">
<xsl:text>docnamelong</xsl:text>
</xsl:when>
<xsl:when test="contains($parts, 'docname')">
<xsl:text>docname</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="$labeltype != ''">
<xsl:choose>
<xsl:when test="$labeltype = 'labelname'">
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="local-name($referrer) = 'olink'">
<xsl:value-of select="$target.elem"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$labeltype = 'labelnumber'">
<xsl:text>%n</xsl:text>
</xsl:when>
<xsl:when test="$labeltype = 'label'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref-number'"/>
<xsl:with-param name="name">
<xsl:choose>
<xsl:when test="local-name($referrer) = 'olink'">
<xsl:value-of select="$target.elem"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="xpath.location"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="$titletype != ''">
<xsl:value-of select="$xref.label-title.separator"/>
</xsl:when>
<xsl:when test="$pagetype != '' and $pagetype != 'nopage'">
<xsl:value-of select="$xref.label-page.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:if test="$titletype != ''">
<xsl:choose>
<xsl:when test="$titletype = 'title'">
<xsl:text>%t</xsl:text>
</xsl:when>
<xsl:when test="$titletype = 'quotedtitle'">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat" select="'startquote'"/>
</xsl:call-template>
<xsl:text>%t</xsl:text>
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat" select="'endquote'"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="$pagetype != '' and $pagetype != 'nopage'">
<xsl:value-of select="$xref.title-page.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- special case: use regular xref template if just turning off page -->
<xsl:if test="($pagetype = 'nopage' or $docnametype = 'nodocname')
and local-name($referrer) != 'olink'
and $labeltype = ''
and $titletype = ''">
<xsl:apply-templates select="." mode="object.xref.template">
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="$pagetype != ''">
<xsl:choose>
<xsl:when test="$pagetype = 'page'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'page'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pagetype = 'Page'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'Page'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pagetype = 'pageabbrev'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'pageabbrev'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pagetype = 'pagenumber'">
<xsl:text>%p</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- Add reference to other document title -->
<xsl:if test="$docnametype != '' and local-name($referrer) = 'olink'">
<!-- Any separator should be in the gentext template -->
<xsl:choose>
<xsl:when test="$docnametype = 'docnamelong'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'docnamelong'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$docnametype = 'docname'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'xref'"/>
<xsl:with-param name="name" select="'docname'"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

64
build/xsl/common/l10n.dtd Normal file
View File

@ -0,0 +1,64 @@
<!ENTITY % prefix "l">
<!ENTITY % xmlns "xmlns:%prefix;">
<!ENTITY % uri "'http://docbook.sourceforge.net/xmlns/l10n/1.0'">
<!ENTITY % i18n "%prefix;:i18n">
<!ENTITY % l10n "%prefix;:l10n">
<!ENTITY % gentext "%prefix;:gentext">
<!ENTITY % dingbat "%prefix;:dingbat">
<!ENTITY % context "%prefix;:context">
<!ENTITY % template "%prefix;:template">
<!ENTITY % letters "%prefix;:letters">
<!ENTITY % l "%prefix;:l">
<!ENTITY % lang "lang NMTOKEN #IMPLIED">
<!ELEMENT %i18n; ((%l10n;)+)>
<!ATTLIST %i18n;
%xmlns; CDATA #FIXED %uri;
>
<!ELEMENT %l10n; (%gentext;|%dingbat;|%context;|%letters;)*>
<!ATTLIST %l10n;
%xmlns; CDATA #FIXED %uri;
language CDATA #REQUIRED
english-language-name CDATA #IMPLIED
href CDATA #IMPLIED
>
<!ELEMENT %gentext; EMPTY>
<!ATTLIST %gentext;
%lang;
key CDATA #REQUIRED
text CDATA #REQUIRED
>
<!ELEMENT %dingbat; EMPTY>
<!ATTLIST %dingbat;
%lang;
key CDATA #REQUIRED
text CDATA #REQUIRED
>
<!ELEMENT %context; ((%template;)+)>
<!ATTLIST %context;
name CDATA #REQUIRED
>
<!ELEMENT %template; EMPTY>
<!ATTLIST %template;
%lang;
name CDATA #REQUIRED
text CDATA #REQUIRED
style CDATA #IMPLIED
>
<!ELEMENT %letters; ((%l;)+)>
<!ATTLIST %letters;
%lang;
>
<!ELEMENT %l; (#PCDATA)>
<!ATTLIST %l;
i CDATA #REQUIRED
>

77
build/xsl/common/l10n.xml Normal file
View File

@ -0,0 +1,77 @@
<?xml version='1.0'?>
<!DOCTYPE l:i18n SYSTEM "l10n.dtd">
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="af" href="af.xml"/>
<l:l10n language="am" href="am.xml"/>
<l:l10n language="ar" href="ar.xml"/>
<l:l10n language="as" href="as.xml"/>
<l:l10n language="ast" href="ast.xml"/>
<l:l10n language="az" href="az.xml"/>
<l:l10n language="bg" href="bg.xml"/>
<l:l10n language="bn" href="bn.xml"/>
<l:l10n language="bn_in" href="bn_in.xml"/>
<l:l10n language="bs" href="bs.xml"/>
<l:l10n language="ca" href="ca.xml"/>
<l:l10n language="cs" href="cs.xml"/>
<l:l10n language="cy" href="cy.xml"/>
<l:l10n language="da" href="da.xml"/>
<l:l10n language="de" href="de.xml"/>
<l:l10n language="el" href="el.xml"/>
<l:l10n language="en" href="en.xml"/>
<l:l10n language="eo" href="eo.xml"/>
<l:l10n language="es" href="es.xml"/>
<l:l10n language="et" href="et.xml"/>
<l:l10n language="eu" href="eu.xml"/>
<l:l10n language="fa" href="fa.xml"/>
<l:l10n language="fi" href="fi.xml"/>
<l:l10n language="fr" href="fr.xml"/>
<l:l10n language="ga" href="ga.xml"/>
<l:l10n language="gl" href="gl.xml"/>
<l:l10n language="gu" href="gu.xml"/>
<l:l10n language="he" href="he.xml"/>
<l:l10n language="hi" href="hi.xml"/>
<l:l10n language="hr" href="hr.xml"/>
<l:l10n language="hu" href="hu.xml"/>
<l:l10n language="id" href="id.xml"/>
<l:l10n language="is" href="is.xml"/>
<l:l10n language="it" href="it.xml"/>
<l:l10n language="ja" href="ja.xml"/>
<l:l10n language="ka" href="ka.xml"/>
<l:l10n language="kn" href="kn.xml"/>
<l:l10n language="ko" href="ko.xml"/>
<l:l10n language="ky" href="ky.xml"/>
<l:l10n language="la" href="la.xml"/>
<l:l10n language="lt" href="lt.xml"/>
<l:l10n language="lv" href="lv.xml"/>
<l:l10n language="ml" href="ml.xml"/>
<l:l10n language="mn" href="mn.xml"/>
<l:l10n language="mr" href="mr.xml"/>
<l:l10n language="nb" href="nb.xml"/>
<l:l10n language="nds" href="nds.xml"/>
<l:l10n language="nl" href="nl.xml"/>
<l:l10n language="nn" href="nn.xml"/>
<l:l10n language="or" href="or.xml"/>
<l:l10n language="pa" href="pa.xml"/>
<l:l10n language="pl" href="pl.xml"/>
<l:l10n language="pt" href="pt.xml"/>
<l:l10n language="pt_br" href="pt_br.xml"/>
<l:l10n language="ro" href="ro.xml"/>
<l:l10n language="ru" href="ru.xml"/>
<l:l10n language="sk" href="sk.xml"/>
<l:l10n language="sl" href="sl.xml"/>
<l:l10n language="sq" href="sq.xml"/>
<l:l10n language="sr" href="sr.xml"/>
<l:l10n language="sr_latn" href="sr_Latn.xml"/>
<l:l10n language="sv" href="sv.xml"/>
<l:l10n language="ta" href="ta.xml"/>
<l:l10n language="te" href="te.xml"/>
<l:l10n language="th" href="th.xml"/>
<l:l10n language="tl" href="tl.xml"/>
<l:l10n language="tr" href="tr.xml"/>
<l:l10n language="uk" href="uk.xml"/>
<l:l10n language="vi" href="vi.xml"/>
<l:l10n language="xh" href="xh.xml"/>
<l:l10n language="zh" href="zh.xml"/>
<l:l10n language="zh_cn" href="zh_cn.xml"/>
<l:l10n language="zh_tw" href="zh_tw.xml"/>
</l:i18n>

593
build/xsl/common/l10n.xsl Normal file
View File

@ -0,0 +1,593 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
exclude-result-prefixes="l"
version='1.0'>
<!-- ********************************************************************
$Id: l10n.xsl 8904 2010-09-11 01:56:22Z kosek $
********************************************************************
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.
This file contains localization templates (for internationalization)
******************************************************************** -->
<xsl:param name="l10n.xml" select="document('../common/l10n.xml')"/>
<xsl:param name="local.l10n.xml" select="document('')"/>
<xsl:param name="empty.local.l10n.xml" select="not($local.l10n.xml//l:l10n)"/>
<xsl:key name="l10n-lang" match="l:l10n" use="@language"/>
<xsl:key name="l10n-gentext" match="l:l10n/l:gentext" use="@key"/>
<xsl:key name="l10n-dingbat" match="l:l10n/l:dingbat" use="@key"/>
<xsl:key name="l10n-context" match="l:l10n/l:context" use="@name"/>
<xsl:key name="l10n-template" match="l:l10n/l:context/l:template[not(@style)]" use="concat(../@name, '#', @name)"/>
<xsl:key name="l10n-template-style" match="l:l10n/l:context/l:template[@style]" use="concat(../@name, '#', @name, '#', @style)"/>
<xsl:template name="l10n.language">
<xsl:param name="target" select="."/>
<xsl:param name="xref-context" select="false()"/>
<xsl:variable name="mc-language">
<xsl:choose>
<xsl:when test="$l10n.gentext.language != ''">
<xsl:value-of select="$l10n.gentext.language"/>
</xsl:when>
<xsl:when test="$xref-context or $l10n.gentext.use.xref.language != 0">
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$target/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$target/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="language" select="translate($mc-language,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ-',
'abcdefghijklmnopqrstuvwxyz_')"/>
<xsl:for-each select="$l10n.xml"> <!-- We need to change context in order to get key work -->
<xsl:choose>
<xsl:when test="key('l10n-lang', $language)">
<xsl:value-of select="$language"/>
</xsl:when>
<!-- try just the lang code without country -->
<xsl:when test="key('l10n-lang', substring-before($language,'_'))">
<xsl:value-of select="substring-before($language,'_')"/>
</xsl:when>
<!-- or use the default -->
<xsl:otherwise>
<xsl:message>
<xsl:text>No localization exists for "</xsl:text>
<xsl:value-of select="$language"/>
<xsl:text>" or "</xsl:text>
<xsl:value-of select="substring-before($language,'_')"/>
<xsl:text>". Using default "</xsl:text>
<xsl:value-of select="$l10n.gentext.default.language"/>
<xsl:text>".</xsl:text>
</xsl:message>
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="l10n.language.name">
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:for-each select="$l10n.xml">
<xsl:value-of
select="document(key('l10n-lang', $lang)/@href)/l:l10n/@english-language-name"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="language.attribute">
<xsl:param name="node" select="."/>
<xsl:variable name="language">
<xsl:choose>
<xsl:when test="$l10n.gentext.language != ''">
<xsl:value-of select="$l10n.gentext.language"/>
</xsl:when>
<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$node/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$language != ''">
<xsl:attribute name="lang">
<xsl:choose>
<xsl:when test="$l10n.lang.value.rfc.compliant != 0">
<xsl:value-of select="translate($language, '_', '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<!-- FIXME: This is sort of hack, but it was the easiest way to add at least partial support for dir attribute -->
<xsl:copy-of select="ancestor-or-self::*[@dir][1]/@dir"/>
</xsl:template>
<!-- Duplication of language.attribute template to allow for xml:lang attribute
creation for XHTML 1.1 and epub target -->
<xsl:template name="xml.language.attribute">
<xsl:param name="node" select="."/>
<xsl:variable name="language">
<xsl:choose>
<xsl:when test="$l10n.gentext.language != ''">
<xsl:value-of select="$l10n.gentext.language"/>
</xsl:when>
<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="$node/ancestor-or-self::*
[@lang or @xml:lang][1]"/>
<xsl:variable name="lang-attr"
select="($lang-scope/@lang | $lang-scope/@xml:lang)[1]"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$language != ''">
<xsl:attribute name="xml:lang">
<xsl:choose>
<xsl:when test="$l10n.lang.value.rfc.compliant != 0">
<xsl:value-of select="translate($language, '_', '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<!-- FIXME: This is sort of hack, but it was the easiest way to add at least partial support for dir attribute -->
<xsl:copy-of select="ancestor-or-self::*[@dir][1]/@dir"/>
</xsl:template>
<xsl:template name="gentext">
<xsl:param name="key" select="local-name(.)"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="local.l10n.gentext"
select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:gentext[@key=$key])[1]"/>
<xsl:variable name="l10n.gentext"
select="key('l10n-gentext', $key)[1]"/>
<xsl:choose>
<xsl:when test="$local.l10n.gentext">
<xsl:value-of select="$local.l10n.gentext/@text"/>
</xsl:when>
<xsl:when test="$l10n.gentext">
<xsl:value-of select="$l10n.gentext/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization of "</xsl:text>
<xsl:value-of select="$key"/>
<xsl:text>" exists</xsl:text>
<xsl:choose>
<xsl:when test="$lang = 'en'">
<xsl:text>.</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>; using "en".</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:message>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', 'en')/@href)">
<xsl:value-of select="key('l10n-gentext', $key)[1]/@text"/>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="gentext.element.name">
<xsl:param name="element.name" select="local-name(.)"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="$element.name"/>
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.space">
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template name="gentext.edited.by">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Editedby'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.by">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'by'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.dingbat">
<xsl:param name="dingbat">bullet</xsl:param>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="local.l10n.dingbat"
select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:dingbat[@key=$dingbat])[1]"/>
<xsl:variable name="l10n.dingbat"
select="key('l10n-dingbat', $dingbat)[1]"/>
<xsl:choose>
<xsl:when test="$local.l10n.dingbat">
<xsl:value-of select="$local.l10n.dingbat/@text"/>
</xsl:when>
<xsl:when test="$l10n.dingbat">
<xsl:value-of select="$l10n.dingbat/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization of dingbat </xsl:text>
<xsl:value-of select="$dingbat"/>
<xsl:text> exists; using "en".</xsl:text>
</xsl:message>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', 'en')/@href)">
<xsl:value-of select="key('l10n-dingbat', $dingbat)[1]/@text"/>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="gentext.startquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">startquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.endquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">endquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nestedstartquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">nestedstartquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nestedendquote">
<xsl:call-template name="gentext.dingbat">
<xsl:with-param name="dingbat">nestedendquote</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.prev">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-prev'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.next">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-next'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.home">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-home'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="gentext.nav.up">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'nav-up'"/>
</xsl:call-template>
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="gentext.template">
<xsl:param name="context" select="'default'"/>
<xsl:param name="name" select="'default'"/>
<xsl:param name="origname" select="$name"/>
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<xsl:when test="$empty.local.l10n.xml">
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="localization.node"
select="key('l10n-lang', $lang)[1]"/>
<xsl:if test="count($localization.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization exists.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:variable name="context.node"
select="key('l10n-context', $context)[1]"/>
<xsl:if test="count($context.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" exists in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:for-each select="$context.node">
<xsl:variable name="template.node"
select="(key('l10n-template-style', concat($context, '#', $name, '#', $xrefstyle))
|key('l10n-template', concat($context, '#', $name)))[1]"/>
<xsl:choose>
<xsl:when test="$template.node/@text">
<xsl:value-of select="$template.node/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($name, '/')">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name" select="substring-after($name, '/')"/>
<xsl:with-param name="origname" select="$origname"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$verbose = 0">
<!-- silence -->
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No template for "</xsl:text>
<xsl:value-of select="$origname"/>
<xsl:text>" (or any of its leaves) exists in the context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work -->
<xsl:for-each select="document(key('l10n-lang', $lang)/@href)">
<xsl:variable name="local.localization.node"
select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang])[1]"/>
<xsl:variable name="localization.node"
select="key('l10n-lang', $lang)[1]"/>
<xsl:if test="count($localization.node) = 0
and count($local.localization.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization exists.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:variable name="local.context.node"
select="$local.localization.node/l:context[@name=$context]"/>
<xsl:variable name="context.node"
select="key('l10n-context', $context)[1]"/>
<xsl:if test="count($context.node) = 0
and count($local.context.node) = 0
and $verbose != 0">
<xsl:message>
<xsl:text>No context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" exists in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:variable name="local.template.node"
select="($local.context.node/l:template[@name=$name
and @style
and @style=$xrefstyle]
|$local.context.node/l:template[@name=$name
and not(@style)])[1]"/>
<xsl:for-each select="$context.node">
<xsl:variable name="template.node"
select="(key('l10n-template-style', concat($context, '#', $name, '#', $xrefstyle))
|key('l10n-template', concat($context, '#', $name)))[1]"/>
<xsl:choose>
<xsl:when test="$local.template.node/@text">
<xsl:value-of select="$local.template.node/@text"/>
</xsl:when>
<xsl:when test="$template.node/@text">
<xsl:value-of select="$template.node/@text"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($name, '/')">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name" select="substring-after($name, '/')"/>
<xsl:with-param name="origname" select="$origname"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$verbose = 0">
<!-- silence -->
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>No template for "</xsl:text>
<xsl:value-of select="$origname"/>
<xsl:text>" (or any of its leaves) exists in the context named "</xsl:text>
<xsl:value-of select="$context"/>
<xsl:text>" in the "</xsl:text>
<xsl:value-of select="$lang"/>
<xsl:text>" localization.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- silently test if a gentext template exists -->
<xsl:template name="gentext.template.exists">
<xsl:param name="context" select="'default'"/>
<xsl:param name="name" select="'default'"/>
<xsl:param name="origname" select="$name"/>
<xsl:param name="purpose"/>
<xsl:param name="xrefstyle"/>
<xsl:param name="referrer"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:variable name="template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="origname" select="$origname"/>
<xsl:with-param name="purpose" select="$purpose"/>
<xsl:with-param name="xrefstyle" select="$xrefstyle"/>
<xsl:with-param name="referrer" select="$referrer"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="verbose" select="0"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($template) != 0">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

903
build/xsl/common/labels.xsl Normal file
View File

@ -0,0 +1,903 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: labels.xsl 9286 2012-04-19 10: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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- label markup -->
<doc:mode mode="label.markup" xmlns="">
<refpurpose>Provides access to element labels</refpurpose>
<refdescription id="label.markup-desc">
<para>Processing an element in the
<literal role="mode">label.markup</literal> mode produces the
element label.</para>
<para>Trailing punctuation is not added to the label.
</para>
</refdescription>
</doc:mode>
<xsl:template match="*" mode="intralabel.punctuation">
<xsl:text>.</xsl:text>
</xsl:template>
<xsl:template match="*" mode="label.markup">
<xsl:param name="verbose" select="1"/>
<xsl:if test="$verbose">
<xsl:message>
<xsl:text>Request for label of unexpected element: </xsl:text>
<xsl:value-of select="local-name(.)"/>
</xsl:message>
</xsl:if>
</xsl:template>
<xsl:template match="set|book" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="part" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($part.autolabel) != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$part.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number from="book" count="part" format="{$format}"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="partintro" mode="label.markup">
<!-- no label -->
</xsl:template>
<xsl:template match="preface" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($preface.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$preface.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="preface" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book" count="preface" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="chapter" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($chapter.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$chapter.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="chapter" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book" count="chapter" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="appendix" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($appendix.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$appendix.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="appendix" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book|article"
count="appendix" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="article" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="dedication|colophon" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="reference" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="string($reference.autolabel) != 0">
<xsl:if test="$component.label.includes.part.label != 0 and
ancestor::part">
<xsl:variable name="part.label">
<xsl:apply-templates select="ancestor::part"
mode="label.markup"/>
</xsl:variable>
<xsl:if test="$part.label != ''">
<xsl:value-of select="$part.label"/>
<xsl:apply-templates select="ancestor::part"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$reference.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$label.from.part != 0 and ancestor::part">
<xsl:number from="part" count="reference" format="{$format}" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="book" count="reference" format="{$format}" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="refentry" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="section" mode="label.markup">
<!-- if this is a nested section, label the parent -->
<xsl:if test="local-name(..) = 'section'">
<xsl:variable name="parent.section.label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select=".."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$parent.section.label != '0'">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<!-- if the parent is a component, maybe label that too -->
<xsl:variable name="parent.is.component">
<xsl:call-template name="is.component">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>
<!-- does this section get labelled? -->
<xsl:variable name="label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$section.label.includes.component.label != 0
and $parent.is.component != 0">
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<!--
<xsl:message>
test: <xsl:value-of select="$label"/>, <xsl:number count="section"/>
</xsl:message>
-->
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$label != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number format="{$format}" count="section"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="sect1" mode="label.markup">
<!-- if the parent is a component, maybe label that too -->
<xsl:variable name="parent.is.component">
<xsl:call-template name="is.component">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="component.label">
<xsl:if test="$section.label.includes.component.label != 0
and $parent.is.component != 0">
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<xsl:variable name="is.numbered">
<xsl:call-template name="label.this.section"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$is.numbered != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="$component.label"/>
<xsl:number format="{$format}" count="sect1"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="sect2|sect3|sect4|sect5" mode="label.markup">
<!-- label the parent -->
<xsl:variable name="parent.section.label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select=".."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$parent.section.label != '0'">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
<xsl:variable name="is.numbered">
<xsl:call-template name="label.this.section"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$is.numbered != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name(.) = 'sect2'">
<xsl:number format="{$format}" count="sect2"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect3'">
<xsl:number format="{$format}" count="sect3"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect4'">
<xsl:number format="{$format}" count="sect4"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect5'">
<xsl:number format="{$format}" count="sect5"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>label.markup: this can't happen!</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="bridgehead" mode="label.markup">
<!-- FIXME: could we do a better job here? -->
<xsl:variable name="contsec"
select="(ancestor::section
|ancestor::simplesect
|ancestor::topic
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3
|ancestor::chapter
|ancestor::appendix
|ancestor::preface)[last()]"/>
<xsl:apply-templates select="$contsec" mode="label.markup"/>
</xsl:template>
<xsl:template match="refsect1" mode="label.markup">
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$section.autolabel != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number count="refsect1" format="{$format}"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="refsect2|refsect3" mode="label.markup">
<!-- label the parent -->
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$section.autolabel != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name(.) = 'refsect2'">
<xsl:number count="refsect2" format="{$format}"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="refsect3" format="{$format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="simplesect" mode="label.markup">
<!-- if this is a nested section, label the parent -->
<xsl:if test="local-name(..) = 'section'
or local-name(..) = 'sect1'
or local-name(..) = 'sect2'
or local-name(..) = 'sect3'
or local-name(..) = 'sect4'
or local-name(..) = 'sect5'">
<xsl:variable name="parent.section.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.section.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<!-- if the parent is a component, maybe label that too -->
<xsl:variable name="parent.is.component">
<xsl:call-template name="is.component">
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
</xsl:variable>
<!-- does this section get labelled? -->
<xsl:variable name="label">
<xsl:call-template name="label.this.section">
<xsl:with-param name="section" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$section.label.includes.component.label != 0
and $parent.is.component != 0">
<xsl:variable name="parent.label">
<xsl:apply-templates select=".." mode="label.markup"/>
</xsl:variable>
<xsl:if test="$parent.label != ''">
<xsl:apply-templates select=".." mode="label.markup"/>
<xsl:apply-templates select=".." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$label != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$section.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:number format="{$format}" count="simplesect"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="topic" mode="label.markup">
<!-- topics are not numbered by default -->
</xsl:template>
<xsl:template match="qandadiv" mode="label.markup">
<xsl:variable name="lparent" select="(ancestor::set
|ancestor::book
|ancestor::chapter
|ancestor::appendix
|ancestor::preface
|ancestor::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3)[last()]"/>
<xsl:variable name="lparent.prefix">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
</xsl:variable>
<xsl:variable name="prefix">
<xsl:if test="$qanda.inherit.numeration != 0">
<xsl:if test="$lparent.prefix != ''">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
<xsl:apply-templates select="$lparent" mode="intralabel.punctuation"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$qandadiv.autolabel != 0">
<xsl:variable name="format">
<xsl:call-template name="autolabel.format">
<xsl:with-param name="format" select="$qandadiv.autolabel"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$prefix"/>
<xsl:number level="multiple" count="qandadiv" format="{$format}"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="question|answer" mode="label.markup">
<xsl:variable name="lparent" select="(ancestor::set
|ancestor::book
|ancestor::chapter
|ancestor::appendix
|ancestor::preface
|ancestor::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3)[last()]"/>
<xsl:variable name="lparent.prefix">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
</xsl:variable>
<xsl:variable name="prefix">
<xsl:if test="$qanda.inherit.numeration != 0">
<xsl:choose>
<xsl:when test="ancestor::qandadiv">
<xsl:variable name="div.label">
<xsl:apply-templates select="ancestor::qandadiv[1]" mode="label.markup"/>
</xsl:variable>
<xsl:if test="string-length($div.label) != 0">
<xsl:copy-of select="$div.label"/>
<xsl:apply-templates select="ancestor::qandadiv[1]"
mode="intralabel.punctuation"/>
</xsl:if>
</xsl:when>
<xsl:when test="$lparent.prefix != ''">
<xsl:apply-templates select="$lparent" mode="label.markup"/>
<xsl:apply-templates select="$lparent" mode="intralabel.punctuation"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="inhlabel"
select="ancestor-or-self::qandaset/@defaultlabel[1]"/>
<xsl:variable name="deflabel">
<xsl:choose>
<xsl:when test="$inhlabel != ''">
<xsl:value-of select="$inhlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="label" select="label"/>
<xsl:choose>
<xsl:when test="count($label)>0">
<xsl:apply-templates select="$label"/>
</xsl:when>
<xsl:when test="$deflabel = 'qanda' and self::question">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Question'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$deflabel = 'qanda' and self::answer">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Answer'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="($deflabel = 'qnumber' or
$deflabel = 'qnumberanda') and self::question">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Question'"/>
</xsl:call-template>
<xsl:text>&#xA0;</xsl:text>
<xsl:value-of select="$prefix"/>
<xsl:number level="multiple" count="qandaentry" format="1"/>
</xsl:when>
<xsl:when test="$deflabel = 'qnumberanda' and self::answer">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Answer'"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$deflabel = 'number' and self::question">
<xsl:value-of select="$prefix"/>
<xsl:number level="multiple" count="qandaentry" format="1"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="bibliography|glossary|
qandaset|index|setindex" mode="label.markup">
<xsl:if test="@label">
<xsl:value-of select="@label"/>
</xsl:if>
</xsl:template>
<xsl:template match="figure|table|example" mode="label.markup">
<xsl:variable name="pchap"
select="(ancestor::chapter
|ancestor::appendix
|ancestor::article[ancestor::book])[last()]"/>
<xsl:variable name="prefix">
<xsl:if test="count($pchap) &gt; 0">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
<xsl:number format="1" from="chapter|appendix" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number format="1" from="book|article" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="procedure" mode="label.markup">
<xsl:variable name="pchap"
select="ancestor::chapter
|ancestor::appendix
|ancestor::article[ancestor::book]"/>
<xsl:variable name="prefix">
<xsl:if test="count($pchap) &gt; 0">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="$formal.procedures = 0">
<!-- No label -->
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="count($pchap)>0">
<xsl:if test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
</xsl:if>
<xsl:number count="procedure[title]" format="1"
from="chapter|appendix" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="procedure[title]" format="1"
from="book|article" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="equation" mode="label.markup">
<xsl:variable name="pchap"
select="ancestor::chapter
|ancestor::appendix
|ancestor::article[ancestor::book]"/>
<xsl:variable name="prefix">
<xsl:if test="count($pchap) &gt; 0">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="@label">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="count($pchap)>0">
<xsl:if test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/>
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
</xsl:if>
<xsl:number format="1" count="equation"
from="chapter|appendix" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number format="1" count="equation"
from="book|article" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="orderedlist/listitem" mode="label.markup">
<xsl:variable name="numeration">
<xsl:call-template name="list.numeration">
<xsl:with-param name="node" select="parent::orderedlist"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="$numeration='arabic'">1</xsl:when>
<xsl:when test="$numeration='loweralpha'">a</xsl:when>
<xsl:when test="$numeration='lowerroman'">i</xsl:when>
<xsl:when test="$numeration='upperalpha'">A</xsl:when>
<xsl:when test="$numeration='upperroman'">I</xsl:when>
<!-- What!? This should never happen -->
<xsl:otherwise>
<xsl:message>
<xsl:text>Unexpected numeration: </xsl:text>
<xsl:value-of select="$numeration"/>
</xsl:message>
<xsl:value-of select="1."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="item-number">
<xsl:call-template name="orderedlist-item-number"/>
</xsl:variable>
<xsl:number value="$item-number" format="{$type}"/>
</xsl:template>
<xsl:template match="abstract" mode="label.markup">
<!-- nop -->
</xsl:template>
<xsl:template match="sidebar" mode="label.markup">
<!-- nop -->
</xsl:template>
<xsl:template match="glossdiv|glosslist" mode="label.markup">
<!-- nop -->
</xsl:template>
<xsl:template match="glossentry" mode="label.markup">
<!-- nop -->
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="label.this.section">
<xsl:param name="section" select="."/>
<xsl:variable name="level">
<xsl:call-template name="section.level"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$level &lt;= $section.autolabel.max.depth">
<xsl:value-of select="$section.autolabel"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<doc:template name="label.this.section" xmlns="">
<refpurpose>Returns true if $section should be labelled</refpurpose>
<refdescription id="label.this.section-desc">
<para>Returns true if the specified section should be labelled.
By default, this template returns zero unless
the section level is less than or equal to the value of the
<literal>$section.autolabel.max.depth</literal> parameter, in
which case it returns
<literal>$section.autolabel</literal>.
Custom stylesheets may override it to get more selective behavior.</para>
</refdescription>
</doc:template>
<!-- ============================================================ -->
<xsl:template name="default.autolabel.format">
<xsl:param name="context" select="."/>
<xsl:choose>
<xsl:when test="local-name($context) = 'appendix'">
<xsl:value-of select="'A'"/>
</xsl:when>
<xsl:when test="local-name($context) = 'part'">
<xsl:value-of select="'I'"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="autolabel.format">
<xsl:param name="context" select="."/>
<xsl:param name="format"/>
<xsl:choose>
<xsl:when test="string($format) != 0">
<xsl:choose>
<xsl:when test="string($format)='arabic' or $format='1'">1</xsl:when>
<xsl:when test="$format='loweralpha' or $format='a'">
<xsl:value-of select="'a'"/>
</xsl:when>
<xsl:when test="$format='lowerroman' or $format='i'">
<xsl:value-of select="'i'"/>
</xsl:when>
<xsl:when test="$format='upperalpha' or $format='A'">
<xsl:value-of select="'A'"/>
</xsl:when>
<xsl:when test="$format='upperroman' or $format='I'">
<xsl:value-of select="'I'"/>
</xsl:when>
<xsl:when test="$format='arabicindic' or $format='&#x661;'">
<xsl:value-of select="'&#x661;'"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unexpected </xsl:text><xsl:value-of select="local-name(.)"/><xsl:text>.autolabel value: </xsl:text>
<xsl:value-of select="$format"/><xsl:text>; using default.</xsl:text>
</xsl:message>
<xsl:call-template name="default.autolabel.format"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
<doc:template name="autolabel.format" xmlns="">
<refpurpose>Returns format for autolabel parameters</refpurpose>
<refdescription id="autolabel.format-desc">
<para>Returns format passed as parameter if non zero. Supported
format are 'arabic' or '1', 'loweralpha' or 'a', 'lowerroman' or 'i',
'upperlapha' or 'A', 'upperroman' or 'I', 'arabicindic' or '&#x661;'.
If its not one of these then
returns the default format.</para>
</refdescription>
</doc:template>
<!-- ============================================================ -->
</xsl:stylesheet>

1232
build/xsl/common/olink.xsl Normal file

File diff suppressed because it is too large Load Diff

346
build/xsl/common/pi.xsl Normal file
View File

@ -0,0 +1,346 @@
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:exsl="http://exslt.org/common"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="doc date exsl"
extension-element-prefixes="date exsl"
version='1.0'>
<!-- ********************************************************************
$Id: pi.xsl 8782 2010-07-27 21:15:17Z mzjn $
********************************************************************
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.
******************************************************************** -->
<doc:reference xmlns=""><info><title>Common Processing Instruction Reference</title>
<releaseinfo role="meta">
$Id: pi.xsl 8782 2010-07-27 21:15:17Z mzjn $
</releaseinfo>
</info>
<partintro id="partintro">
<title>Introduction</title>
<para>This is generated reference documentation for all
user-specifiable processing instructions (PIs) in the
“common” part of the DocBook XSL stylesheets.
<note>
<para>You add these PIs at particular points in a document to
cause specific “exceptions” to formatting/output behavior. To
make global changes in formatting/output behavior across an
entire document, its better to do it by setting an
appropriate stylesheet parameter (if there is one).</para>
</note>
</para>
</partintro>
</doc:reference>
<!-- ==================================================================== -->
<doc:pi name="dbchoice_choice" xmlns="">
<refpurpose>Generates a localized choice separator</refpurpose>
<refdescription id="select.choice.separator-desc">
<para>Use the <tag class="xmlpi">dbchoice choice</tag> PI to
generate an appropriate localized “choice” separator (for
example, <literal>and</literal> or <literal>or</literal>)
before the final item in an inline <tag>simplelist</tag></para>
<warning>
<para>This PI is a less-than-ideal hack; support for it may
disappear in the future (particularly if and when a more
appropriate means for marking up "choice" lists becomes
available in DocBook).</para>
</warning>
</refdescription>
<refsynopsisdiv>
<synopsis><tag class="xmlpi">dbchoice choice="and"|"or"|<replaceable>string</replaceable>"</tag></synopsis>
</refsynopsisdiv>
<refparameter>
<variablelist>
<varlistentry><term>choice="and"</term>
<listitem>
<para>generates a localized <literal>and</literal> separator</para>
</listitem>
</varlistentry>
<varlistentry><term>choice="or"</term>
<listitem>
<para>generates a localized <literal>or</literal> separator</para>
</listitem>
</varlistentry>
<varlistentry><term>choice="<replaceable>string</replaceable>"</term>
<listitem>
<para>generates a literal <replaceable>string</replaceable> separator</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
</doc:pi>
<xsl:template name="pi.dbchoice_choice">
<xsl:param name="node" select="."/>
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="$node/processing-instruction('dbchoice')"/>
<xsl:with-param name="attribute">choice</xsl:with-param>
</xsl:call-template>
</xsl:template>
<doc:pi name="dbtimestamp" xmlns="">
<refpurpose>Inserts a date timestamp</refpurpose>
<refdescription>
<para>Use the <tag class="xmlpi">dbtimestamp</tag> PI at any point in a
source document to cause a date timestamp (a formatted
string representing the current date and time) to be
inserted in output of the document.</para>
</refdescription>
<refsynopsisdiv>
<synopsis><tag class="xmlpi">dbtimestamp format="<replaceable>formatstring</replaceable>" [padding="0"|"1"]</tag></synopsis>
</refsynopsisdiv>
<refparameter>
<variablelist>
<varlistentry><term>format="<replaceable>formatstring</replaceable>"</term>
<listitem>
<para>Specifies format in which the date and time are
output</para>
<note>
<para>For details of the content of the format string,
see <link role="tcg" xlink:href="Datetime.html"
>Date and time</link>.</para>
</note>
</listitem>
</varlistentry>
<varlistentry><term>padding="0"|"1"</term>
<listitem>
<para>Specifies padding behavior; if non-zero, padding is is added</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
</doc:pi>
<xsl:template name="pi.dbtimestamp">
<xsl:variable name="format">
<xsl:variable name="pi-format">
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="."/>
<xsl:with-param name="attribute">format</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$pi-format != ''">
<xsl:value-of select="$pi-format"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime'"/>
<xsl:with-param name="name" select="'format'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="padding">
<xsl:variable name="pi-padding">
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="."/>
<xsl:with-param name="attribute">padding</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$pi-padding != ''">
<xsl:value-of select="$pi-padding"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="date">
<xsl:choose>
<xsl:when test="function-available('date:date-time')">
<xsl:value-of select="date:date-time()"/>
</xsl:when>
<xsl:when test="function-available('date:dateTime')">
<!-- Xalan quirk -->
<xsl:value-of select="date:dateTime()"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="function-available('date:date-time') or
function-available('date:dateTime')">
<xsl:call-template name="datetime.format">
<xsl:with-param name="date" select="$date"/>
<xsl:with-param name="format" select="$format"/>
<xsl:with-param name="padding" select="$padding"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Timestamp processing requires XSLT processor with EXSLT date support.
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<doc:pi name="dbtex_delims" xmlns="">
<refpurpose>Generates delimiters around embedded TeX equations
in output</refpurpose>
<refdescription>
<para>Use the <tag class="xmlpi">dbtex delims</tag> PI as a
child of a <tag>textobject</tag> containing embedded TeX
markup, to cause that markup to be surrounded by
<literal>$</literal> delimiter characters in output.</para>
<warning>
<para>This feature is useful for print/PDF output only if you
use the obsolete and now unsupported PassiveTeX XSL-FO
engine.</para>
</warning>
</refdescription>
<refsynopsisdiv>
<synopsis><tag class="xmlpi">dbtex delims="no"|"yes"</tag></synopsis>
</refsynopsisdiv>
<refparameter>
<variablelist>
<varlistentry><term>dbtex delims="no"|"yes"</term>
<listitem>
<para>Specifies whether delimiters are output</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
<refsee role="params">
<para><parameter>tex.math.delims</parameter></para>
</refsee>
</doc:pi>
<xsl:template name="pi.dbtex_delims">
<xsl:param name="node" select="."/>
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="$node/processing-instruction('dbtex')"/>
<xsl:with-param name="attribute" select="'delims'"/>
</xsl:call-template>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="processing-instruction()" mode="titlepage.mode">
<!-- * Als process PIs on title pages -->
<xsl:apply-templates select="."/>
</xsl:template>
<xsl:template match="processing-instruction('dbtimestamp')">
<xsl:call-template name="pi.dbtimestamp"/>
</xsl:template>
<xsl:template name="datetime.format">
<xsl:param name="date"/>
<xsl:param name="format"/>
<xsl:param name="padding" select="1"/>
<xsl:if test="$format != ''">
<!-- replace any whitespace in the format string with a non-breaking space -->
<xsl:variable name="format-nbsp"
select="translate($format,
'&#x20;&#x9;&#xd;&#xa;',
'&#xa0;&#xa0;&#xa0;&#xa0;')"/>
<xsl:variable name="tokenized-format-string">
<xsl:call-template name="str.tokenize.keep.delimiters">
<xsl:with-param name="string" select="$format-nbsp"/>
<xsl:with-param name="delimiters" select="'&#xa0;,./-()[]:'"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<!-- We must preserve context node in order to get valid language -->
<xsl:variable name="context" select="."/>
<xsl:for-each select="exsl:node-set($tokenized-format-string)/node()">
<xsl:variable name="token">
<xsl:value-of select="."/>
</xsl:variable>
<!-- Restore context node -->
<xsl:for-each select="$context">
<xsl:choose>
<xsl:when test="$token = 'a'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-abbrev'"/>
<xsl:with-param name="name" select="date:day-abbreviation($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'A'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-full'"/>
<xsl:with-param name="name" select="date:day-name($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'b'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-abbrev'"/>
<xsl:with-param name="name" select="date:month-abbreviation($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'c'">
<xsl:value-of select="date:date($date)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="date:time($date)"/>
</xsl:when>
<xsl:when test="$token = 'B'">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'datetime-full'"/>
<xsl:with-param name="name" select="date:month-name($date)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$token = 'd'">
<xsl:if test="$padding = 1 and
string-length(date:day-in-month($date)) = 1">0</xsl:if>
<xsl:value-of select="date:day-in-month($date)"/>
</xsl:when>
<xsl:when test="$token = 'H'">
<xsl:if test="$padding = 1 and string-length(date:hour-in-day($date)) = 1">0</xsl:if>
<xsl:value-of select="date:hour-in-day($date)"/>
</xsl:when>
<xsl:when test="$token = 'j'">
<xsl:value-of select="date:day-in-year($date)"/>
</xsl:when>
<xsl:when test="$token = 'm'">
<xsl:if test="$padding = 1 and string-length(date:month-in-year($date)) = 1">0</xsl:if>
<xsl:value-of select="date:month-in-year($date)"/>
</xsl:when>
<xsl:when test="$token = 'M'">
<xsl:if test="string-length(date:minute-in-hour($date)) = 1">0</xsl:if>
<xsl:value-of select="date:minute-in-hour($date)"/>
</xsl:when>
<xsl:when test="$token = 'S'">
<xsl:if test="string-length(date:second-in-minute($date)) = 1">0</xsl:if>
<xsl:value-of select="date:second-in-minute($date)"/>
</xsl:when>
<xsl:when test="$token = 'U'">
<xsl:value-of select="date:week-in-year($date)"/>
</xsl:when>
<xsl:when test="$token = 'w'">
<xsl:value-of select="date:day-in-week($date)"/>
</xsl:when>
<xsl:when test="$token = 'x'">
<xsl:value-of select="date:date($date)"/>
</xsl:when>
<xsl:when test="$token = 'X'">
<xsl:value-of select="date:time($date)"/>
</xsl:when>
<xsl:when test="$token = 'Y'">
<xsl:value-of select="date:year($date)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$token"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Timestamp processing requires an XSLT processor with support
for the EXSLT node-set() function.
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,372 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ng="http://docbook.org/docbook-ng"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:saxon="http://icl.com/saxon"
xmlns:NodeInfo="http://org.apache.xalan.lib.NodeInfo"
xmlns:exsl="http://exslt.org/common"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="db ng exsl saxon NodeInfo xlink"
version='1.0'>
<!-- ********************************************************************
$Id: stripns.xsl 9016 2011-06-07 12:09:34Z nwalsh $
********************************************************************
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.
******************************************************************** -->
<!-- put an xml:base attribute on the root element -->
<xsl:template match="/*" mode="stripNS">
<xsl:choose>
<xsl:when test="self::ng:* or self::db:*">
<xsl:element name="{local-name(.)}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="add-xml-base"/>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="add-xml-base"/>
<xsl:apply-templates mode="stripNS"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="stripNS">
<xsl:choose>
<xsl:when test="self::ng:* or self::db:*">
<xsl:element name="{local-name(.)}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="db:info" mode="stripNS">
<xsl:variable name="info">
<xsl:choose>
<xsl:when test="parent::db:article
|parent::db:appendix
|parent::db:bibliography
|parent::db:book
|parent::db:chapter
|parent::db:glossary
|parent::db:index
|parent::db:part
|parent::db:preface
|parent::db:refentry
|parent::db:reference
|parent::db:refsect1
|parent::db:refsect2
|parent::db:refsect3
|parent::db:refsection
|parent::db:refsynopsisdiv
|parent::db:sect1
|parent::db:sect2
|parent::db:sect3
|parent::db:sect4
|parent::db:sect5
|parent::db:section
|parent::db:setindex
|parent::db:set
|parent::db:slides
|parent::db:sidebar">
<xsl:value-of select="local-name(parent::*)"/>
<xsl:text>info</xsl:text>
</xsl:when>
<xsl:when test="parent::db:audioobject
|parent::db:imageobject
|parent::db:inlinemediaobject
|parent::db:mediaobject
|parent::db:mediaobjectco
|parent::db:textobject
|parent::db:videoobject">
<xsl:text>objectinfo</xsl:text>
</xsl:when>
<xsl:otherwise>blockinfo</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$info}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
<xsl:if test="(not(../db:title) and not(../ng:title))
and ($info = 'prefaceinfo'
or $info = 'chapterinfo'
or $info = 'sectioninfo'
or $info = 'sect1info'
or $info = 'sect2info'
or $info = 'sect3info'
or $info = 'sect4info'
or $info = 'sect5info'
or $info = 'refsectioninfo'
or $info = 'refsect1info'
or $info = 'refsect2info'
or $info = 'refsect3info'
or $info = 'blockinfo'
or $info = 'appendixinfo')">
<xsl:apply-templates select="db:title|ng:title" mode="stripNS"/>
</xsl:if>
</xsl:template>
<xsl:template match="ng:tag|db:tag" mode="stripNS">
<xsl:choose>
<xsl:when test="@xlink:href">
<ulink url="{@xlink:href}">
<sgmltag>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(local-name(.) = 'href')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</sgmltag>
</ulink>
</xsl:when>
<xsl:otherwise>
<sgmltag>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</sgmltag>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="db:link[@xlink:href]" mode="stripNS">
<ulink url="{@xlink:href}">
<xsl:if test="@role">
<xsl:attribute name="role">
<xsl:value-of select="@role"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</ulink>
</xsl:template>
<xsl:template match="db:citetitle[@xlink:href]" mode="stripNS">
<ulink url="{@xlink:href}">
<citetitle>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(local-name(.) = 'href')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</citetitle>
</ulink>
</xsl:template>
<xsl:template match="db:citetitle[@linkend]" mode="stripNS">
<citetitle>
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(name(.) = 'linkend')
and not(local-name(.) = 'href')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="stripNS"/>
</citetitle>
</xsl:template>
<xsl:template match="db:alt" mode="stripNS"/>
<xsl:template match="ng:textdata|db:textdata
|ng:imagedata|db:imagedata
|ng:videodata|db:videodata
|ng:audiodata|db:audiodata" mode="stripNS">
<xsl:element name="{local-name(.)}">
<xsl:copy-of select="@*[not(name(.) = 'xml:id')
and not(name(.) = 'version')
and not(name(.) = 'entityref')]"/>
<xsl:if test="@xml:id">
<xsl:attribute name="id">
<xsl:value-of select="@xml:id"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="@entityref">
<xsl:attribute name="fileref">
<xsl:value-of select="unparsed-entity-uri(@entityref)"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:apply-templates mode="stripNS"/>
</xsl:element>
</xsl:template>
<xsl:template name="add-xml-base">
<xsl:if test="not(@xml:base)">
<xsl:variable name="base">
<xsl:choose>
<xsl:when test="function-available('saxon:systemId')">
<xsl:value-of select="saxon:systemId()"/>
</xsl:when>
<xsl:when test="function-available('NodeInfo:systemId')">
<xsl:value-of select="NodeInfo:systemId()"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>WARNING: cannot add @xml:base to node </xsl:text>
<xsl:text>set root element. </xsl:text>
<xsl:text>Relative paths may not work.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- debug
<xsl:message>base is <xsl:value-of select="$base"/></xsl:message>
-->
<xsl:if test="$base != ''">
<xsl:attribute name="xml:base">
<xsl:call-template name="systemIdToBaseURI">
<xsl:with-param name="systemId">
<!-- file: seems to confuse some processors. -->
<xsl:choose>
<!-- however, windows paths must use file:///c:/path -->
<xsl:when test="starts-with($base, 'file:///') and
substring($base, 10, 1) = ':'">
<xsl:value-of select="$base"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file:/')
and substring($base, 8, 1) = ':'">
<xsl:value-of select="concat('file:///',
substring-after($base,'file:/'))"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file:///')">
<xsl:value-of select="substring-after($base,'file://')"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file://')">
<xsl:value-of select="substring-after($base,'file:/')"/>
</xsl:when>
<xsl:when test="starts-with($base, 'file:/')">
<xsl:value-of select="substring-after($base,'file:')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$base"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template name="systemIdToBaseURI">
<xsl:param name="systemId" select="''"/>
<xsl:if test="contains($systemId,'/')">
<xsl:value-of select="substring-before($systemId,'/')"/>
<xsl:text>/</xsl:text>
<xsl:call-template name="systemIdToBaseURI">
<xsl:with-param name="systemId"
select="substring-after($systemId,'/')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="comment()|processing-instruction()|text()" mode="stripNS">
<xsl:copy/>
</xsl:template>
<xsl:template match="/" priority="-1">
<!-- need a local version of this variable because this module imported many places-->
<xsl:variable name="local.exsl.node.set.available">
<xsl:choose>
<xsl:when exsl:foo="" xmlns:exsl="http://exslt.org/common"
test="function-available('exsl:node-set') or
contains(system-property('xsl:vendor'),
'Apache Software Foundation')">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$local.exsl.node.set.available != 0
and (*/self::ng:* or */self::db:*)">
<xsl:message>
<xsl:text>Stripping namespace from DocBook 5 document. </xsl:text>
<xsl:text>It is suggested to use namespaced version of the stylesheets </xsl:text>
<xsl:text>available in distribution file 'docbook-xsl-ns' </xsl:text>
<xsl:text>at //http://sourceforge.net/projects/docbook/files/</xsl:text>
<xsl:text> which does not require namespace stripping step.</xsl:text>
</xsl:message>
<xsl:variable name="nons">
<xsl:apply-templates mode="stripNS"/>
</xsl:variable>
<xsl:message>Processing stripped document.</xsl:message>
<xsl:apply-templates select="exsl:node-set($nons)"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,180 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: subtitles.xsl 9286 2012-04-19 10: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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- subtitle markup -->
<doc:mode mode="subtitle.markup" xmlns="">
<refpurpose>Provides access to element subtitles</refpurpose>
<refdescription id="subtitle.markup-desc">
<para>Processing an element in the
<literal role="mode">subtitle.markup</literal> mode produces the
subtitle of the element.
</para>
</refdescription>
</doc:mode>
<xsl:template match="*" mode="subtitle.markup">
<xsl:param name="verbose" select="1"/>
<xsl:if test="$verbose != 0">
<xsl:message>
<xsl:text>Request for subtitle of unexpected element: </xsl:text>
<xsl:value-of select="local-name(.)"/>
</xsl:message>
<xsl:text>???SUBTITLE???</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="subtitle" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="set" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(setinfo/subtitle|info/subtitle|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="book" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(bookinfo/subtitle|info/subtitle|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="part" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(partinfo/subtitle
|docinfo/subtitle
|info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="preface|chapter|appendix" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(docinfo/subtitle
|info/subtitle
|prefaceinfo/subtitle
|chapterinfo/subtitle
|appendixinfo/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="article" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(artheader/subtitle
|articleinfo/subtitle
|info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="dedication|colophon" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(subtitle|info/subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="reference" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(referenceinfo/subtitle
|docinfo/subtitle
|info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="qandaset" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(blockinfo/subtitle|info/subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="refentry" mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(refentryinfo/subtitle
|info/subtitle
|docinfo/subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="section
|sect1|sect2|sect3|sect4|sect5
|refsect1|refsect2|refsect3
|topic
|simplesect"
mode="subtitle.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:param name="verbose" select="1"/>
<xsl:apply-templates select="(info/subtitle
|sectioninfo/subtitle
|sect1info/subtitle
|sect2info/subtitle
|sect3info/subtitle
|sect4info/subtitle
|sect5info/subtitle
|refsect1info/subtitle
|refsect2info/subtitle
|refsect3info/subtitle
|subtitle)[1]"
mode="subtitle.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>

514
build/xsl/common/table.xsl Normal file
View File

@ -0,0 +1,514 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version="1.0">
<!-- ********************************************************************
$Id: table.xsl 8392 2009-04-01 08:47:55Z 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 name="blank.spans">
<xsl:param name="cols" select="1"/>
<xsl:if test="$cols &gt; 0">
<xsl:text>0:</xsl:text>
<xsl:call-template name="blank.spans">
<xsl:with-param name="cols" select="$cols - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="calculate.following.spans">
<xsl:param name="colspan" select="1"/>
<xsl:param name="spans" select="''"/>
<xsl:choose>
<xsl:when test="$colspan &gt; 0">
<xsl:call-template name="calculate.following.spans">
<xsl:with-param name="colspan" select="$colspan - 1"/>
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$spans"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="finaltd">
<xsl:param name="spans"/>
<xsl:param name="col" select="0"/>
<xsl:if test="$spans != ''">
<xsl:choose>
<xsl:when test="starts-with($spans,'0:')">
<xsl:call-template name="empty.table.cell">
<xsl:with-param name="colnum" select="$col"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<xsl:call-template name="finaltd">
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
<xsl:with-param name="col" select="$col+1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="sfinaltd">
<xsl:param name="spans"/>
<xsl:if test="$spans != ''">
<xsl:choose>
<xsl:when test="starts-with($spans,'0:')">0:</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($spans,':')-1"/>
<xsl:text>:</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="sfinaltd">
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="entry.colnum">
<xsl:param name="entry" select="."/>
<xsl:choose>
<xsl:when test="$entry/@spanname">
<xsl:variable name="spanname" select="$entry/@spanname"/>
<xsl:variable name="spanspec"
select="($entry/ancestor::tgroup/spanspec[@spanname=$spanname]
|$entry/ancestor::entrytbl/spanspec[@spanname=$spanname])[last()]"/>
<xsl:variable name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$spanspec/@namest]
|$entry/ancestor::entrytbl/colspec[@colname=$spanspec/@namest])[last()]"/>
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec" select="$colspec"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$entry/@colname">
<xsl:variable name="colname" select="$entry/@colname"/>
<xsl:variable name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$colname]
|$entry/ancestor::entrytbl/colspec[@colname=$colname])[last()]"/>
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec" select="$colspec"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$entry/@namest">
<xsl:variable name="namest" select="$entry/@namest"/>
<xsl:variable name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$namest]
|$entry/ancestor::entrytbl/colspec[@colname=$namest])[last()]"/>
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec" select="$colspec"/>
</xsl:call-template>
</xsl:when>
<!-- no idea, return 0 -->
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:template>
<doc:template name="entry.colnum" xmlns="">
<refpurpose>Determine the column number in which a given entry occurs</refpurpose>
<refdescription id="entry.colnum-desc">
<para>If an <tag>entry</tag> has a
<tag class="attribute">colname</tag> or
<tag class="attribute">namest</tag> attribute, this template
will determine the number of the column in which the entry should occur.
For other <tag>entry</tag>s, nothing is returned.</para>
</refdescription>
<refparameter id="entry.colnum-params">
<variablelist>
<varlistentry><term>entry</term>
<listitem>
<para>The <tag>entry</tag>-element which is to be tested.</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
<refreturn id="entry.colnum-returns">
<para>This template returns the column number if it can be determined,
or 0 (the empty string)</para>
</refreturn>
</doc:template>
<xsl:template name="colspec.colnum">
<xsl:param name="colspec" select="."/>
<xsl:choose>
<xsl:when test="$colspec/@colnum">
<xsl:value-of select="$colspec/@colnum"/>
</xsl:when>
<xsl:when test="$colspec/preceding-sibling::colspec">
<xsl:variable name="prec.colspec.colnum">
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec"
select="$colspec/preceding-sibling::colspec[1]"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$prec.colspec.colnum + 1"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="calculate.colspan">
<xsl:param name="entry" select="."/>
<xsl:variable name="spanname" select="$entry/@spanname"/>
<xsl:variable name="spanspec"
select="($entry/ancestor::tgroup/spanspec[@spanname=$spanname]
|$entry/ancestor::entrytbl/spanspec[@spanname=$spanname])[last()]"/>
<xsl:variable name="namest">
<xsl:choose>
<xsl:when test="@spanname">
<xsl:value-of select="$spanspec/@namest"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$entry/@namest"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nameend">
<xsl:choose>
<xsl:when test="@spanname">
<xsl:value-of select="$spanspec/@nameend"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$entry/@nameend"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="scol">
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$namest]
|$entry/ancestor::entrytbl/colspec[@colname=$namest])[last()]"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="ecol">
<xsl:call-template name="colspec.colnum">
<xsl:with-param name="colspec"
select="($entry/ancestor::tgroup/colspec[@colname=$nameend]
|$entry/ancestor::entrytbl/colspec[@colname=$nameend])[last()]"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$namest != '' and $nameend != ''">
<xsl:choose>
<xsl:when test="number($ecol) &gt;= number($scol)">
<xsl:value-of select="number($ecol) - number($scol) + 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number($scol) - number($ecol) + 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="calculate.rowsep">
<xsl:param name="entry" select="."/>
<xsl:param name="colnum" select="0"/>
<xsl:call-template name="inherited.table.attribute">
<xsl:with-param name="entry" select="$entry"/>
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="'rowsep'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="calculate.colsep">
<xsl:param name="entry" select="."/>
<xsl:param name="colnum" select="0"/>
<xsl:call-template name="inherited.table.attribute">
<xsl:with-param name="entry" select="$entry"/>
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="'colsep'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="inherited.table.attribute">
<xsl:param name="entry" select="."/>
<xsl:param name="row" select="$entry/ancestor-or-self::row[1]"/>
<xsl:param name="colnum" select="0"/>
<xsl:param name="attribute" select="'colsep'"/>
<xsl:variable name="tgroup" select="$row/parent::*/parent::tgroup[1]"/>
<xsl:variable name="tbody" select="$row/parent::*[1]"/>
<xsl:variable name="table" select="($tgroup/ancestor::table
|$tgroup/ancestor::informaltable
|$entry/ancestor::entrytbl)[last()]"/>
<xsl:variable name="entry.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$entry"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="row.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$row"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="span.value">
<xsl:if test="$entry/@spanname">
<xsl:variable name="spanname" select="$entry/@spanname"/>
<xsl:variable name="spanspec"
select="$tgroup/spanspec[@spanname=$spanname]"/>
<xsl:variable name="span.colspec"
select="$tgroup/colspec[@colname=$spanspec/@namest]"/>
<xsl:variable name="spanspec.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$spanspec"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="scolspec.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$span.colspec"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$spanspec.value != ''">
<xsl:value-of select="$spanspec.value"/>
</xsl:when>
<xsl:when test="$scolspec.value != ''">
<xsl:value-of select="$scolspec.value"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="namest.value">
<xsl:if test="$entry/@namest">
<xsl:variable name="namest" select="$entry/@namest"/>
<xsl:variable name="colspec"
select="$tgroup/colspec[@colname=$namest]"/>
<xsl:variable name="inner.namest.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$colspec"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$inner.namest.value">
<xsl:value-of select="$inner.namest.value"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:variable name="tgroup.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$tgroup"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="tbody.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$tbody"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="table.value">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$table"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="default.value">
<!-- This section used to say that rowsep and colsep have defaults based -->
<!-- on the frame setting. Further reflection and closer examination of the -->
<!-- CALS spec reveals I was mistaken. The default is "1" for rowsep and colsep. -->
<!-- For everything else, the default is the tgroup value -->
<xsl:choose>
<xsl:when test="$tgroup.value != ''">
<xsl:value-of select="$tgroup.value"/>
</xsl:when>
<xsl:when test="$attribute = 'rowsep'">1</xsl:when>
<xsl:when test="$attribute = 'colsep'">1</xsl:when>
<xsl:otherwise><!-- empty --></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="calc.colvalue">
<xsl:if test="$colnum &gt; 0">
<xsl:call-template name="colnum.colspec">
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$entry.value != ''">
<xsl:value-of select="$entry.value"/>
</xsl:when>
<xsl:when test="$row.value != ''">
<xsl:value-of select="$row.value"/>
</xsl:when>
<xsl:when test="$span.value != ''">
<xsl:value-of select="$span.value"/>
</xsl:when>
<xsl:when test="$namest.value != ''">
<xsl:value-of select="$namest.value"/>
</xsl:when>
<xsl:when test="$calc.colvalue != ''">
<xsl:value-of select="$calc.colvalue"/>
</xsl:when>
<xsl:when test="$tbody.value != ''">
<xsl:value-of select="$tbody.value"/>
</xsl:when>
<xsl:when test="$tgroup.value != ''">
<xsl:value-of select="$tgroup.value"/>
</xsl:when>
<xsl:when test="$table.value != ''">
<xsl:value-of select="$table.value"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default.value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="colnum.colspec">
<xsl:param name="colnum" select="0"/>
<xsl:param name="attribute" select="'colname'"/>
<xsl:param name="colspec.ancestor"
select="(ancestor::tgroup|ancestor::entrytbl)
[position() = last()]"/>
<xsl:param name="colspecs" select="$colspec.ancestor/colspec"/>
<xsl:param name="count" select="1"/>
<xsl:choose>
<xsl:when test="not($colspecs) or $count &gt; $colnum">
<!-- nop -->
</xsl:when>
<xsl:when test="$colspecs[1]/@colnum">
<xsl:choose>
<xsl:when test="$colspecs[1]/@colnum = $colnum">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$colspecs[1]"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="colnum.colspec">
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="$attribute"/>
<xsl:with-param name="colspecs"
select="$colspecs[position()&gt;1]"/>
<xsl:with-param name="count"
select="$colspecs[1]/@colnum+1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$count = $colnum">
<xsl:call-template name="get-attribute">
<xsl:with-param name="element" select="$colspecs[1]"/>
<xsl:with-param name="attribute" select="$attribute"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="colnum.colspec">
<xsl:with-param name="colnum" select="$colnum"/>
<xsl:with-param name="attribute" select="$attribute"/>
<xsl:with-param name="colspecs"
select="$colspecs[position()&gt;1]"/>
<xsl:with-param name="count" select="$count+1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="get-attribute">
<xsl:param name="element" select="."/>
<xsl:param name="attribute" select="''"/>
<xsl:for-each select="$element/@*">
<xsl:if test="local-name(.) = $attribute">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="consume-row">
<xsl:param name="spans"/>
<xsl:if test="contains($spans,':')">
<xsl:value-of select="substring-before($spans,':') - 1"/>
<xsl:text>:</xsl:text>
<xsl:call-template name="consume-row">
<xsl:with-param name="spans" select="substring-after($spans,':')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Returns the table style for the context element -->
<xsl:template name="tabstyle">
<xsl:param name="node" select="."/>
<xsl:variable name="tgroup" select="$node/tgroup[1] |
$node/ancestor-or-self::tgroup[1]"/>
<xsl:variable name="table"
select="($node/ancestor-or-self::table |
$node/ancestor-or-self::informaltable)[last()]"/>
<xsl:variable name="tabstyle">
<xsl:choose>
<xsl:when test="$table/@tabstyle != ''">
<xsl:value-of select="normalize-space($table/@tabstyle)"/>
</xsl:when>
<xsl:when test="$tgroup/@tgroupstyle != ''">
<xsl:value-of select="normalize-space($tgroup/@tgroupstyle)"/>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$tabstyle"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,337 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="doc exsl"
version='1.0'>
<!-- ********************************************************************
$Id: targets.xsl 9286 2012-04-19 10: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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- cross reference target collection -->
<doc:mode mode="collect.targets" xmlns="">
<refpurpose>Collects information for potential cross reference targets</refpurpose>
<refdescription id="collect.targets-desc">
<para>Processing the root element in the
<literal role="mode">collect.targets</literal> mode produces
a set of target database elements that can be used by
the olink mechanism to resolve external cross references.
The collection process is controlled by the <literal>
collect.xref.targets</literal> parameter, which can be
<literal>yes</literal> to collect targets and process
the document for output, <literal>only</literal> to
only collect the targets, and <literal>no</literal>
(default) to not collect the targets and only process the document.
</para>
<para>
A <literal>targets.filename</literal> parameter must be
specified to receive the output if
<literal>collect.xref.targets</literal> is
set to <literal>yes</literal> so as to
redirect the target data to a file separate from the
document output.
</para>
</refdescription>
</doc:mode>
<!-- ============================================================ -->
<xsl:template match="*" mode="collect.targets">
<xsl:choose>
<xsl:when test="$collect.xref.targets = 'yes' and $targets.filename = ''">
<xsl:message>
Must specify a $targets.filename parameter when
$collect.xref.targets is set to 'yes'.
The xref targets were not collected.
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$targets.filename">
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$targets.filename"/>
<xsl:with-param name="method" select="'xml'"/>
<xsl:with-param name="encoding" select="'utf-8'"/>
<xsl:with-param name="omit-xml-declaration" select="'yes'"/>
<xsl:with-param name="doctype-public" select="''"/>
<xsl:with-param name="doctype-system" select="''"/>
<xsl:with-param name="indent" select="'no'"/>
<xsl:with-param name="quiet" select="0"/>
<xsl:with-param name="content">
<xsl:apply-templates select="." mode="olink.mode"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- Else write to standard output -->
<xsl:apply-templates select="." mode="olink.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="olink.href.target">
<xsl:param name="nd" select="."/>
<xsl:value-of select="$olink.base.uri"/>
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$nd"/>
<xsl:with-param name="context" select="NOTANODE"/>
</xsl:call-template>
</xsl:template>
<!-- Templates for extracting cross reference information
from a document for use in an xref database.
-->
<xsl:template name="attrs">
<xsl:param name="nd" select="."/>
<xsl:attribute name="element">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:call-template name="olink.href.target">
<xsl:with-param name="nd" select="$nd"/>
</xsl:call-template>
</xsl:attribute>
<xsl:variable name="num">
<xsl:apply-templates select="$nd" mode="label.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:if test="$num">
<xsl:attribute name="number">
<xsl:value-of select="$num"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$nd/@id">
<xsl:attribute name="targetptr">
<xsl:value-of select="$nd/@id"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$nd/@xml:id">
<xsl:attribute name="targetptr">
<xsl:value-of select="$nd/@xml:id"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:if test="$nd/@lang">
<xsl:attribute name="lang">
<xsl:value-of select="$nd/@lang"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="div">
<xsl:param name="nd" select="."/>
<div>
<xsl:call-template name="attrs">
<xsl:with-param name="nd" select="$nd"/>
</xsl:call-template>
<ttl>
<xsl:apply-templates select="$nd" mode="title.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</ttl>
<xreftext>
<xsl:choose>
<xsl:when test="$nd/@xreflabel">
<xsl:call-template name="xref.xreflabel">
<xsl:with-param name="target" select="$nd"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$nd" mode="xref-to">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xreftext>
<xsl:apply-templates mode="olink.mode"/>
</div>
</xsl:template>
<xsl:template name="obj">
<xsl:param name="nd" select="."/>
<obj>
<xsl:call-template name="attrs">
<xsl:with-param name="nd" select="$nd"/>
</xsl:call-template>
<ttl>
<xsl:apply-templates select="$nd" mode="title.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</ttl>
<xreftext>
<xsl:choose>
<xsl:when test="$nd/@xreflabel">
<xsl:call-template name="xref.xreflabel">
<xsl:with-param name="target" select="$nd"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$nd" mode="xref-to">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xreftext>
</obj>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()"
mode="olink.mode">
<!-- nop -->
</xsl:template>
<!--
<xsl:template match="*" mode="olink.mode">
</xsl:template>
-->
<xsl:template match="set" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="book" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="preface|chapter|appendix" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="part|reference" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="article" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="topic" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="bibliography|bibliodiv" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="biblioentry|bibliomixed" mode="olink.mode">
<xsl:call-template name="obj"/>
</xsl:template>
<xsl:template match="refentry" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="section|sect1|sect2|sect3|sect4|sect5" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="refsection|refsect1|refsect2|refsect3" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<xsl:template match="figure|example|table" mode="olink.mode">
<xsl:call-template name="obj"/>
<xsl:apply-templates mode="olink.mode"/>
</xsl:template>
<xsl:template match="equation[title or info/title]" mode="olink.mode">
<xsl:call-template name="obj"/>
</xsl:template>
<xsl:template match="qandaset|qandaentry" mode="olink.mode">
<xsl:call-template name="div"/>
</xsl:template>
<!-- handle an glossary collection -->
<xsl:template match="glossary[@role='auto']" mode="olink.mode" priority="2">
<xsl:variable name="collection" select="document($glossary.collection, .)"/>
<xsl:if test="$glossary.collection = ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary </xsl:text>
<xsl:text>without a glossary.collection file.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="not($collection) and $glossary.collection != ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
<xsl:text>open glossary.collection file '</xsl:text>
<xsl:value-of select="$glossary.collection"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="$exsl.node.set.available != 0">
<xsl:variable name="auto.glossary">
<xsl:apply-templates select="." mode="assemble.auto.glossary"/>
</xsl:variable>
<xsl:variable name="auto.glossary.nodeset" select="exsl:node-set($auto.glossary)"/>
<xsl:apply-templates select="$auto.glossary.nodeset/*" mode="olink.mode"/>
</xsl:if>
</xsl:template>
<!-- construct a glossary in memory -->
<xsl:template match="glossary" mode="assemble.auto.glossary">
<xsl:copy>
<xsl:copy-of select="@*[not(local-name() = 'role')]"/>
<xsl:apply-templates select="node()" mode="assemble.auto.glossary"/>
<xsl:call-template name="select.glossentries"/>
</xsl:copy>
</xsl:template>
<xsl:template name="select.glossentries">
<xsl:param name="collection" select="document($glossary.collection, .)"/>
<xsl:param name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
<xsl:for-each select="$collection//glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="glossentry" mode="assemble.auto.glossary">
<!-- skip the dummy entries -->
</xsl:template>
<xsl:template match="*" mode="assemble.auto.glossary">
<!-- pass through any titles and intro stuff -->
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="*" mode="olink.mode">
<xsl:if test="@id or @xml:id">
<xsl:call-template name="obj"/>
</xsl:if>
<xsl:apply-templates mode="olink.mode"/>
</xsl:template>
</xsl:stylesheet>

807
build/xsl/common/titles.xsl Normal file
View File

@ -0,0 +1,807 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: titles.xsl 9286 2012-04-19 10: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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- title markup -->
<doc:mode mode="title.markup" xmlns="">
<refpurpose>Provides access to element titles</refpurpose>
<refdescription id="title.markup-desc">
<para>Processing an element in the
<literal role="mode">title.markup</literal> mode produces the
title of the element. This does not include the label.
</para>
</refdescription>
</doc:mode>
<xsl:template match="*" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<!-- * FIXME: this should handle other *info elements as well -->
<!-- * but this is good enough for now. -->
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="local-name(.) = 'partintro'">
<!-- partintro's don't have titles, use the parent (part or reference)
title instead. -->
<xsl:apply-templates select="parent::*" mode="title.markup"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$verbose != 0">
<xsl:message>
<xsl:text>Request for title of element with no title: </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:choose>
<xsl:when test="@id">
<xsl:text> (id="</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>")</xsl:text>
</xsl:when>
<xsl:when test="@xml:id">
<xsl:text> (xml:id="</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>")</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:message>
</xsl:if>
<xsl:text>???TITLE???</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="title" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- only occurs in HTML Tables! -->
<xsl:template match="caption" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="set" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(setinfo/title|info/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="book" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(bookinfo/title|info/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="part" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(partinfo/title|info/title|docinfo/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="preface|chapter|appendix" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<!--
<xsl:message>
<xsl:value-of select="local-name(.)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$allow-anchors"/>
</xsl:message>
-->
<xsl:variable name="title" select="(docinfo/title
|info/title
|prefaceinfo/title
|chapterinfo/title
|appendixinfo/title
|title)[1]"/>
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="dedication" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Dedication'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="acknowledgements" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Acknowledgements'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="colophon" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Colophon'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="article" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(artheader/title
|articleinfo/title
|info/title
|title)[1]"/>
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="reference" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(referenceinfo/title|docinfo/title|info/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="refentry" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="refmeta" select=".//refmeta"/>
<xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
<xsl:variable name="refnamediv" select=".//refnamediv"/>
<xsl:variable name="refname" select="$refnamediv//refname"/>
<xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$refentrytitle">
<xsl:apply-templates select="$refentrytitle[1]" mode="title.markup"/>
</xsl:when>
<xsl:when test="$refdesc">
<xsl:apply-templates select="$refdesc" mode="title.markup"/>
</xsl:when>
<xsl:when test="$refname">
<xsl:apply-templates select="$refname[1]" mode="title.markup"/>
</xsl:when>
<xsl:otherwise>REFENTRY WITHOUT TITLE???</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:copy-of select="$title"/>
</xsl:template>
<xsl:template match="refentrytitle|refname|refdescriptor" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section
|sect1|sect2|sect3|sect4|sect5
|refsect1|refsect2|refsect3|refsection
|topic
|simplesect"
mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(info/title
|sectioninfo/title
|sect1info/title
|sect2info/title
|sect3info/title
|sect4info/title
|sect5info/title
|refsect1info/title
|refsect2info/title
|refsect3info/title
|refsectioninfo/title
|title)[1]"/>
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="bridgehead" mode="title.markup">
<xsl:apply-templates mode="title.markup"/>
</xsl:template>
<xsl:template match="refsynopsisdiv" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefSynopsisDiv'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="bibliography" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(bibliographyinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Bibliography'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="glossary" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(glossaryinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.element.name">
<xsl:with-param name="element.name" select="local-name(.)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="glossdiv" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:message>ERROR: glossdiv missing its required title</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="glossentry" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="glossterm" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="glossterm|firstterm" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="index" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(indexinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Index'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="setindex" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(setindexinfo/title|info/title|title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'SetIndex'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="figure|example|equation" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="table" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title|caption)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="procedure" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="task" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="sidebar" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:apply-templates select="(info/title|sidebarinfo/title|title)[1]"
mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="abstract" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Abstract'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="caution|tip|warning|important|note" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(title|info/title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="local-name(.)='note'">Note</xsl:when>
<xsl:when test="local-name(.)='important'">Important</xsl:when>
<xsl:when test="local-name(.)='caution'">Caution</xsl:when>
<xsl:when test="local-name(.)='warning'">Warning</xsl:when>
<xsl:when test="local-name(.)='tip'">Tip</xsl:when>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="question" mode="title.markup">
<!-- questions don't have titles -->
<xsl:text>Question</xsl:text>
</xsl:template>
<xsl:template match="answer" mode="title.markup">
<!-- answers don't have titles -->
<xsl:text>Answer</xsl:text>
</xsl:template>
<xsl:template match="qandaentry" mode="title.markup">
<!-- qandaentrys are represented by the first question in them -->
<xsl:text>Question</xsl:text>
</xsl:template>
<xsl:template match="qandaset" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:variable name="title" select="(info/title|
blockinfo/title|
title)[1]"/>
<xsl:choose>
<xsl:when test="$title">
<xsl:apply-templates select="$title" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'QandASet'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="legalnotice" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="title|info/title">
<xsl:apply-templates select="(title|info/title)[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'LegalNotice'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:choose>
<xsl:when test="titleabbrev">
<xsl:apply-templates select="titleabbrev[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="info/titleabbrev">
<xsl:apply-templates select="info/titleabbrev[1]" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="book|preface|chapter|appendix" mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="titleabbrev" select="(docinfo/titleabbrev
|bookinfo/titleabbrev
|info/titleabbrev
|prefaceinfo/titleabbrev
|chapterinfo/titleabbrev
|appendixinfo/titleabbrev
|titleabbrev)[1]"/>
<xsl:choose>
<xsl:when test="$titleabbrev">
<xsl:apply-templates select="$titleabbrev" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="article" mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="titleabbrev" select="(artheader/titleabbrev
|articleinfo/titleabbrev
|info/titleabbrev
|titleabbrev)[1]"/>
<xsl:choose>
<xsl:when test="$titleabbrev">
<xsl:apply-templates select="$titleabbrev" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section
|sect1|sect2|sect3|sect4|sect5
|refsect1|refsect2|refsect3
|topic
|simplesect"
mode="titleabbrev.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:param name="verbose" select="1"/>
<xsl:variable name="titleabbrev" select="(info/titleabbrev
|sectioninfo/titleabbrev
|sect1info/titleabbrev
|sect2info/titleabbrev
|sect3info/titleabbrev
|sect4info/titleabbrev
|sect5info/titleabbrev
|refsect1info/titleabbrev
|refsect2info/titleabbrev
|refsect3info/titleabbrev
|titleabbrev)[1]"/>
<xsl:choose>
<xsl:when test="$titleabbrev">
<xsl:apply-templates select="$titleabbrev" mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
<xsl:with-param name="verbose" select="$verbose"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="titleabbrev" mode="title.markup">
<xsl:param name="allow-anchors" select="0"/>
<xsl:choose>
<xsl:when test="$allow-anchors != 0">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="no.anchor.mode">
<!-- Switch to normal mode if no links -->
<xsl:choose>
<xsl:when test="descendant-or-self::footnote or
descendant-or-self::anchor or
descendant-or-self::ulink or
descendant-or-self::link or
descendant-or-self::olink or
descendant-or-self::xref or
descendant-or-self::indexterm or
(ancestor::title and (@id or @xml:id))">
<xsl:apply-templates mode="no.anchor.mode"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="footnote" mode="no.anchor.mode">
<!-- nop, suppressed -->
</xsl:template>
<xsl:template match="anchor" mode="no.anchor.mode">
<!-- nop, suppressed -->
</xsl:template>
<xsl:template match="ulink" mode="no.anchor.mode">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="link" mode="no.anchor.mode">
<xsl:choose>
<xsl:when test="count(child::node()) &gt; 0">
<!-- If it has content, use it -->
<xsl:apply-templates/>
</xsl:when>
<!-- look for an endterm -->
<xsl:when test="@endterm">
<xsl:variable name="etargets" select="key('id',@endterm)"/>
<xsl:variable name="etarget" select="$etargets[1]"/>
<xsl:choose>
<xsl:when test="count($etarget) = 0">
<xsl:message>
<xsl:value-of select="count($etargets)"/>
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
<xsl:value-of select="@endterm"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$etarget" mode="endterm"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="olink" mode="no.anchor.mode">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="indexterm" mode="no.anchor.mode">
<!-- nop, suppressed -->
</xsl:template>
<xsl:template match="xref" mode="no.anchor.mode">
<xsl:variable name="targets" select="key('id',@linkend)|key('id',substring-after(@xlink:href,'#'))"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:variable name="refelem" select="local-name($target)"/>
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="@linkend"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="count($target) = 0">
<xsl:message>
<xsl:text>XRef to nonexistent id: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:value-of select="@xlink:href"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
<xsl:when test="@endterm">
<xsl:variable name="etargets" select="key('id',@endterm)"/>
<xsl:variable name="etarget" select="$etargets[1]"/>
<xsl:choose>
<xsl:when test="count($etarget) = 0">
<xsl:message>
<xsl:value-of select="count($etargets)"/>
<xsl:text>Endterm points to nonexistent ID: </xsl:text>
<xsl:value-of select="@endterm"/>
</xsl:message>
<xsl:text>???</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$etarget" mode="endterm"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$target/@xreflabel">
<xsl:call-template name="xref.xreflabel">
<xsl:with-param name="target" select="$target"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<!-- Watch out for the case when there is a xref or link inside
a title. See bugs #1811721 and #1838136. -->
<xsl:when test="not(ancestor::*[@id = $target/@id] or ancestor::*[@xml:id = $target/@xml:id])">
<xsl:apply-templates select="$target" mode="xref-to-prefix"/>
<xsl:apply-templates select="$target" mode="xref-to">
<xsl:with-param name="referrer" select="."/>
<xsl:with-param name="xrefstyle">
<xsl:choose>
<xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
<xsl:value-of select="@role"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@xrefstyle"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
<xsl:apply-templates select="$target" mode="xref-to-suffix"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
</xsl:stylesheet>

View File

@ -0,0 +1,290 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:saxon="http://icl.com/saxon"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="doc dyn saxon"
version='1.0'>
<!-- ********************************************************************
$Id: utility.xsl 7101 2007-07-20 15:32:12Z xmldoc $
********************************************************************
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.
******************************************************************** -->
<doc:reference xmlns="" xml:id="utility">
<info>
<title>Common » Utility Template Reference</title>
<releaseinfo role="meta">
$Id: utility.xsl 7101 2007-07-20 15:32:12Z xmldoc $
</releaseinfo>
</info>
<!-- * yes, partintro is a valid child of a reference... -->
<partintro xml:id="partintro">
<title>Introduction</title>
<para>This is technical reference documentation for the
miscellaneous utility templates in the DocBook XSL
Stylesheets.</para>
<note>
<para>These templates are defined in a separate file from the set
of “common” templates because some of the common templates
reference DocBook XSL stylesheet parameters, requiring the
entire set of parameters to be imported/included in any
stylesheet that imports/includes the common templates.</para>
<para>The utility templates dont import or include any DocBook
XSL stylesheet parameters, so the utility templates can be used
without importing the whole set of parameters.</para>
</note>
<para>This is not intended to be user documentation. It is
provided for developers writing customization layers for the
stylesheets.</para>
</partintro>
</doc:reference>
<!-- ====================================================================== -->
<doc:template name="log.message" xmlns="">
<refpurpose>Logs/emits formatted notes and warnings</refpurpose>
<refdescription id="log.message-desc">
<para>The <function>log.message</function> template is a utility
template for logging/emitting formatted messages&#xa0; that is,
notes and warnings, along with a given log “level” and an
identifier for the “source” that the message relates to.</para>
</refdescription>
<refparameter id="log.message-params">
<variablelist>
<varlistentry><term>level</term>
<listitem>
<para>Text to log/emit in the message-level field to
indicate the message level
(<literal>Note</literal> or
<literal>Warning</literal>)</para>
</listitem>
</varlistentry>
<varlistentry><term>source</term>
<listitem>
<para>Text to log/emit in the source field to identify the
“source” to which the notification/warning relates.
This can be any arbitrary string, but because the
message lacks line and column numbers to identify the
exact part of the source document to which it
relates, the intention is that the value you pass
into the <literal>source</literal> parameter should
give the user some way to identify the portion of
their source document on which to take potentially
take action in response to the log message (for
example, to edit, change, or add content).</para>
<para>So the <literal>source</literal> value should be,
for example, an ID, book/chapter/article title, title
of some formal object, or even a string giving an
XPath expression.</para>
</listitem>
</varlistentry>
<varlistentry><term>context-desc</term>
<listitem>
<para>Text to log/emit in the context-description field to
describe the context for the message.</para>
</listitem>
</varlistentry>
<varlistentry><term>context-desc-field-length</term>
<listitem>
<para>Specifies length of the context-description field
(in characters); default is 12</para>
<para>If the text specified by the
<literal>context-desc</literal> parameter is longer
than the number of characters specified in
<literal>context-desc-field-length</literal>, it is
truncated to <literal>context-desc-field-length</literal>
(12 characters by default).</para>
<para>If the specified text is shorter than
<literal>context-desc-field-length</literal>,
it is right-padded out to
<literal>context-desc-field-length</literal> (12 by
default).</para>
<para>If no value has been specified for the
<literal>context-desc</literal> parameter, the field is
left empty and the text of the log message begins with
the value of the <literal>message</literal>
parameter.</para>
</listitem>
</varlistentry>
<varlistentry><term>message</term>
<listitem>
<para>Text to log/emit in the actual message field</para>
</listitem>
</varlistentry>
<varlistentry><term>message-field-length</term>
<listitem>
<para>Specifies length of the message
field (in characters); default is 45</para>
</listitem>
</varlistentry>
</variablelist>
</refparameter>
<refreturn id="log.message-returns">
<para>Outputs a message (generally, to standard error).</para></refreturn>
</doc:template>
<xsl:template name="log.message">
<xsl:param name="level"/>
<xsl:param name="source"/>
<xsl:param name="context-desc"/>
<xsl:param name="context-desc-field-length">12</xsl:param>
<xsl:param name="context-desc-padded">
<xsl:if test="not($context-desc = '')">
<xsl:call-template name="pad-string">
<xsl:with-param name="leftRight">right</xsl:with-param>
<xsl:with-param name="padVar"
select="substring($context-desc, 1, $context-desc-field-length)"/>
<xsl:with-param name="length" select="$context-desc-field-length"/>
</xsl:call-template>
</xsl:if>
</xsl:param>
<xsl:param name="message"/>
<xsl:param name="message-field-length" select="45"/>
<xsl:param name="message-padded">
<xsl:variable name="spaces-for-blank-level">
<!-- * if the level field is blank, we'll need to pad out -->
<!-- * the message field with spaces to compensate -->
<xsl:choose>
<xsl:when test="$level = ''">
<xsl:value-of select="4 + 2"/>
<!-- * 4 = hard-coded length of comment text ("Note" or "Warn") -->
<!-- * + 2 = length of colon-plus-space separator ": " -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="spaces-for-blank-context-desc">
<!-- * if the context-description field is blank, we'll need -->
<!-- * to pad out the message field with spaces to compensate -->
<xsl:choose>
<xsl:when test="$context-desc = ''">
<xsl:value-of select="$context-desc-field-length + 2"/>
<!-- * + 2 = length of colon-plus-space separator ": " -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="extra-spaces"
select="$spaces-for-blank-level + $spaces-for-blank-context-desc"/>
<xsl:call-template name="pad-string">
<xsl:with-param name="leftRight">right</xsl:with-param>
<xsl:with-param name="padVar"
select="substring($message, 1, ($message-field-length + $extra-spaces))"/>
<xsl:with-param name="length"
select="$message-field-length + $extra-spaces"/>
</xsl:call-template>
</xsl:param>
<!-- * emit the actual log message -->
<xsl:message>
<xsl:if test="not($level = '')">
<xsl:value-of select="$level"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:if test="not($context-desc = '')">
<xsl:value-of select="$context-desc-padded"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:value-of select="$message-padded"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$source"/>
</xsl:message>
</xsl:template>
<!-- ===================================== -->
<doc:template name="get.doc.title" xmlns="">
<refpurpose>Gets a title from the current document</refpurpose>
<refdescription id="get.doc.title-desc">
<para>The <function>get.doc.title</function> template is a
utility template for returning the first title found in the
current document.</para>
</refdescription>
<refreturn id="get.doc.title-returns">
<para>Returns a string containing some identifying title for the
current document .</para></refreturn>
</doc:template>
<xsl:template name="get.doc.title">
<xsl:choose>
<xsl:when test="//*[local-name() = 'title'
or local-name() = 'refname']">
<xsl:value-of select="//*[local-name() = 'title'
or local-name() = 'refname'][1]"/>
</xsl:when>
<xsl:when test="substring(local-name(*[1]),
string-length(local-name(*[1])-3) = 'info')
and *[1]/*[local-name() = 'title']">
<xsl:value-of select="*[1]/*[local-name() = 'title'][1]"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ===================================== -->
<doc:template name="pad-string" xmlns="">
<refpurpose>Right-pads or left-pads a string out to a certain length</refpurpose>
<refdescription id="pad-string-desc">
<para>This function takes string <parameter>padVar</parameter> and
pads it out in the direction <parameter>rightLeft</parameter> to
the string-length <parameter>length</parameter>, using string
<parameter>padChar</parameter> (a space character by default) as
the padding string (note that <parameter>padChar</parameter> can
be a string; it is not limited to just being a single
character).</para>
<note>
<para>This function began as a copy of Nate Austin's
<function>prepend-pad</function> function in the <link
xlink:href="http://www.dpawson.co.uk/xsl/sect2/padding.html" >Padding
Content</link> section of Dave Pawson's <link
xlink:href="http://www.dpawson.co.uk/xsl/index.html" >XSLT
FAQ</link>.</para>
</note>
</refdescription>
<refreturn id="pad-string-returns">
<para>Returns a (padded) string.</para></refreturn>
</doc:template>
<xsl:template name="pad-string">
<!-- * recursive template to right/left pad the value with -->
<!-- * whatever padChar is passed in -->
<xsl:param name="padChar" select="' '"/>
<xsl:param name="leftRight">left</xsl:param>
<xsl:param name="padVar"/>
<xsl:param name="length"/>
<xsl:choose>
<xsl:when test="string-length($padVar) &lt; $length">
<xsl:call-template name="pad-string">
<xsl:with-param name="padChar" select="$padChar"/>
<xsl:with-param name="leftRight" select="$leftRight"/>
<xsl:with-param name="padVar">
<xsl:choose>
<!-- * determine whether string should be -->
<!-- * right- or left-padded -->
<xsl:when test="$leftRight = 'left'">
<!-- * pad it to left -->
<xsl:value-of select="concat($padChar,$padVar)"/>
</xsl:when>
<xsl:otherwise>
<!-- * otherwise, right-pad the string -->
<xsl:value-of select="concat($padVar,$padChar)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="substring($padVar,string-length($padVar) - $length + 1)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

139
build/xsl/html/admon.xsl Normal file
View File

@ -0,0 +1,139 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: admon.xsl 9352 2012-05-12 23:17:11Z 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="*" mode="admon.graphic.width">
<xsl:param name="node" select="."/>
<xsl:text>25</xsl:text>
</xsl:template>
<xsl:template match="note|important|warning|caution|tip">
<xsl:choose>
<xsl:when test="$admon.graphics != 0">
<xsl:call-template name="graphical.admonition"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="nongraphical.admonition"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="admon.graphic">
<xsl:param name="node" select="."/>
<xsl:value-of select="$admon.graphics.path"/>
<xsl:choose>
<xsl:when test="local-name($node)='note'">note</xsl:when>
<xsl:when test="local-name($node)='warning'">warning</xsl:when>
<xsl:when test="local-name($node)='caution'">caution</xsl:when>
<xsl:when test="local-name($node)='tip'">tip</xsl:when>
<xsl:when test="local-name($node)='important'">important</xsl:when>
<xsl:otherwise>note</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$admon.graphics.extension"/>
</xsl:template>
<xsl:template name="graphical.admonition">
<xsl:variable name="admon.type">
<xsl:choose>
<xsl:when test="local-name(.)='note'">Note</xsl:when>
<xsl:when test="local-name(.)='warning'">Warning</xsl:when>
<xsl:when test="local-name(.)='caution'">Caution</xsl:when>
<xsl:when test="local-name(.)='tip'">Tip</xsl:when>
<xsl:when test="local-name(.)='important'">Important</xsl:when>
<xsl:otherwise>Note</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="alt">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="$admon.type"/>
</xsl:call-template>
</xsl:variable>
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:if test="$admon.style != ''">
<xsl:attribute name="style">
<xsl:value-of select="$admon.style"/>
</xsl:attribute>
</xsl:if>
<table border="{$table.border.off}">
<!-- omit summary attribute in html5 output -->
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">
<xsl:value-of select="$admon.type"/>
<xsl:if test="title|info/title">
<xsl:text>: </xsl:text>
<xsl:value-of select="(title|info/title)[1]"/>
</xsl:if>
</xsl:attribute>
</xsl:if>
<tr>
<td rowspan="2" align="center" valign="top">
<xsl:attribute name="width">
<xsl:apply-templates select="." mode="admon.graphic.width"/>
</xsl:attribute>
<img alt="[{$alt}]">
<xsl:attribute name="src">
<xsl:call-template name="admon.graphic"/>
</xsl:attribute>
</img>
</td>
<th align="{$direction.align.start}">
<xsl:call-template name="anchor"/>
<xsl:if test="$admon.textlabel != 0 or title or info/title">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:if>
</th>
</tr>
<tr>
<td align="{$direction.align.start}" valign="top">
<xsl:apply-templates/>
</td>
</tr>
</table>
</div>
</xsl:template>
<xsl:template name="nongraphical.admonition">
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute"/>
<xsl:if test="$admon.style">
<xsl:attribute name="style">
<xsl:value-of select="$admon.style"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$admon.textlabel != 0 or title or info/title">
<h3 class="title">
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="." mode="object.title.markup"/>
</h3>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="note/title"></xsl:template>
<xsl:template match="important/title"></xsl:template>
<xsl:template match="warning/title"></xsl:template>
<xsl:template match="caution/title"></xsl:template>
<xsl:template match="tip/title"></xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,169 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<xsl:template name="add.annotation.links">
<xsl:param name="scripts" select="normalize-space($annotation.js)"/>
<xsl:choose>
<xsl:when test="contains($scripts, ' ')">
<script type="text/javascript" src="{substring-before($scripts, ' ')}"/>
<xsl:call-template name="add.annotation.links">
<xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<script type="text/javascript" src="{$scripts}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="annotation"/>
<xsl:template name="apply-annotations">
<xsl:if test="$annotation.support != 0">
<!-- do any annotations apply to the context node? -->
<xsl:variable name="id" select="(@id|@xml:id)[1]"/>
<xsl:variable name="aids">
<xsl:for-each select="//annotation">
<xsl:if test="@annotates=$id
or starts-with(@annotates, concat($id, ' '))
or contains(@annotates, concat(' ', $id, ' '))
or substring(@annotates, string-length(@annotates)-3)
= concat(' ', $id)">
<xsl:value-of select="generate-id()"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="normalize-space(@annotations) != ''">
<xsl:call-template name="annotations-pointed-to">
<xsl:with-param name="annotations"
select="normalize-space(@annotations)"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:if test="$aids != ''">
<xsl:call-template name="apply-annotations-by-gid">
<xsl:with-param name="gids" select="normalize-space($aids)"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template name="annotations-pointed-to">
<xsl:param name="annotations"/>
<xsl:choose>
<xsl:when test="contains($annotations, ' ')">
<xsl:variable name='a'
select="key('id', substring-before($annotations, ' '))"/>
<xsl:if test="$a">
<xsl:value-of select="generate-id($a)"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:call-template name="annotations-pointed-to">
<xsl:with-param name="annotations"
select="substring-after($annotations, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:variable name='a'
select="key('id', $annotations)"/>
<xsl:if test="$a">
<xsl:value-of select="generate-id($a)"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="apply-annotations-by-gid">
<xsl:param name="gids"/>
<xsl:choose>
<xsl:when test="contains($gids, ' ')">
<xsl:variable name="gid" select="substring-before($gids, ' ')"/>
<xsl:apply-templates select="key('gid', $gid)"
mode="annotation-inline"/>
<xsl:call-template name="apply-annotations-by-gid">
<xsl:with-param name="gids"
select="substring-after($gids, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="key('gid', $gids)"
mode="annotation-inline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="annotation" mode="annotation-inline">
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="title">
<xsl:value-of select="title"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>[Annotation #</xsl:text>
<xsl:number count="annotation" level="any" format="1"/>
<xsl:text>]</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="#annot-{generate-id(.)}" title="{$title}"
name="anch-{generate-id(.)}" id="anch-{generate-id(.)}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:attribute name="onClick">
<xsl:text>popup_</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text>.showPopup('anch-</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text>'); return false;</xsl:text>
</xsl:attribute>
<img src="{$annotation.graphic.open}" border="0" alt="{$title}"/>
</a>
</xsl:template>
<xsl:template match="annotation" mode="annotation-popup">
<div class="annotation-nocss">
<p>
<a name="annot-{generate-id(.)}"/>
<xsl:text>Annotation #</xsl:text>
<xsl:number count="annotation" level="any" format="1"/>
<xsl:text>:</xsl:text>
</p>
</div>
<div id="popup-{generate-id(.)}" class="annotation-popup">
<xsl:if test="string-length(.) &gt; 300">
<xsl:attribute name="style">width:400px</xsl:attribute>
</xsl:if>
<xsl:call-template name="annotation-title"/>
<div class="annotation-body">
<xsl:apply-templates select="*[local-name(.) != 'title']"/>
</div>
<div class="annotation-close">
<a href="#" onclick="popup_{generate-id(.)}.hidePopup();return false;">
<xsl:apply-templates select="." mode="class.attribute"/>
<img src="{$annotation.graphic.close}" alt="X" border="0"/>
</a>
</div>
</div>
</xsl:template>
<xsl:template name="annotation-title">
<div class="annotation-title">
<xsl:choose>
<xsl:when test="title">
<xsl:apply-templates select="title/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>Annotation</xsl:text>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
</xsl:stylesheet>

797
build/xsl/html/autoidx.xsl Normal file
View File

@ -0,0 +1,797 @@
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % common.entities SYSTEM "../common/entities.ent">
%common.entities;
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
extension-element-prefixes="exslt"
exclude-result-prefixes="exslt"
version="1.0">
<!-- ********************************************************************
$Id: autoidx.xsl 9376 2012-05-24 18:32:40Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- The "basic" method derived from Jeni Tennison's work. -->
<!-- The "kosek" method contributed by Jirka Kosek. -->
<!-- The "kimber" method contributed by Eliot Kimber of Innodata Isogen. -->
<xsl:variable name="kimber.imported" select="0"/>
<xsl:variable name="kosek.imported" select="0"/>
<xsl:key name="letter"
match="indexterm"
use="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
<xsl:key name="primary"
match="indexterm"
use="&primary;"/>
<xsl:key name="secondary"
match="indexterm"
use="concat(&primary;, &sep;, &secondary;)"/>
<xsl:key name="tertiary"
match="indexterm"
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
<xsl:key name="endofrange"
match="indexterm[@class='endofrange']"
use="@startref"/>
<xsl:key name="primary-section"
match="indexterm[not(secondary) and not(see)]"
use="concat(&primary;, &sep;, &section.id;)"/>
<xsl:key name="secondary-section"
match="indexterm[not(tertiary) and not(see)]"
use="concat(&primary;, &sep;, &secondary;, &sep;, &section.id;)"/>
<xsl:key name="tertiary-section"
match="indexterm[not(see)]"
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, &section.id;)"/>
<xsl:key name="see-also"
match="indexterm[seealso]"
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso)"/>
<xsl:key name="see"
match="indexterm[see]"
use="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see)"/>
<xsl:key name="sections" match="*[@id or @xml:id]" use="@id|@xml:id"/>
<xsl:template name="generate-index">
<xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
<xsl:choose>
<xsl:when test="$index.method = 'kosek'">
<xsl:call-template name="generate-kosek-index">
<xsl:with-param name="scope" select="$scope"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$index.method = 'kimber'">
<xsl:call-template name="generate-kimber-index">
<xsl:with-param name="scope" select="$scope"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="generate-basic-index">
<xsl:with-param name="scope" select="$scope"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="generate-basic-index">
<xsl:param name="scope" select="NOTANODE"/>
<xsl:variable name="role">
<xsl:if test="$index.on.role != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="type">
<xsl:if test="$index.on.type != 0">
<xsl:value-of select="@type"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="terms"
select="//indexterm
[count(.|key('letter',
translate(substring(&primary;, 1, 1),
&lowercase;,
&uppercase;))
[&scope;][1]) = 1
and not(@class = 'endofrange')]"/>
<xsl:variable name="alphabetical"
select="$terms[contains(concat(&lowercase;, &uppercase;),
substring(&primary;, 1, 1))]"/>
<xsl:variable name="others" select="$terms[not(contains(concat(&lowercase;,
&uppercase;),
substring(&primary;, 1, 1)))]"/>
<div class="index">
<xsl:if test="$others">
<xsl:choose>
<xsl:when test="normalize-space($type) != '' and
$others[@type = $type][count(.|key('primary', &primary;)[&scope;][1]) = 1]">
<div class="indexdiv">
<h3>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'index symbols'"/>
</xsl:call-template>
</h3>
<dl>
<xsl:apply-templates select="$others[count(.|key('primary', &primary;)[&scope;][1]) = 1]"
mode="index-symbol-div">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</dl>
</div>
</xsl:when>
<xsl:when test="normalize-space($type) != ''">
<!-- Output nothing, as there isn't a match for $other using this $type -->
</xsl:when>
<xsl:otherwise>
<div class="indexdiv">
<h3>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'index symbols'"/>
</xsl:call-template>
</h3>
<dl>
<xsl:apply-templates select="$others[count(.|key('primary',
&primary;)[&scope;][1]) = 1]"
mode="index-symbol-div">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</dl>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:apply-templates select="$alphabetical[count(.|key('letter',
translate(substring(&primary;, 1, 1),
&lowercase;,&uppercase;))[&scope;][1]) = 1]"
mode="index-div-basic">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</div>
</xsl:template>
<!-- This template not used if html/autoidx-kosek.xsl is imported -->
<xsl:template name="generate-kosek-index">
<xsl:param name="scope" select="NOTANODE"/>
<xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
<xsl:if test="contains($vendor, 'libxslt')">
<xsl:message terminate="yes">
<xsl:text>ERROR: the 'kosek' index method does not </xsl:text>
<xsl:text>work with the xsltproc XSLT processor.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="$exsl.node.set.available = 0">
<xsl:message terminate="yes">
<xsl:text>ERROR: the 'kosek' index method requires the </xsl:text>
<xsl:text>exslt:node-set() function. Use a processor that </xsl:text>
<xsl:text>has it, or use a different index method.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="$kosek.imported = 0">
<xsl:message terminate="yes">
<xsl:text>ERROR: the 'kosek' index method requires the&#xA;</xsl:text>
<xsl:text>kosek index extensions be imported:&#xA;</xsl:text>
<xsl:text> xsl:import href="html/autoidx-kosek.xsl"</xsl:text>
</xsl:message>
</xsl:if>
</xsl:template>
<!-- This template not used if html/autoidx-kimber.xsl is imported -->
<xsl:template name="generate-kimber-index">
<xsl:param name="scope" select="NOTANODE"/>
<xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
<xsl:if test="not(contains($vendor, 'SAXON '))">
<xsl:message terminate="yes">
<xsl:text>ERROR: the 'kimber' index method requires the </xsl:text>
<xsl:text>Saxon version 6 or 8 XSLT processor.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="$kimber.imported = 0">
<xsl:message terminate="yes">
<xsl:text>ERROR: the 'kimber' index method requires the&#xA;</xsl:text>
<xsl:text>kimber index extensions be imported:&#xA;</xsl:text>
<xsl:text> xsl:import href="html/autoidx-kimber.xsl"</xsl:text>
</xsl:message>
</xsl:if>
</xsl:template>
<xsl:template match="indexterm" mode="index-div-basic">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:variable name="key"
select="translate(substring(&primary;, 1, 1),
&lowercase;,&uppercase;)"/>
<xsl:if test="key('letter', $key)[&scope;]
[count(.|key('primary', &primary;)[&scope;][1]) = 1]">
<div class="indexdiv">
<xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
<h3>
<xsl:value-of select="translate($key, &lowercase;, &uppercase;)"/>
</h3>
</xsl:if>
<dl>
<xsl:apply-templates select="key('letter', $key)[&scope;]
[count(.|key('primary', &primary;)
[&scope;][1])=1]"
mode="index-primary">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</dl>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="indexterm" mode="index-symbol-div">
<xsl:param name="scope" select="/"/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:variable name="key" select="translate(substring(&primary;, 1, 1),
&lowercase;,&uppercase;)"/>
<xsl:apply-templates select="key('letter', $key)
[&scope;][count(.|key('primary', &primary;)[1]) = 1]"
mode="index-primary">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="indexterm" mode="index-primary">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:variable name="key" select="&primary;"/>
<xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
<dt>
<xsl:for-each select="$refs/primary">
<xsl:if test="@id or @xml:id">
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<a name="{(@id|@xml:id)[1]}"/>
</xsl:when>
<xsl:otherwise>
<span>
<xsl:call-template name="id.attribute"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="primary"/>
<xsl:choose>
<xsl:when test="$index.links.to.section = 1">
<xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('primary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
<xsl:apply-templates select="." mode="reference">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$refs[not(see)
and not(secondary)][&scope;]">
<xsl:apply-templates select="." mode="reference">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$refs[not(secondary)]/*[self::see]">
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &sep;, &sep;, see))[&scope;][1])]"
mode="index-see">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</xsl:if>
</dt>
<xsl:choose>
<xsl:when test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
<dd>
<dl>
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &sep;, &sep;, seealso))[&scope;][1])]"
mode="index-seealso">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
<xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
mode="index-secondary">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</dl>
</dd>
</xsl:when>
<!-- HTML5 requires dd for each dt -->
<xsl:when test="$div.element = 'section'">
<dd></dd>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="indexterm" mode="index-secondary">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
<xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
<dt>
<xsl:for-each select="$refs/secondary">
<xsl:if test="@id or @xml:id">
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<a name="{(@id|@xml:id)[1]}"/>
</xsl:when>
<xsl:otherwise>
<span>
<xsl:call-template name="id.attribute"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="secondary"/>
<xsl:choose>
<xsl:when test="$index.links.to.section = 1">
<xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('secondary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
<xsl:apply-templates select="." mode="reference">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$refs[not(see)
and not(tertiary)][&scope;]">
<xsl:apply-templates select="." mode="reference">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$refs[not(tertiary)]/*[self::see]">
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, see))[&scope;][1])]"
mode="index-see">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</xsl:if>
</dt>
<xsl:choose>
<xsl:when test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
<dd>
<dl>
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &sep;, seealso))[&scope;][1])]"
mode="index-seealso">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
<xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &sep;, &tertiary;))[&scope;][1]) = 1]"
mode="index-tertiary">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(&tertiary;, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</dl>
</dd>
</xsl:when>
<!-- HTML5 requires dd for each dt -->
<xsl:when test="$div.element = 'section'">
<dd></dd>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="indexterm" mode="index-tertiary">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;)"/>
<xsl:variable name="refs" select="key('tertiary', $key)[&scope;]"/>
<dt>
<xsl:for-each select="$refs/tertiary">
<xsl:if test="@id or @xml:id">
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<a name="{(@id|@xml:id)[1]}"/>
</xsl:when>
<xsl:otherwise>
<span>
<xsl:call-template name="id.attribute"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="tertiary"/>
<xsl:choose>
<xsl:when test="$index.links.to.section = 1">
<xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('tertiary-section', concat($key, &sep;, &section.id;))[&scope;][1])]">
<xsl:apply-templates select="." mode="reference">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$refs[not(see)][&scope;]">
<xsl:apply-templates select="." mode="reference">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$refs/see">
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, see))[&scope;][1])]"
mode="index-see">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(see, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</xsl:if>
</dt>
<xsl:choose>
<xsl:when test="$refs/seealso">
<dd>
<dl>
<xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(&primary;, &sep;, &secondary;, &sep;, &tertiary;, &sep;, seealso))[&scope;][1])]"
mode="index-seealso">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:sort select="translate(seealso, &lowercase;, &uppercase;)"/>
</xsl:apply-templates>
</dl>
</dd>
</xsl:when>
<!-- HTML5 requires dd for each dt -->
<xsl:when test="$div.element = 'section'">
<dd></dd>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="indexterm" mode="reference">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:param name="position"/>
<xsl:param name="separator" select="''"/>
<xsl:variable name="term.separator">
<xsl:call-template name="index.separator">
<xsl:with-param name="key" select="'index.term.separator'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="number.separator">
<xsl:call-template name="index.separator">
<xsl:with-param name="key" select="'index.number.separator'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="range.separator">
<xsl:call-template name="index.separator">
<xsl:with-param name="key" select="'index.range.separator'"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$separator != ''">
<xsl:value-of select="$separator"/>
</xsl:when>
<xsl:when test="$position = 1">
<xsl:value-of select="$term.separator"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$number.separator"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="@zone and string(@zone)">
<xsl:call-template name="reference">
<xsl:with-param name="zones" select="normalize-space(@zone)"/>
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<a>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="&section;/titleabbrev and $index.prefer.titleabbrev != 0">
<xsl:apply-templates select="&section;" mode="titleabbrev.markup"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="&section;" mode="title.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="$index.links.to.section = 1">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="&section;"/>
<xsl:with-param name="context"
select="(//index[&scope;] | //setindex[&scope;])[1]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="."/>
<xsl:with-param name="context"
select="(//index[&scope;] | //setindex[&scope;])[1]"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="$title"/> <!-- text only -->
</a>
<xsl:variable name="id" select="(@id|@xml:id)[1]"/>
<xsl:if test="key('endofrange', $id)[&scope;]">
<xsl:apply-templates select="key('endofrange', $id)[&scope;][last()]"
mode="reference">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
<xsl:with-param name="separator" select="$range.separator"/>
</xsl:apply-templates>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="reference">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:param name="zones"/>
<xsl:choose>
<xsl:when test="contains($zones, ' ')">
<xsl:variable name="zone" select="substring-before($zones, ' ')"/>
<xsl:variable name="target" select="key('sections', $zone)"/>
<a>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute"/>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target[1]"/>
<xsl:with-param name="context" select="//index[&scope;][1]"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$target[1]" mode="index-title-content"/>
</a>
<xsl:text>, </xsl:text>
<xsl:call-template name="reference">
<xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="scope" select="$scope"/>
<xsl:with-param name="role" select="$role"/>
<xsl:with-param name="type" select="$type"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="zone" select="$zones"/>
<xsl:variable name="target" select="key('sections', $zone)"/>
<a>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute"/>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target[1]"/>
<xsl:with-param name="context" select="//index[&scope;][1]"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$target[1]" mode="index-title-content"/>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="indexterm" mode="index-see">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:text> (</xsl:text>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'see'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="see"/>
<xsl:text>)</xsl:text>
</xsl:template>
<xsl:template match="indexterm" mode="index-seealso">
<xsl:param name="scope" select="."/>
<xsl:param name="role" select="''"/>
<xsl:param name="type" select="''"/>
<xsl:for-each select="seealso">
<xsl:sort select="translate(., &lowercase;, &uppercase;)"/>
<dt>
<xsl:text>(</xsl:text>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'seealso'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
<xsl:text>)</xsl:text>
</dt>
<xsl:if test="$div.element = 'section'">
<dd></dd>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="*" mode="index-title-content">
<xsl:variable name="title">
<xsl:apply-templates select="&section;" mode="title.markup"/>
</xsl:variable>
<xsl:value-of select="$title"/>
</xsl:template>
<xsl:template name="index.separator">
<xsl:param name="key" select="''"/>
<xsl:param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:param>
<xsl:choose>
<xsl:when test="$key = 'index.term.separator'">
<xsl:choose>
<!-- Use the override if not blank -->
<xsl:when test="$index.term.separator != ''">
<xsl:copy-of select="$index.term.separator"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="context">index</xsl:with-param>
<xsl:with-param name="name">term-separator</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$key = 'index.number.separator'">
<xsl:choose>
<!-- Use the override if not blank -->
<xsl:when test="$index.number.separator != ''">
<xsl:copy-of select="$index.number.separator"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="context">index</xsl:with-param>
<xsl:with-param name="name">number-separator</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$key = 'index.range.separator'">
<xsl:choose>
<!-- Use the override if not blank -->
<xsl:when test="$index.range.separator != ''">
<xsl:copy-of select="$index.range.separator"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="context">index</xsl:with-param>
<xsl:with-param name="name">range-separator</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

726
build/xsl/html/autotoc.xsl Normal file
View File

@ -0,0 +1,726 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: autotoc.xsl 9295 2012-04-19 19:05:29Z 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:variable name="toc.listitem.type">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">dt</xsl:when>
<xsl:otherwise>li</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- this is just hack because dl and ul aren't completely isomorphic -->
<xsl:variable name="toc.dd.type">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">dd</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template name="make.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
<xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
<xsl:variable name="toc.title">
<xsl:if test="$toc.title.p">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="toc-title">
<xsl:call-template name="gentext">
<xsl:with-param name="key">TableofContents</xsl:with-param>
</xsl:call-template>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext">
<xsl:with-param name="key">TableofContents</xsl:with-param>
</xsl:call-template>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$manual.toc != ''">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="toc" select="document($manual.toc, .)"/>
<xsl:variable name="tocentry" select="$toc//tocentry[@linkend=$id]"/>
<xsl:if test="$tocentry and $tocentry/*">
<div class="toc">
<xsl:copy-of select="$toc.title"/>
<xsl:element name="{$toc.list.type}">
<xsl:call-template name="manual-toc">
<xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
</xsl:call-template>
</xsl:element>
</div>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$qanda.in.toc != 0">
<xsl:if test="$nodes.plus">
<div class="toc">
<xsl:copy-of select="$toc.title"/>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="$nodes.plus" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:element>
</div>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$nodes">
<div class="toc">
<xsl:copy-of select="$toc.title"/>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:element>
</div>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="make.lots">
<xsl:param name="toc.params" select="''"/>
<xsl:param name="toc"/>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:copy-of select="$toc"/>
</xsl:if>
<xsl:if test="contains($toc.params, 'figure')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'figure'"/>
<xsl:with-param name="nodes" select=".//figure"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'table')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'table'"/>
<xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'example')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'example'"/>
<xsl:with-param name="nodes" select=".//example"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'equation')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'equation'"/>
<xsl:with-param name="nodes" select=".//equation[title or info/title]"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="contains($toc.params, 'procedure')">
<xsl:call-template name="list.of.titles">
<xsl:with-param name="titles" select="'procedure'"/>
<xsl:with-param name="nodes" select=".//procedure[title]"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- ====================================================================== -->
<xsl:template name="set.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes" select="book|setindex|set"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="division.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes" select="part|reference
|preface|chapter|appendix
|article
|topic
|bibliography|glossary|index
|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="component.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes" select="section|sect1
|simplesect[$simplesect.in.toc != 0]
|topic
|refentry
|article|bibliography|glossary
|appendix|index
|bridgehead[not(@renderas)
and $bridgehead.in.toc != 0]
|.//bridgehead[@renderas='sect1'
and $bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="component.toc.separator">
<!-- Customize to output something between
component.toc and first output -->
</xsl:template>
<xsl:template name="section.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<xsl:call-template name="make.toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="toc.title.p" select="$toc.title.p"/>
<xsl:with-param name="nodes"
select="section|sect1|sect2|sect3|sect4|sect5|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="section.toc.separator">
<!-- Customize to output something between
section.toc and first output -->
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="subtoc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
<xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
<xsl:variable name="subtoc">
<xsl:element name="{$toc.list.type}">
<xsl:choose>
<xsl:when test="$qanda.in.toc != 0">
<xsl:apply-templates mode="toc" select="$nodes.plus">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="toc" select="$nodes">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:variable>
<xsl:variable name="depth">
<xsl:choose>
<xsl:when test="local-name(.) = 'section'">
<xsl:value-of select="count(ancestor::section) + 1"/>
</xsl:when>
<xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
<xsl:when test="local-name(.) = 'sect2'">2</xsl:when>
<xsl:when test="local-name(.) = 'sect3'">3</xsl:when>
<xsl:when test="local-name(.) = 'sect4'">4</xsl:when>
<xsl:when test="local-name(.) = 'sect5'">5</xsl:when>
<xsl:when test="local-name(.) = 'refsect1'">1</xsl:when>
<xsl:when test="local-name(.) = 'refsect2'">2</xsl:when>
<xsl:when test="local-name(.) = 'refsect3'">3</xsl:when>
<xsl:when test="local-name(.) = 'topic'">1</xsl:when>
<xsl:when test="local-name(.) = 'simplesect'">
<!-- sigh... -->
<xsl:choose>
<xsl:when test="local-name(..) = 'section'">
<xsl:value-of select="count(ancestor::section)"/>
</xsl:when>
<xsl:when test="local-name(..) = 'sect1'">2</xsl:when>
<xsl:when test="local-name(..) = 'sect2'">3</xsl:when>
<xsl:when test="local-name(..) = 'sect3'">4</xsl:when>
<xsl:when test="local-name(..) = 'sect4'">5</xsl:when>
<xsl:when test="local-name(..) = 'sect5'">6</xsl:when>
<xsl:when test="local-name(..) = 'topic'">2</xsl:when>
<xsl:when test="local-name(..) = 'refsect1'">2</xsl:when>
<xsl:when test="local-name(..) = 'refsect2'">3</xsl:when>
<xsl:when test="local-name(..) = 'refsect3'">4</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
<xsl:variable name="subtoc.list">
<xsl:choose>
<xsl:when test="$toc.dd.type = ''">
<xsl:copy-of select="$subtoc"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$toc.dd.type}">
<xsl:copy-of select="$subtoc"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$toc.listitem.type}">
<xsl:call-template name="toc.line">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
<xsl:if test="$toc.listitem.type = 'li' and
( (self::set or self::book or self::part) or
$toc.section.depth > $depth) and
( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
and $toc.max.depth > $depth.from.context">
<xsl:copy-of select="$subtoc.list"/>
</xsl:if>
</xsl:element>
<xsl:if test="$toc.listitem.type != 'li' and
( (self::set or self::book or self::part) or
$toc.section.depth > $depth) and
( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
and $toc.max.depth > $depth.from.context">
<xsl:copy-of select="$subtoc.list"/>
</xsl:if>
</xsl:template>
<xsl:template name="toc.line">
<xsl:param name="toc-context" select="."/>
<xsl:param name="depth" select="1"/>
<xsl:param name="depth.from.context" select="8"/>
<span>
<xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
<!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
<!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
<xsl:if test="$autotoc.label.in.hyperlink = 0">
<xsl:variable name="label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="context" select="$toc-context"/>
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label -->
<!-- * as part of the hyperlinked title -->
<xsl:if test="not($autotoc.label.in.hyperlink = 0)">
<xsl:variable name="label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
</xsl:if>
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</a>
</span>
</xsl:template>
<xsl:template match="book" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="part|reference
|preface|chapter|appendix
|article
|topic
|bibliography|glossary|index
|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="setindex" mode="toc">
<xsl:param name="toc-context" select="."/>
<!-- If the setindex tag is not empty, it should be it in the TOC -->
<xsl:if test="* or $generate.index != 0">
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="part|reference" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="appendix|chapter|article|topic
|index|glossary|bibliography
|preface|reference|refentry
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="preface|chapter|appendix|article|topic" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="section|sect1
|simplesect[$simplesect.in.toc != 0]
|topic
|refentry
|glossary|bibliography|index
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect1" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect2
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect2" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect3
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect3" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect4
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect4" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="sect5
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="sect5" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="simplesect" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="section" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="section|refentry
|simplesect[$simplesect.in.toc != 0]
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="topic" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="section|refentry
|simplesect[$simplesect.in.toc != 0]
|bridgehead[$bridgehead.in.toc != 0]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="bridgehead" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:if test="$bridgehead.in.toc != 0">
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="bibliography|glossary" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="index" mode="toc">
<xsl:param name="toc-context" select="."/>
<!-- If the index tag is not empty, it should be it in the TOC -->
<xsl:if test="* or $generate.index != 0">
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="refentry" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:variable name="refmeta" select=".//refmeta"/>
<xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
<xsl:variable name="refnamediv" select=".//refnamediv"/>
<xsl:variable name="refname" select="$refnamediv//refname"/>
<xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$refentrytitle">
<xsl:apply-templates select="$refentrytitle[1]"
mode="titleabbrev.markup"/>
</xsl:when>
<xsl:when test="$refdesc">
<xsl:apply-templates select="$refdesc"
mode="titleabbrev.markup"/>
</xsl:when>
<xsl:when test="$refname">
<xsl:apply-templates select="$refname[1]"
mode="titleabbrev.markup"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$toc.listitem.type}">
<span class='refentrytitle'>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:copy-of select="$title"/>
</a>
</span>
<span class='refpurpose'>
<xsl:if test="$annotate.toc != 0">
<!-- * DocBook 5 says inlinemediaobject (among other things) -->
<!-- * is allowed in refpurpose; so we need to run -->
<!-- * apply-templates on refpurpose here, instead of value-of -->
<xsl:apply-templates select="refnamediv/refpurpose" mode="no.anchor.mode"/>
</xsl:if>
</span>
</xsl:element>
</xsl:template>
<xsl:template match="title" mode="toc">
<xsl:param name="toc-context" select="."/>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select=".."/>
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template name="manual-toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="tocentry"/>
<!-- be careful, we don't want to change the current document to the other tree! -->
<xsl:if test="$tocentry">
<xsl:variable name="node" select="key('id', $tocentry/@linkend)"/>
<xsl:element name="{$toc.listitem.type}">
<xsl:variable name="label">
<xsl:apply-templates select="$node" mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$node"/>
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
</a>
</xsl:element>
<xsl:if test="$tocentry/*">
<xsl:element name="{$toc.list.type}">
<xsl:call-template name="manual-toc">
<xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
</xsl:call-template>
</xsl:element>
</xsl:if>
<xsl:if test="$tocentry/following-sibling::*">
<xsl:call-template name="manual-toc">
<xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="list.of.titles">
<xsl:param name="toc-context" select="."/>
<xsl:param name="titles" select="'table'"/>
<xsl:param name="nodes" select=".//table"/>
<xsl:if test="$nodes">
<div class="list-of-{$titles}s">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="toc-title">
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="$titles='table'">ListofTables</xsl:when>
<xsl:when test="$titles='figure'">ListofFigures</xsl:when>
<xsl:when test="$titles='equation'">ListofEquations</xsl:when>
<xsl:when test="$titles='example'">ListofExamples</xsl:when>
<xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
<xsl:otherwise>ListofUnknown</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
<xsl:when test="$titles='table'">ListofTables</xsl:when>
<xsl:when test="$titles='figure'">ListofFigures</xsl:when>
<xsl:when test="$titles='equation'">ListofEquations</xsl:when>
<xsl:when test="$titles='example'">ListofExamples</xsl:when>
<xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
<xsl:otherwise>ListofUnknown</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:element>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="figure|table|example|equation|procedure" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:element name="{$toc.listitem.type}">
<xsl:variable name="label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:copy-of select="$label"/>
<xsl:if test="$label != ''">
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</a>
</xsl:element>
</xsl:template>
<!-- Used only if qanda.in.toc parameter is non-zero -->
<xsl:template match="qandaset" mode="toc">
<xsl:param name="toc-context" select="."/>
<xsl:call-template name="subtoc">
<xsl:with-param name="toc-context" select="$toc-context"/>
<xsl:with-param name="nodes" select="qandadiv | qandaentry"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="qandadiv|qandaentry" mode="toc">
<xsl:apply-templates select="." mode="qandatoc.mode"/>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

1382
build/xsl/html/biblio.xsl Normal file

File diff suppressed because it is too large Load Diff

568
build/xsl/html/block.xsl Normal file
View File

@ -0,0 +1,568 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: block.xsl 9353 2012-05-12 23:24:54Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- What should we do about styling blockinfo? -->
<xsl:template match="blockinfo|info">
<!-- suppress -->
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="block.object">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="para">
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:if test="position() = 1 and parent::listitem">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="parent::listitem"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="paragraph">
<xsl:param name="class" select="''"/>
<xsl:param name="content"/>
<xsl:variable name="p">
<p>
<xsl:call-template name="id.attribute"/>
<xsl:choose>
<xsl:when test="$class != ''">
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="class" select="$class"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="class" select="''"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="$content"/>
</p>
</xsl:variable>
<xsl:choose>
<xsl:when test="$html.cleanup != 0">
<xsl:call-template name="unwrap.p">
<xsl:with-param name="p" select="$p"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$p"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="simpara">
<!-- see also listitem/simpara in lists.xsl -->
<p>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="locale.html.attributes"/>
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="@role"/>
</xsl:apply-templates>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="formalpara">
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Only use title from info -->
<xsl:template match="formalpara/info">
<xsl:apply-templates select="title"/>
</xsl:template>
<xsl:template match="formalpara/title|formalpara/info/title">
<xsl:variable name="titleStr">
<xsl:apply-templates/>
</xsl:variable>
<xsl:variable name="lastChar">
<xsl:if test="$titleStr != ''">
<xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="formalpara-title">
<xsl:copy-of select="$titleStr"/>
<xsl:if test="$lastChar != ''
and not(contains($runinhead.title.end.punct, $lastChar))">
<xsl:value-of select="$runinhead.default.title.end.punct"/>
</xsl:if>
<xsl:text>&#160;</xsl:text>
</span>
</xsl:when>
<xsl:otherwise>
<b>
<xsl:copy-of select="$titleStr"/>
<xsl:if test="$lastChar != ''
and not(contains($runinhead.title.end.punct, $lastChar))">
<xsl:value-of select="$runinhead.default.title.end.punct"/>
</xsl:if>
<xsl:text>&#160;</xsl:text>
</b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="formalpara/para">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="blockquote">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:choose>
<xsl:when test="attribution">
<table border="{$table.border.off}" class="blockquote">
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:text>width: 100%; cellspacing: 0; cellpadding: 0;</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">Block quote</xsl:attribute>
</xsl:if>
<tr>
<td width="10%" valign="top">&#160;</td>
<td width="80%" valign="top">
<xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
</td>
<td width="10%" valign="top">&#160;</td>
</tr>
<tr>
<td width="10%" valign="top">&#160;</td>
<td colspan="2" align="{$direction.align.end}" valign="top">
<xsl:text>--</xsl:text>
<xsl:apply-templates select="attribution"/>
</td>
</tr>
</table>
</xsl:when>
<xsl:otherwise>
<blockquote>
<xsl:call-template name="common.html.attributes"/>
<xsl:apply-templates/>
</blockquote>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template match="blockquote/title|blockquote/info/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="blockquote-title">
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="blockquote-title">
<p>
<b>
<xsl:apply-templates/>
</b>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Use an em dash per Chicago Manual of Style and https://sourceforge.net/tracker/index.php?func=detail&aid=2793878&group_id=21935&atid=373747 -->
<xsl:template match="epigraph">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
<xsl:if test="attribution">
<div class="attribution">
<span>&#x2014;<xsl:apply-templates select="attribution"/></span>
</div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="attribution">
<span>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="abstract|sidebar">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:call-template name="sidebar.titlepage"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="abstract/title|sidebar/title">
</xsl:template>
<xsl:template match="sidebar/sidebarinfo|sidebar/info"/>
<!-- ==================================================================== -->
<xsl:template match="msgset">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgentry">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="simplemsgentry">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msg">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msgmain">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgmain/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgmain-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<b><xsl:apply-templates/></b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgsub">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgsub/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgsub-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<b><xsl:apply-templates/></b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgrel">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msgrel/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<span class="msgrel-title">
<xsl:apply-templates/>
</span>
</xsl:when>
<xsl:otherwise>
<b><xsl:apply-templates/></b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgtext">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="msginfo">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msglevel">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msglevel">
<span class="msglevel-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgLevel'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgLevel'"/>
</xsl:call-template>
</b>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgorig">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgorig">
<span class="msgorig-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgOrig'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgOrig'"/>
</xsl:call-template>
</b>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgaud">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgaud">
<span class="msgaud-title">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgAud'"/>
</xsl:call-template>
</span>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'msgset'"/>
<xsl:with-param name="name" select="'MsgAud'"/>
</xsl:call-template>
</b>
<xsl:apply-templates/>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="msgexplan">
<xsl:call-template name="block.object"/>
</xsl:template>
<xsl:template match="msgexplan/title">
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<div class="msgexplan">
<span class="msgexplan-title">
<xsl:apply-templates/>
</span>
</div>
</xsl:when>
<xsl:otherwise>
<p>
<b>
<xsl:apply-templates/>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="revhistory">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<table>
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:text>border-style:solid; width:100%;</xsl:text>
</xsl:attribute>
</xsl:if>
<!-- include summary attribute if not HTML5 -->
<xsl:if test="$div.element != 'section'">
<xsl:attribute name="summary">
<xsl:call-template name="gentext">
<xsl:with-param name="key">revhistory</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
</xsl:if>
<tr>
<th align="{$direction.align.start}" valign="top" colspan="3">
<b>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RevHistory'"/>
</xsl:call-template>
</b>
</th>
</tr>
<xsl:apply-templates/>
</table>
</div>
</xsl:template>
<xsl:template match="revhistory/revision">
<xsl:variable name="revnumber" select="revnumber"/>
<xsl:variable name="revdate" select="date"/>
<xsl:variable name="revauthor" select="authorinitials|author"/>
<xsl:variable name="revremark" select="revremark|revdescription"/>
<tr>
<td align="{$direction.align.start}">
<xsl:if test="$revnumber">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Revision'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:apply-templates select="$revnumber"/>
</xsl:if>
</td>
<td align="{$direction.align.start}">
<xsl:apply-templates select="$revdate"/>
</td>
<xsl:choose>
<xsl:when test="count($revauthor)=0">
<td align="{$direction.align.start}">
<xsl:call-template name="dingbat">
<xsl:with-param name="dingbat">nbsp</xsl:with-param>
</xsl:call-template>
</td>
</xsl:when>
<xsl:otherwise>
<td align="{$direction.align.start}">
<xsl:for-each select="$revauthor">
<xsl:apply-templates select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</td>
</xsl:otherwise>
</xsl:choose>
</tr>
<xsl:if test="$revremark">
<tr>
<td align="{$direction.align.start}" colspan="3">
<xsl:apply-templates select="$revremark"/>
</td>
</tr>
</xsl:if>
</xsl:template>
<xsl:template match="revision/revnumber">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/date">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/authorinitials">
<xsl:text>, </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/authorinitials[1]" priority="2">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/revremark">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="revision/revdescription">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="ackno|acknowledgements[parent::article]">
<xsl:call-template name="block.object"/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="highlights">
<xsl:call-template name="block.object"/>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

222
build/xsl/html/callout.xsl Normal file
View File

@ -0,0 +1,222 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim"
xmlns:lxslt="http://xml.apache.org/xslt"
exclude-result-prefixes="sverb xverb lxslt"
version='1.0'>
<!-- ********************************************************************
$Id: callout.xsl 9305 2012-04-27 21:50:53Z 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.
******************************************************************** -->
<lxslt:component prefix="xverb"
functions="insertCallouts"/>
<xsl:template match="programlistingco|screenco">
<xsl:variable name="verbatim" select="programlisting|screen"/>
<xsl:choose>
<xsl:when test="$use.extensions != '0'
and $callouts.extension != '0'">
<xsl:variable name="rtf">
<xsl:apply-templates select="$verbatim">
<xsl:with-param name="suppress-numbers" select="'1'"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="rtf-with-callouts">
<xsl:choose>
<xsl:when test="function-available('sverb:insertCallouts')">
<xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
</xsl:when>
<xsl:when test="function-available('xverb:insertCallouts')">
<xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>No insertCallouts function is available.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$verbatim/@linenumbering = 'numbered'
and $linenumbering.extension != '0'">
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf-with-callouts"/>
<xsl:with-param name="pi.context"
select="programlisting|screen"/>
</xsl:call-template>
<xsl:apply-templates select="calloutlist"/>
</div>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:copy-of select="$rtf-with-callouts"/>
<xsl:apply-templates select="calloutlist"/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="areaspec|areaset|area">
</xsl:template>
<xsl:template match="areaset" mode="conumber">
<xsl:number count="area|areaset" format="1"/>
</xsl:template>
<xsl:template match="area" mode="conumber">
<xsl:number count="area|areaset" format="1"/>
</xsl:template>
<xsl:template match="co" name="co">
<!-- Support a single linkend in HTML -->
<xsl:variable name="targets" select="key('id', @linkends)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:choose>
<xsl:when test="$target">
<a>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<!-- force an id attribute here -->
<xsl:if test="@id or @xml:id">
<xsl:attribute name="name">
<xsl:value-of select="(@id|@xml:id)[1]"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="id.attribute"/>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="." mode="callout-bug"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$generate.id.attributes != 0">
<xsl:if test="@id or @xml:id">
<span>
<xsl:attribute name="id">
<xsl:value-of select="(@id|@xml:id)[1]"/>
</xsl:attribute>
</span>
</xsl:if>
</xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="." mode="callout-bug"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="coref">
<!-- tricky; this relies on the fact that we can process the "co" that's -->
<!-- "over there" as if it were "right here" -->
<xsl:variable name="co" select="key('id', @linkend)"/>
<xsl:choose>
<xsl:when test="not($co)">
<xsl:message>
<xsl:text>Error: coref link is broken: </xsl:text>
<xsl:value-of select="@linkend"/>
</xsl:message>
</xsl:when>
<xsl:when test="local-name($co) != 'co'">
<xsl:message>
<xsl:text>Error: coref doesn't point to a co: </xsl:text>
<xsl:value-of select="@linkend"/>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$co"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="co" mode="callout-bug">
<xsl:call-template name="callout-bug">
<xsl:with-param name="conum">
<xsl:number count="co"
level="any"
from="programlisting|screen|literallayout|synopsis"
format="1"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="callout-bug">
<xsl:param name="conum" select='1'/>
<xsl:choose>
<xsl:when test="$callout.graphics != 0
and $conum &lt;= $callout.graphics.number.limit">
<!-- Added span to make valid in XHTML 1 -->
<span><img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}"
alt="{$conum}" border="0"/></span>
</xsl:when>
<xsl:when test="$callout.unicode != 0
and $conum &lt;= $callout.unicode.number.limit">
<xsl:choose>
<xsl:when test="$callout.unicode.start.character = 10102">
<xsl:choose>
<xsl:when test="$conum = 1">&#10102;</xsl:when>
<xsl:when test="$conum = 2">&#10103;</xsl:when>
<xsl:when test="$conum = 3">&#10104;</xsl:when>
<xsl:when test="$conum = 4">&#10105;</xsl:when>
<xsl:when test="$conum = 5">&#10106;</xsl:when>
<xsl:when test="$conum = 6">&#10107;</xsl:when>
<xsl:when test="$conum = 7">&#10108;</xsl:when>
<xsl:when test="$conum = 8">&#10109;</xsl:when>
<xsl:when test="$conum = 9">&#10110;</xsl:when>
<xsl:when test="$conum = 10">&#10111;</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Don't know how to generate Unicode callouts </xsl:text>
<xsl:text>when $callout.unicode.start.character is </xsl:text>
<xsl:value-of select="$callout.unicode.start.character"/>
</xsl:message>
<xsl:text>(</xsl:text>
<xsl:value-of select="$conum"/>
<xsl:text>)</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:text>(</xsl:text>
<xsl:value-of select="$conum"/>
<xsl:text>)</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

452
build/xsl/html/chunker.xsl Normal file
View File

@ -0,0 +1,452 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
xmlns:exsl="http://exslt.org/common"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
version="1.0"
exclude-result-prefixes="saxon lxslt redirect exsl doc"
extension-element-prefixes="saxon redirect lxslt exsl">
<!-- ********************************************************************
$Id: chunker.xsl 9147 2011-11-12 00:05:44Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- This stylesheet works with XSLT implementations that support -->
<!-- exsl:document, saxon:output, or Xalan's redirect:write -->
<!-- Note: Only Saxon 6.4.2 or later is supported. -->
<xsl:param name="chunker.output.method" select="'html'"/>
<xsl:param name="chunker.output.encoding" select="'ISO-8859-1'"/>
<xsl:param name="chunker.output.indent" select="'no'"/>
<xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/>
<xsl:param name="chunker.output.standalone" select="'no'"/>
<xsl:param name="chunker.output.doctype-public" select="''"/>
<xsl:param name="chunker.output.doctype-system" select="''"/>
<xsl:param name="chunker.output.media-type" select="''"/>
<xsl:param name="chunker.output.cdata-section-elements" select="''"/>
<!-- Make sure base.dir has a trailing slash now -->
<xsl:param name="chunk.base.dir">
<xsl:choose>
<xsl:when test="string-length($base.dir) = 0"></xsl:when>
<!-- make sure to add trailing slash if omitted by user -->
<xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'">
<xsl:value-of select="$base.dir"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($base.dir, '/')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="saxon.character.representation" select="'entity;decimal'"/>
<!-- ==================================================================== -->
<xsl:template name="make-relative-filename">
<xsl:param name="base.dir" select="'./'"/>
<xsl:param name="base.name" select="''"/>
<xsl:choose>
<!-- put Saxon first to work around a bug in libxslt -->
<xsl:when test="element-available('saxon:output')">
<!-- Saxon doesn't make the chunks relative -->
<xsl:value-of select="concat($chunk.base.dir,$base.name)"/>
</xsl:when>
<xsl:when test="element-available('exsl:document')">
<!-- EXSL document does make the chunks relative, I think -->
<xsl:choose>
<xsl:when test="count(parent::*) = 0">
<xsl:value-of select="concat($chunk.base.dir,$base.name)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$base.name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="element-available('redirect:write')">
<!-- Xalan doesn't make the chunks relative -->
<xsl:value-of select="concat($chunk.base.dir,$base.name)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>Don't know how to chunk with </xsl:text>
<xsl:value-of select="system-property('xsl:vendor')"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="write.chunk">
<xsl:param name="filename" select="''"/>
<xsl:param name="quiet" select="$chunk.quietly"/>
<xsl:param name="suppress-context-node-name" select="0"/>
<xsl:param name="message-prolog"/>
<xsl:param name="message-epilog"/>
<xsl:param name="method" select="$chunker.output.method"/>
<xsl:param name="encoding" select="$chunker.output.encoding"/>
<xsl:param name="indent" select="$chunker.output.indent"/>
<xsl:param name="omit-xml-declaration"
select="$chunker.output.omit-xml-declaration"/>
<xsl:param name="standalone" select="$chunker.output.standalone"/>
<xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
<xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
<xsl:param name="media-type" select="$chunker.output.media-type"/>
<xsl:param name="cdata-section-elements"
select="$chunker.output.cdata-section-elements"/>
<xsl:param name="content"/>
<xsl:if test="$quiet = 0">
<xsl:message>
<xsl:if test="not($message-prolog = '')">
<xsl:value-of select="$message-prolog"/>
</xsl:if>
<xsl:text>Writing </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:if test="name(.) != '' and $suppress-context-node-name = 0">
<xsl:text> for </xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:if test="@id or @xml:id">
<xsl:text>(</xsl:text>
<xsl:value-of select="(@id|@xml:id)[1]"/>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="not($message-epilog = '')">
<xsl:value-of select="$message-epilog"/>
</xsl:if>
</xsl:message>
</xsl:if>
<xsl:choose>
<xsl:when test="element-available('exsl:document')">
<xsl:choose>
<!-- Handle the permutations ... -->
<xsl:when test="$media-type != ''">
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<exsl:document href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</exsl:document>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="element-available('saxon:output')">
<xsl:choose>
<!-- Handle the permutations ... -->
<xsl:when test="$media-type != ''">
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
media-type="{$media-type}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$doctype-public != '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public != '' and $doctype-system = ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-public="{$doctype-public}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:when test="$doctype-public = '' and $doctype-system != ''">
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
doctype-system="{$doctype-system}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:when>
<xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
<saxon:output saxon:character-representation="{$saxon.character.representation}"
href="{$filename}"
method="{$method}"
encoding="{$encoding}"
indent="{$indent}"
omit-xml-declaration="{$omit-xml-declaration}"
cdata-section-elements="{$cdata-section-elements}"
standalone="{$standalone}">
<xsl:copy-of select="$content"/>
</saxon:output>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="element-available('redirect:write')">
<!-- Xalan uses redirect -->
<redirect:write file="{$filename}">
<xsl:copy-of select="$content"/>
</redirect:write>
</xsl:when>
<xsl:otherwise>
<!-- it doesn't matter since we won't be making chunks... -->
<xsl:message terminate="yes">
<xsl:text>Can't make chunks with </xsl:text>
<xsl:value-of select="system-property('xsl:vendor')"/>
<xsl:text>'s processor.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="write.chunk.with.doctype">
<xsl:param name="filename" select="''"/>
<xsl:param name="quiet" select="$chunk.quietly"/>
<xsl:param name="method" select="$chunker.output.method"/>
<xsl:param name="encoding" select="$chunker.output.encoding"/>
<xsl:param name="indent" select="$chunker.output.indent"/>
<xsl:param name="omit-xml-declaration"
select="$chunker.output.omit-xml-declaration"/>
<xsl:param name="standalone" select="$chunker.output.standalone"/>
<xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
<xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
<xsl:param name="media-type" select="$chunker.output.media-type"/>
<xsl:param name="cdata-section-elements"
select="$chunker.output.cdata-section-elements"/>
<xsl:param name="content"/>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="quiet" select="$quiet"/>
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="encoding" select="$encoding"/>
<xsl:with-param name="indent" select="$indent"/>
<xsl:with-param name="omit-xml-declaration" select="$omit-xml-declaration"/>
<xsl:with-param name="standalone" select="$standalone"/>
<xsl:with-param name="doctype-public" select="$doctype-public"/>
<xsl:with-param name="doctype-system" select="$doctype-system"/>
<xsl:with-param name="media-type" select="$media-type"/>
<xsl:with-param name="cdata-section-elements" select="$cdata-section-elements"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="write.text.chunk">
<xsl:param name="filename" select="''"/>
<xsl:param name="quiet" select="$chunk.quietly"/>
<xsl:param name="suppress-context-node-name" select="0"/>
<xsl:param name="message-prolog"/>
<xsl:param name="message-epilog"/>
<xsl:param name="method" select="'text'"/>
<xsl:param name="encoding" select="$chunker.output.encoding"/>
<xsl:param name="media-type" select="$chunker.output.media-type"/>
<xsl:param name="content"/>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="quiet" select="$quiet"/>
<xsl:with-param name="suppress-context-node-name" select="$suppress-context-node-name"/>
<xsl:with-param name="message-prolog" select="$message-prolog"/>
<xsl:with-param name="message-epilog" select="$message-epilog"/>
<xsl:with-param name="method" select="$method"/>
<xsl:with-param name="encoding" select="$encoding"/>
<xsl:with-param name="indent" select="'no'"/>
<xsl:with-param name="omit-xml-declaration" select="'no'"/>
<xsl:with-param name="standalone" select="'no'"/>
<xsl:with-param name="doctype-public"/>
<xsl:with-param name="doctype-system"/>
<xsl:with-param name="media-type" select="$media-type"/>
<xsl:with-param name="cdata-section-elements"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,471 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: component.xsl 9356 2012-05-12 23:33:15Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- Set to 2 for backwards compatibility -->
<xsl:param name="component.heading.level" select="2"/>
<xsl:template name="component.title">
<xsl:param name="node" select="."/>
<!-- This handles the case where a component (bibliography, for example)
occurs inside a section; will we need parameters for this? -->
<!-- This "level" is a section level. To compute <h> level, add 1. -->
<xsl:variable name="level">
<xsl:choose>
<!-- chapters and other book children should get <h1> -->
<xsl:when test="$node/parent::book">0</xsl:when>
<xsl:when test="ancestor::section">
<xsl:value-of select="count(ancestor::section)+1"/>
</xsl:when>
<xsl:when test="ancestor::sect5">6</xsl:when>
<xsl:when test="ancestor::sect4">5</xsl:when>
<xsl:when test="ancestor::sect3">4</xsl:when>
<xsl:when test="ancestor::sect2">3</xsl:when>
<xsl:when test="ancestor::sect1">2</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="h{$level+1}">
<xsl:attribute name="class">title</xsl:attribute>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="$node" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template name="component.subtitle">
<xsl:param name="node" select="."/>
<xsl:variable name="subtitle"
select="($node/docinfo/subtitle
|$node/info/subtitle
|$node/prefaceinfo/subtitle
|$node/chapterinfo/subtitle
|$node/appendixinfo/subtitle
|$node/articleinfo/subtitle
|$node/artheader/subtitle
|$node/subtitle)[1]"/>
<xsl:if test="$subtitle">
<h3 class="subtitle">
<xsl:call-template name="id.attribute"/>
<i>
<xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
</i>
</h3>
</xsl:if>
</xsl:template>
<xsl:template name="component.separator">
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="dedication" mode="dedication">
<xsl:call-template name="id.warning"/>
<div>
<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="dedication.titlepage"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="dedication/title|dedication/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::dedication[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dedication/subtitle|dedication/info/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::dedication[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" -->
<xsl:template match="dedication/title"></xsl:template>
<xsl:template match="dedication/subtitle"></xsl:template>
<xsl:template match="dedication/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="acknowledgements" mode="acknowledgements">
<xsl:call-template name="id.warning"/>
<div>
<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="acknowledgements.titlepage"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="acknowledgements/title|acknowledgements/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::acknowledgements[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="acknowledgements/subtitle|acknowledgements/info/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::acknowledgements[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="acknowledgements"></xsl:template> <!-- see mode="acknowledgements" -->
<xsl:template match="acknowledgements/title"></xsl:template>
<xsl:template match="acknowledgements/subtitle"></xsl:template>
<xsl:template match="acknowledgements/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="colophon">
<xsl:call-template name="id.warning"/>
<div>
<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="component.separator"/>
<xsl:call-template name="component.title"/>
<xsl:call-template name="component.subtitle"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="colophon/title"></xsl:template>
<xsl:template match="colophon/subtitle"></xsl:template>
<xsl:template match="colophon/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="preface">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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="component.separator"/>
<xsl:call-template name="preface.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')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="preface/title" mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::preface[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="preface/subtitle
|preface/prefaceinfo/subtitle
|preface/info/subtitle
|preface/docinfo/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::preface[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="preface/docinfo|prefaceinfo"></xsl:template>
<xsl:template match="preface/info"></xsl:template>
<xsl:template match="preface/title"></xsl:template>
<xsl:template match="preface/titleabbrev"></xsl:template>
<xsl:template match="preface/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="chapter">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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="component.separator"/>
<xsl:call-template name="chapter.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')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="chapter/title|chapter/chapterinfo/title|chapter/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::chapter[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="chapter/subtitle
|chapter/chapterinfo/subtitle
|chapter/info/subtitle
|chapter/docinfo/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::chapter[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="chapter/docinfo|chapterinfo"></xsl:template>
<xsl:template match="chapter/info"></xsl:template>
<xsl:template match="chapter/title"></xsl:template>
<xsl:template match="chapter/titleabbrev"></xsl:template>
<xsl:template match="chapter/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="appendix">
<xsl:variable name="ischunk">
<xsl:call-template name="chunk"/>
</xsl:variable>
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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="parent::article and $ischunk = 0">
<xsl:call-template name="section.heading">
<xsl:with-param name="level" select="1"/>
<xsl:with-param name="title">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="component.separator"/>
<xsl:call-template name="appendix.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')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:if test="not(parent::article) or $ischunk != 0">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="appendix/title|appendix/appendixinfo/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::appendix[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="appendix/subtitle
|appendix/appendixinfo/subtitle
|appendix/info/subtitle
|appendix/docinfo/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::appendix[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
<xsl:template match="appendix/info"></xsl:template>
<xsl:template match="appendix/title"></xsl:template>
<xsl:template match="appendix/titleabbrev"></xsl:template>
<xsl:template match="appendix/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="article">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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="article.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:call-template name="make.lots">
<xsl:with-param name="toc.params" select="$toc.params"/>
<xsl:with-param name="toc">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="article/title|article/articleinfo/title" mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::article[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="article/subtitle
|article/articleinfo/subtitle
|article/info/subtitle
|article/artheader/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::article[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="article/artheader|article/articleinfo"></xsl:template>
<xsl:template match="article/info"></xsl:template>
<xsl:template match="article/title"></xsl:template>
<xsl:template match="article/titleabbrev"></xsl:template>
<xsl:template match="article/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="topic">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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="topic.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:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</xsl:element>
</xsl:template>
<xsl:template match="topic/title|topic/info/title" mode="titlepage.mode" priority="2">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor::topic[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="topic/subtitle
|topic/info/subtitle"
mode="titlepage.mode" priority="2">
<xsl:call-template name="component.subtitle">
<xsl:with-param name="node" select="ancestor::topic[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="topic/info"></xsl:template>
<xsl:template match="topic/title"></xsl:template>
<xsl:template match="topic/titleabbrev"></xsl:template>
<xsl:template match="topic/subtitle"></xsl:template>
</xsl:stylesheet>

212
build/xsl/html/division.xsl Normal file
View File

@ -0,0 +1,212 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: division.xsl 9366 2012-05-12 23:44:25Z 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="set">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="dir">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="language.attribute"/>
<xsl:if test="$generate.id.attributes != 0">
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="set.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:call-template name="make.lots">
<xsl:with-param name="toc.params" select="$toc.params"/>
<xsl:with-param name="toc">
<xsl:call-template name="set.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="set/setinfo"></xsl:template>
<xsl:template match="set/title"></xsl:template>
<xsl:template match="set/titleabbrev"></xsl:template>
<xsl:template match="set/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="book">
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="book.titlepage"/>
<xsl:apply-templates select="dedication" mode="dedication"/>
<xsl:apply-templates select="acknowledgements" mode="acknowledgements"/>
<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:call-template name="make.lots">
<xsl:with-param name="toc.params" select="$toc.params"/>
<xsl:with-param name="toc">
<xsl:call-template name="division.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="book/bookinfo"></xsl:template>
<xsl:template match="book/info"></xsl:template>
<xsl:template match="book/title"></xsl:template>
<xsl:template match="book/titleabbrev"></xsl:template>
<xsl:template match="book/subtitle"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="part">
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="part.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="not(partintro) and contains($toc.params, 'toc')">
<xsl:call-template name="division.toc"/>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="part" mode="make.part.toc">
<xsl:call-template name="division.toc"/>
</xsl:template>
<xsl:template match="reference" mode="make.part.toc">
<xsl:call-template name="division.toc"/>
</xsl:template>
<xsl:template match="part/docinfo"></xsl:template>
<xsl:template match="part/partinfo"></xsl:template>
<xsl:template match="part/info"></xsl:template>
<xsl:template match="part/title"></xsl:template>
<xsl:template match="part/titleabbrev"></xsl:template>
<xsl:template match="part/subtitle"></xsl:template>
<xsl:template match="partintro">
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="partintro.titlepage"/>
<xsl:apply-templates/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<!-- not ancestor::part because partintro appears in reference -->
<xsl:apply-templates select="parent::*" mode="make.part.toc"/>
</xsl:if>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="partintro/title"></xsl:template>
<xsl:template match="partintro/titleabbrev"></xsl:template>
<xsl:template match="partintro/subtitle"></xsl:template>
<xsl:template match="partintro/title" mode="partintro.title.mode">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="partintro/subtitle" mode="partintro.title.mode">
<h3>
<i><xsl:apply-templates/></i>
</h3>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="book" mode="division.number">
<xsl:number from="set" count="book" format="1."/>
</xsl:template>
<xsl:template match="part" mode="division.number">
<xsl:number from="book" count="part" format="I."/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="division.title">
<xsl:param name="node" select="."/>
<h1>
<xsl:attribute name="class">title</xsl:attribute>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="$node" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</h1>
</xsl:template>
</xsl:stylesheet>

527
build/xsl/html/docbook.xsl Normal file
View File

@ -0,0 +1,527 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ng="http://docbook.org/docbook-ng"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:exsl="http://exslt.org/common"
xmlns:exslt="http://exslt.org/common"
exclude-result-prefixes="db ng exsl exslt"
version='1.0'>
<xsl:output method="html"
encoding="ISO-8859-1"
indent="no"/>
<!-- ********************************************************************
$Id: docbook.xsl 9396 2012-06-02 21:56:19Z 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:include href="../VERSION.xsl"/>
<xsl:include href="param.xsl"/>
<xsl:include href="../lib/lib.xsl"/>
<xsl:include href="../common/l10n.xsl"/>
<xsl:include href="../common/common.xsl"/>
<xsl:include href="../common/utility.xsl"/>
<xsl:include href="../common/labels.xsl"/>
<xsl:include href="../common/titles.xsl"/>
<xsl:include href="../common/subtitles.xsl"/>
<xsl:include href="../common/gentext.xsl"/>
<xsl:include href="../common/targets.xsl"/>
<xsl:include href="../common/olink.xsl"/>
<xsl:include href="../common/pi.xsl"/>
<xsl:include href="autotoc.xsl"/>
<xsl:include href="autoidx.xsl"/>
<xsl:include href="lists.xsl"/>
<xsl:include href="callout.xsl"/>
<xsl:include href="verbatim.xsl"/>
<xsl:include href="graphics.xsl"/>
<xsl:include href="xref.xsl"/>
<xsl:include href="formal.xsl"/>
<xsl:include href="table.xsl"/>
<xsl:include href="htmltbl.xsl"/>
<xsl:include href="sections.xsl"/>
<xsl:include href="inline.xsl"/>
<xsl:include href="footnote.xsl"/>
<xsl:include href="html.xsl"/>
<xsl:include href="info.xsl"/>
<xsl:include href="keywords.xsl"/>
<xsl:include href="division.xsl"/>
<xsl:include href="toc.xsl"/>
<xsl:include href="index.xsl"/>
<xsl:include href="refentry.xsl"/>
<xsl:include href="math.xsl"/>
<xsl:include href="admon.xsl"/>
<xsl:include href="component.xsl"/>
<xsl:include href="biblio.xsl"/>
<xsl:include href="biblio-iso690.xsl"/>
<xsl:include href="glossary.xsl"/>
<xsl:include href="block.xsl"/>
<xsl:include href="task.xsl"/>
<xsl:include href="qandaset.xsl"/>
<xsl:include href="synop.xsl"/>
<xsl:include href="titlepage.xsl"/>
<xsl:include href="titlepage.templates.xsl"/>
<xsl:include href="pi.xsl"/>
<xsl:include href="ebnf.xsl"/>
<xsl:include href="chunker.xsl"/>
<xsl:include href="html-rtf.xsl"/>
<xsl:include href="annotations.xsl"/>
<xsl:include href="../common/stripns.xsl"/>
<xsl:param name="stylesheet.result.type" select="'html'"/>
<xsl:param name="htmlhelp.output" select="0"/>
<!-- ==================================================================== -->
<xsl:key name="id" match="*" use="@id|@xml:id"/>
<xsl:key name="gid" match="*" use="generate-id()"/>
<!-- ==================================================================== -->
<xsl:template match="*">
<xsl:message>
<xsl:text>Element </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text> in namespace '</xsl:text>
<xsl:value-of select="namespace-uri(.)"/>
<xsl:text>' encountered</xsl:text>
<xsl:if test="parent::*">
<xsl:text> in </xsl:text>
<xsl:value-of select="name(parent::*)"/>
</xsl:if>
<xsl:text>, but no template matches.</xsl:text>
</xsl:message>
<span style="color: red">
<xsl:text>&lt;</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>&gt;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&lt;/</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>&gt;</xsl:text>
</span>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template name="body.attributes">
<xsl:attribute name="bgcolor">white</xsl:attribute>
<xsl:attribute name="text">black</xsl:attribute>
<xsl:attribute name="link">#0000FF</xsl:attribute>
<xsl:attribute name="vlink">#840084</xsl:attribute>
<xsl:attribute name="alink">#0000FF</xsl:attribute>
<xsl:if test="starts-with($writing.mode, 'rl')">
<xsl:attribute name="dir">rtl</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="head.content">
<xsl:param name="node" select="."/>
<xsl:param name="title">
<xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
</xsl:param>
<title>
<xsl:copy-of select="$title"/>
</title>
<xsl:if test="$html.base != ''">
<base href="{$html.base}"/>
</xsl:if>
<!-- Insert links to CSS files or insert literal style elements -->
<xsl:call-template name="generate.css"/>
<xsl:if test="$html.stylesheet != ''">
<xsl:call-template name="output.html.stylesheets">
<xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$html.script != ''">
<xsl:call-template name="output.html.scripts">
<xsl:with-param name="scripts" select="normalize-space($html.script)"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$link.mailto.url != ''">
<link rev="made"
href="{$link.mailto.url}"/>
</xsl:if>
<meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
<xsl:if test="$generate.meta.abstract != 0">
<xsl:variable name="info" select="(articleinfo
|bookinfo
|prefaceinfo
|chapterinfo
|appendixinfo
|sectioninfo
|sect1info
|sect2info
|sect3info
|sect4info
|sect5info
|referenceinfo
|refentryinfo
|partinfo
|info
|docinfo)[1]"/>
<xsl:if test="$info and $info/abstract">
<meta name="description">
<xsl:attribute name="content">
<xsl:for-each select="$info/abstract[1]/*">
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="position() &lt; last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
</meta>
</xsl:if>
</xsl:if>
<xsl:if test="($draft.mode = 'yes' or
($draft.mode = 'maybe' and
ancestor-or-self::*[@status][1]/@status = 'draft'))
and $draft.watermark.image != ''">
<style type="text/css"><xsl:text>
body { background-image: url('</xsl:text>
<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
background-repeat: no-repeat;
background-position: top left;
/* The following properties make the watermark "fixed" on the page. */
/* I think that's just a bit too distracting for the reader... */
/* background-attachment: fixed; */
/* background-position: center center; */
}</xsl:text>
</style>
</xsl:if>
<xsl:apply-templates select="." mode="head.keywords.content"/>
</xsl:template>
<xsl:template name="output.html.stylesheets">
<xsl:param name="stylesheets" select="''"/>
<xsl:choose>
<xsl:when test="contains($stylesheets, ' ')">
<xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
<xsl:call-template name="make.css.link">
<xsl:with-param name="css.filename" select="$css.filename"/>
</xsl:call-template>
<xsl:call-template name="output.html.stylesheets">
<xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$stylesheets != ''">
<xsl:call-template name="make.css.link">
<xsl:with-param name="css.filename" select="$stylesheets"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="output.html.scripts">
<xsl:param name="scripts" select="''"/>
<xsl:choose>
<xsl:when test="contains($scripts, ' ')">
<xsl:variable name="script.filename" select="substring-before($scripts, ' ')"/>
<xsl:call-template name="make.script.link">
<xsl:with-param name="script.filename" select="$script.filename"/>
</xsl:call-template>
<xsl:call-template name="output.html.scripts">
<xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$scripts != ''">
<xsl:call-template name="make.script.link">
<xsl:with-param name="script.filename" select="$scripts"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ============================================================ -->
<xsl:template match="*" mode="head.keywords.content">
<xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
<xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
<xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
<xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
<xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
<xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
<xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
<xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
<xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
<xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
<xsl:apply-templates select="info/keywordset" mode="html.header"/>
<xsl:if test="$inherit.keywords != 0
and parent::*">
<xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
</xsl:if>
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="system.head.content">
<xsl:param name="node" select="."/>
<!-- FIXME: When chunking, only the annotations actually used
in this chunk should be referenced. I don't think it
does any harm to reference them all, but it adds
unnecessary bloat to each chunk. -->
<xsl:if test="$annotation.support != 0 and //annotation">
<xsl:call-template name="add.annotation.links"/>
<script type="text/javascript">
<xsl:text>&#10;// Create PopupWindow objects</xsl:text>
<xsl:for-each select="//annotation">
<xsl:text>&#10;var popup_</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text> = new PopupWindow("popup-</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text>");&#10;</xsl:text>
<xsl:text>popup_</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text>.offsetY = 15;&#10;</xsl:text>
<xsl:text>popup_</xsl:text>
<xsl:value-of select="generate-id(.)"/>
<xsl:text>.autoHide();&#10;</xsl:text>
</xsl:for-each>
</script>
<style type="text/css">
<xsl:value-of select="$annotation.css"/>
</style>
</xsl:if>
<!-- system.head.content is like user.head.content, except that
it is called before head.content. This is important because it
means, for example, that <style> elements output by system.head.content
have a lower CSS precedence than the users stylesheet. -->
</xsl:template>
<!-- ============================================================ -->
<xsl:template name="user.preroot">
<!-- Pre-root output, can be used to output comments and PIs. -->
<!-- This must not output any element content! -->
</xsl:template>
<xsl:template name="user.head.content">
<xsl:param name="node" select="."/>
</xsl:template>
<xsl:template name="user.header.navigation">
<xsl:param name="node" select="."/>
<xsl:param name="prev" select="/foo"/>
<xsl:param name="next" select="/foo"/>
<xsl:param name="nav.context"/>
</xsl:template>
<xsl:template name="user.header.content">
<xsl:param name="node" select="."/>
</xsl:template>
<xsl:template name="user.footer.content">
<xsl:param name="node" select="."/>
</xsl:template>
<xsl:template name="user.footer.navigation">
<xsl:param name="node" select="."/>
<xsl:param name="prev" select="/foo"/>
<xsl:param name="next" select="/foo"/>
<xsl:param name="nav.context"/>
</xsl:template>
<!-- To use the same stripped nodeset everywhere, it should
be created as a global variable here.
Used by docbook.xsl, chunk-code.xsl and chunkfast.xsl -->
<xsl:variable name="no.namespace">
<xsl:if test="$exsl.node.set.available != 0
and (*/self::ng:* or */self::db:*)">
<xsl:apply-templates select="/*" mode="stripNS"/>
</xsl:if>
</xsl:variable>
<xsl:template match="/">
<!-- * Get a title for current doc so that we let the user -->
<!-- * know what document we are processing at this point. -->
<xsl:variable name="doc.title">
<xsl:call-template name="get.doc.title"/>
</xsl:variable>
<xsl:choose>
<!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
toss the namespace and continue. Use the docbook5 namespaced
stylesheets for DocBook5 if you don't want to use this feature.-->
<!-- include extra test for Xalan quirk -->
<xsl:when test="$exsl.node.set.available != 0
and (*/self::ng:* or */self::db:*)">
<xsl:call-template name="log.message">
<xsl:with-param name="level">Note</xsl:with-param>
<xsl:with-param name="source" select="$doc.title"/>
<xsl:with-param name="context-desc">
<xsl:text>namesp. cut</xsl:text>
</xsl:with-param>
<xsl:with-param name="message">
<xsl:text>stripped namespace before processing</xsl:text>
</xsl:with-param>
</xsl:call-template>
<!-- DEBUG: to save stripped document.
<xsl:message>Saving stripped document.</xsl:message>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="'/tmp/stripped.xml'"/>
<xsl:with-param name="method" select="'xml'"/>
<xsl:with-param name="content">
<xsl:copy-of select="exsl:node-set($no.namespace)"/>
</xsl:with-param>
</xsl:call-template>
-->
<xsl:call-template name="log.message">
<xsl:with-param name="level">Note</xsl:with-param>
<xsl:with-param name="source" select="$doc.title"/>
<xsl:with-param name="context-desc">
<xsl:text>namesp. cut</xsl:text>
</xsl:with-param>
<xsl:with-param name="message">
<xsl:text>processing stripped document</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="exsl:node-set($no.namespace)"/>
</xsl:when>
<!-- Can't process unless namespace removed -->
<xsl:when test="*/self::ng:* or */self::db:*">
<xsl:message terminate="yes">
<xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
<xsl:text> cannot proceed.</xsl:text>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$rootid != ''">
<xsl:choose>
<xsl:when test="count(key('id',$rootid)) = 0">
<xsl:message terminate="yes">
<xsl:text>ID '</xsl:text>
<xsl:value-of select="$rootid"/>
<xsl:text>' not found in document.</xsl:text>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$collect.xref.targets = 'yes' or
$collect.xref.targets = 'only'">
<xsl:apply-templates select="key('id', $rootid)"
mode="collect.targets"/>
</xsl:if>
<xsl:if test="$collect.xref.targets != 'only'">
<xsl:apply-templates select="key('id',$rootid)"
mode="process.root"/>
<xsl:if test="$tex.math.in.alt != ''">
<xsl:apply-templates select="key('id',$rootid)"
mode="collect.tex.math"/>
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$collect.xref.targets = 'yes' or
$collect.xref.targets = 'only'">
<xsl:apply-templates select="/" mode="collect.targets"/>
</xsl:if>
<xsl:if test="$collect.xref.targets != 'only'">
<xsl:apply-templates select="/" mode="process.root"/>
<xsl:if test="$tex.math.in.alt != ''">
<xsl:apply-templates select="/" mode="collect.tex.math"/>
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="process.root">
<xsl:variable name="doc" select="self::*"/>
<xsl:call-template name="user.preroot"/>
<xsl:call-template name="root.messages"/>
<html>
<xsl:call-template name="root.attributes"/>
<head>
<xsl:call-template name="system.head.content">
<xsl:with-param name="node" select="$doc"/>
</xsl:call-template>
<xsl:call-template name="head.content">
<xsl:with-param name="node" select="$doc"/>
</xsl:call-template>
<xsl:call-template name="user.head.content">
<xsl:with-param name="node" select="$doc"/>
</xsl:call-template>
</head>
<body>
<xsl:call-template name="body.attributes"/>
<xsl:call-template name="user.header.content">
<xsl:with-param name="node" select="$doc"/>
</xsl:call-template>
<xsl:apply-templates select="."/>
<xsl:call-template name="user.footer.content">
<xsl:with-param name="node" select="$doc"/>
</xsl:call-template>
</body>
</html>
<xsl:value-of select="$html.append"/>
<!-- Generate any css files only once, not once per chunk -->
<xsl:call-template name="generate.css.files"/>
</xsl:template>
<xsl:template name="root.attributes">
<!-- customize to add attributes to <html> element -->
</xsl:template>
<xsl:template name="root.messages">
<!-- redefine this any way you'd like to output messages -->
<!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="chunk">
<xsl:param name="node" select="."/>
<!-- The default is that we are not chunking... -->
<xsl:text>0</xsl:text>
</xsl:template>
</xsl:stylesheet>

331
build/xsl/html/ebnf.xsl Normal file
View File

@ -0,0 +1,331 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: ebnf.xsl 9358 2012-05-12 23:37:10Z 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.
******************************************************************** -->
<doc:reference xmlns="">
<referenceinfo>
<releaseinfo role="meta">
$Id: ebnf.xsl 9358 2012-05-12 23:37:10Z bobstayton $
</releaseinfo>
<author><surname>Walsh</surname>
<firstname>Norman</firstname></author>
<copyright><year>1999</year><year>2000</year>
<holder>Norman Walsh</holder>
</copyright>
</referenceinfo>
<title>HTML EBNF Reference</title>
<partintro>
<section><title>Introduction</title>
<para>This is technical reference documentation for the DocBook XSL
Stylesheets; it documents (some of) the parameters, templates, and
other elements of the stylesheets.</para>
<para>This reference describes the templates and parameters relevant
to formatting EBNF markup.</para>
<para>This is not intended to be <quote>user</quote> documentation.
It is provided for developers writing customization layers for the
stylesheets, and for anyone who's interested in <quote>how it
works</quote>.</para>
<para>Although I am trying to be thorough, this documentation is known
to be incomplete. Don't forget to read the source, too :-)</para>
</section>
</partintro>
</doc:reference>
<!-- ==================================================================== -->
<xsl:template match="productionset">
<table width="100%" cellpadding="5">
<xsl:if test="$ebnf.table.bgcolor != ''">
<xsl:attribute name="bgcolor">
<xsl:value-of select="$ebnf.table.bgcolor"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ebnf.table.border != 0">
<xsl:attribute name="border">1</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:attribute name="summary">
<xsl:text>EBNF</xsl:text>
<xsl:if test="title|info/title">
<xsl:text> for </xsl:text>
<xsl:value-of select="title|info/title[1]"/>
</xsl:if>
</xsl:attribute>
<xsl:if test="title|info/title">
<tr>
<th align="{$direction.align.start}" valign="top">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:apply-templates select="title|info/title[1]"/>
</th>
</tr>
</xsl:if>
<tr>
<td>
<table border="0" width="99%" cellpadding="0">
<xsl:if test="$ebnf.table.bgcolor != ''">
<xsl:attribute name="bgcolor">
<xsl:value-of select="$ebnf.table.bgcolor"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
<xsl:value-of select="local-name(.)"/>
</xsl:attribute>
<xsl:attribute name="summary">EBNF productions</xsl:attribute>
<xsl:apply-templates select="production|productionrecap"/>
</table>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="productionset/title">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="production">
<xsl:param name="recap" select="false()"/>
<tr>
<td align="{$direction.align.start}" valign="top" width="3%">
<xsl:text>[</xsl:text>
<xsl:number count="production" level="any"/>
<xsl:text>]</xsl:text>
</td>
<td align="{$direction.align.end}" valign="top" width="10%">
<xsl:choose>
<xsl:when test="$recap">
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="lhs"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="lhs"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td valign="top" width="5%" align="center">
<xsl:copy-of select="$ebnf.assignment"/>
</td>
<td valign="top" width="52%">
<xsl:apply-templates select="rhs"/>
<xsl:copy-of select="$ebnf.statement.terminator"/>
</td>
<td align="{$direction.align.start}" valign="top" width="30%">
<xsl:choose>
<xsl:when test="rhs/lineannotation|constraint">
<xsl:apply-templates select="rhs/lineannotation" mode="rhslo"/>
<xsl:apply-templates select="constraint"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#160;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<xsl:template match="productionrecap">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:if test="count($targets)=0">
<xsl:message>
<xsl:text>Error: no ID for productionrecap linkend: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:text>.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="count($targets)>1">
<xsl:message>
<xsl:text>Warning: multiple "IDs" for productionrecap linkend: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:text>.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:apply-templates select="$target">
<xsl:with-param name="recap" select="true()"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="lhs">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="rhs">
<xsl:apply-templates/>
<xsl:if test="following-sibling::rhs">
<xsl:text> |</xsl:text>
<br/>
</xsl:if>
</xsl:template>
<xsl:template match="nonterminal">
<xsl:variable name="linkend">
<xsl:call-template name="xpointer.idref">
<xsl:with-param name="xpointer" select="@def"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="$linkend"/>
</xsl:call-template>
<xsl:call-template name="check.idref.targets">
<xsl:with-param name="linkend" select="$linkend"/>
<xsl:with-param name="element-list">production</xsl:with-param>
</xsl:call-template>
<!-- If you don't provide content, you can't point outside this doc. -->
<xsl:choose>
<xsl:when test="*|text()"><!--nop--></xsl:when>
<xsl:otherwise>
<xsl:if test="$linkend = ''">
<xsl:message>
<xsl:text>Non-terminals with no content must point to </xsl:text>
<xsl:text>production elements in the current document.</xsl:text>
</xsl:message>
<xsl:message>
<xsl:text>Invalid xpointer for empty nt: </xsl:text>
<xsl:value-of select="@def"/>
</xsl:message>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="href">
<xsl:choose>
<xsl:when test="$linkend != ''">
<xsl:variable name="targets" select="key('id',$linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@def"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{$href}">
<xsl:choose>
<xsl:when test="*|text()">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$linkend != ''">
<xsl:variable name="targets" select="key('id',$linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:apply-templates select="$target/lhs"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>???</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:template>
<xsl:template match="rhs/lineannotation">
<!--nop-->
</xsl:template>
<xsl:template match="rhs/lineannotation" mode="rhslo">
<xsl:text>/*&#160;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&#160;*/</xsl:text>
<br/>
</xsl:template>
<xsl:template match="constraint">
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="@linkend"/>
</xsl:call-template>
<xsl:call-template name="check.idref.targets">
<xsl:with-param name="linkend" select="@linkend"/>
<xsl:with-param name="element-list">constraintdef</xsl:with-param>
</xsl:call-template>
<xsl:variable name="href">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:variable>
<xsl:text>[&#160;</xsl:text>
<xsl:choose>
<xsl:when test="@role">
<xsl:value-of select="@role"/>
<xsl:text>: </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:if test="$target/@role">
<xsl:value-of select="$target/@role"/>
<xsl:text>: </xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<a href="{$href}">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:apply-templates select="$target" mode="title.markup"/>
</a>
<xsl:text>&#160;]</xsl:text>
<xsl:if test="following-sibling::constraint">
<br/>
</xsl:if>
</xsl:template>
<xsl:template match="constraintdef">
<div>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="constraintdef/title">
<p><b><xsl:apply-templates/></b></p>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

350
build/xsl/html/footnote.xsl Normal file
View File

@ -0,0 +1,350 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl"
version='1.0'>
<!-- ********************************************************************
$Id: footnote.xsl 9361 2012-05-12 23:39:44Z 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.
******************************************************************** -->
<!-- This template generates just the footnote marker inline.
The footnote text is handled in name="process.footnote".
The footnote marker gets an id of @id, while the
footnote text gets an id of #ftn.@id. They cross link to each other. -->
<xsl:template match="footnote">
<xsl:variable name="href">
<xsl:text>#ftn.</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:variable>
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<sup>
<xsl:apply-templates select="." mode="class.attribute"/>
<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:text>[</xsl:text>
<xsl:apply-templates select="." mode="footnote.number"/>
<xsl:text>]</xsl:text>
</sup>
</a>
</xsl:template>
<xsl:template match="footnoteref">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="footnote" select="$targets[1]"/>
<xsl:if test="not(local-name($footnote) = 'footnote')">
<xsl:message terminate="yes">
ERROR: A footnoteref element has a linkend that points to an element that is not a footnote.
Typically this happens when an id attribute is accidentally applied to the child of a footnote element.
target element: <xsl:value-of select="local-name($footnote)"/>
linkend/id: <xsl:value-of select="@linkend"/>
</xsl:message>
</xsl:if>
<xsl:variable name="target.href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href">
<xsl:value-of select="substring-before($target.href, '#')"/>
<xsl:text>#ftn.</xsl:text>
<xsl:value-of select="substring-after($target.href, '#')"/>
</xsl:variable>
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute"/>
<sup>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="$footnote" mode="footnote.number"/>
<xsl:text>]</xsl:text>
</sup>
</a>
</xsl:template>
<xsl:template match="footnote" mode="footnote.number">
<xsl:choose>
<xsl:when test="string-length(@label) != 0">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:when test="ancestor::table or ancestor::informaltable">
<xsl:variable name="tfnum">
<xsl:number level="any" from="table|informaltable" format="1"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($table.footnote.number.symbols) &gt;= $tfnum">
<xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:number level="any" from="table | informaltable"
format="{$table.footnote.number.format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="pfoot" select="preceding::footnote[not(@label)]"/>
<xsl:variable name="ptfoot" select="preceding::table//footnote |
preceding::informaltable//footnote"/>
<xsl:variable name="fnum" select="count($pfoot) - count($ptfoot) + 1"/>
<xsl:choose>
<xsl:when test="string-length($footnote.number.symbols) &gt;= $fnum">
<xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
</xsl:when>
<xsl:otherwise>
<xsl:number value="$fnum" format="{$footnote.number.format}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="footnote/para[1]|footnote/simpara[1]" priority="2">
<!-- this only works if the first thing in a footnote is a para, -->
<!-- which is ok, because it usually is. -->
<xsl:variable name="href">
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="ancestor::footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="paragraph">
<xsl:with-param name="class">
<xsl:if test="@role and $para.propagates.style != 0">
<xsl:value-of select="@role"/>
</xsl:if>
</xsl:with-param>
<xsl:with-param name="content">
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<sup>
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
<xsl:text>] </xsl:text>
</sup>
</a>
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="*" mode="footnote.body.number">
<xsl:variable name="name">
<xsl:text>ftn.</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="ancestor::footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href">
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="ancestor::footnote"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="footnote.mark">
<a href="{$href}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<xsl:if test="@id or @xml:id">
<xsl:attribute name="name">
<xsl:value-of select="@id|@xml:id"/>
</xsl:attribute>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="id.attribute"/>
</xsl:otherwise>
</xsl:choose>
<sup>
<xsl:text>[</xsl:text>
<xsl:apply-templates select="ancestor::footnote"
mode="footnote.number"/>
<xsl:text>] </xsl:text>
</sup>
</a>
</xsl:variable>
<xsl:variable name="html">
<xsl:apply-templates select="."/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<xsl:variable name="html-nodes" select="exsl:node-set($html)"/>
<xsl:choose>
<xsl:when test="$html-nodes//p">
<xsl:apply-templates select="$html-nodes" mode="insert.html.p">
<xsl:with-param name="mark" select="$footnote.mark"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$html-nodes" mode="insert.html.text">
<xsl:with-param name="mark" select="$footnote.mark"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$html"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!--
<xsl:template name="count-element-from">
<xsl:param name="from" select=".."/>
<xsl:param name="to" select="."/>
<xsl:param name="count" select="0"/>
<xsl:param name="list" select="$from/following::*[local-name(.)=local-name($to)]
|$from/descendant-or-self::*[local-name(.)=local-name($to)]"/>
<xsl:choose>
<xsl:when test="not($list)">
<xsl:text>-1</xsl:text>
</xsl:when>
<xsl:when test="$list[1] = $to">
<xsl:value-of select="$count + 1"/>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-->
<!-- ==================================================================== -->
<xsl:template name="process.footnotes">
<xsl:variable name="footnotes" select=".//footnote"/>
<xsl:variable name="table.footnotes"
select=".//table//footnote | .//informaltable//footnote"/>
<!-- Only bother to do this if there's at least one non-table footnote -->
<xsl:if test="count($footnotes)>count($table.footnotes)">
<div class="footnotes">
<xsl:call-template name="footnotes.attributes"/>
<br/>
<hr>
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<xsl:attribute name="class">footnote-hr</xsl:attribute>
</xsl:when>
<xsl:when test="$css.decoration != 0">
<xsl:attribute name="style">
<xsl:value-of select="concat('width:100; align:',
$direction.align.start,
';')"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="width">100</xsl:attribute>
<xsl:attribute name="align"><xsl:value-of
select="$direction.align.start"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</hr>
<xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
</div>
</xsl:if>
<xsl:if test="$annotation.support != 0 and //annotation">
<div class="annotation-list">
<div class="annotation-nocss">
<p>The following annotations are from this essay. You are seeing
them here because your browser doesnt support the user-interface
techniques used to make them appear as popups on modern browsers.</p>
</div>
<xsl:apply-templates select="//annotation"
mode="annotation-popup"/>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="footnotes.attributes">
<!-- customizable for footnotes attributes -->
</xsl:template>
<xsl:template name="process.chunk.footnotes">
<!-- nop -->
</xsl:template>
<xsl:template match="footnote" name="process.footnote" mode="process.footnote.mode">
<xsl:variable name="id">
<xsl:text>ftn.</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="local-name(*[1]) = 'para' or local-name(*[1]) = 'simpara'">
<div id="{$id}">
<xsl:call-template name="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:when test="$html.cleanup != 0 and
$exsl.node.set.available != 0">
<div id="{$id}">
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="*[1]" mode="footnote.body.number"/>
<xsl:apply-templates select="*[position() &gt; 1]"/>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Warning: footnote number may not be generated </xsl:text>
<xsl:text>correctly; </xsl:text>
<xsl:value-of select="local-name(*[1])"/>
<xsl:text> unexpected as first child of footnote.</xsl:text>
</xsl:message>
<div id="{$id}">
<xsl:call-template name="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="table//footnote | informaltable//footnote"
mode="process.footnote.mode">
</xsl:template>
<xsl:template match="footnote" mode="table.footnote.mode">
<xsl:call-template name="process.footnote"/>
</xsl:template>
</xsl:stylesheet>

507
build/xsl/html/formal.xsl Normal file
View File

@ -0,0 +1,507 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: formal.xsl 9297 2012-04-22 03:56:16Z 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:param name="formal.object.break.after">1</xsl:param>
<xsl:template name="formal.object">
<xsl:param name="placement" select="'before'"/>
<xsl:param name="class">
<xsl:apply-templates select="." mode="class.value"/>
</xsl:param>
<xsl:call-template name="id.warning"/>
<xsl:variable name="content">
<div class="{$class}">
<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:choose>
<xsl:when test="$placement = 'before'">
<xsl:call-template name="formal.object.heading"/>
<div class="{$class}-contents">
<xsl:apply-templates/>
</div>
<!-- HACK: This doesn't belong inside formal.object; it
should be done by the table template, but I want
the link to be inside the DIV, so... -->
<xsl:if test="local-name(.) = 'table'">
<xsl:call-template name="table.longdesc"/>
</xsl:if>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
<div class="{$class}-contents"><xsl:apply-templates/></div>
<!-- HACK: This doesn't belong inside formal.object; it
should be done by the table template, but I want
the link to be inside the DIV, so... -->
<xsl:if test="local-name(.) = 'table'">
<xsl:call-template name="table.longdesc"/>
</xsl:if>
<xsl:call-template name="formal.object.heading"/>
</xsl:otherwise>
</xsl:choose>
</div>
<xsl:if test="not($formal.object.break.after = '0')">
<br class="{$class}-break"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="floatstyle">
<xsl:call-template name="floatstyle"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$floatstyle != ''">
<xsl:call-template name="floater">
<xsl:with-param name="class"><xsl:value-of
select="$class"/>-float</xsl:with-param>
<xsl:with-param name="floatstyle" select="$floatstyle"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="formal.object.heading">
<xsl:param name="object" select="."/>
<xsl:param name="title">
<xsl:apply-templates select="$object" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</xsl:param>
<xsl:choose>
<xsl:when test="$make.clean.html != 0">
<xsl:variable name="html.class" select="concat(local-name($object),'-title')"/>
<div class="{$html.class}">
<xsl:copy-of select="$title"/>
</div>
</xsl:when>
<xsl:otherwise>
<p class="title">
<b>
<xsl:copy-of select="$title"/>
</b>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="informal.object">
<xsl:param name="class">
<xsl:apply-templates select="." mode="class.value"/>
</xsl:param>
<xsl:variable name="content">
<div class="{$class}">
<xsl:call-template name="id.attribute"/>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
<xsl:call-template name="anchor"/>
<xsl:apply-templates/>
<!-- HACK: This doesn't belong inside formal.object; it
should be done by the table template, but I want
the link to be inside the DIV, so... -->
<xsl:if test="local-name(.) = 'informaltable'">
<xsl:call-template name="table.longdesc"/>
</xsl:if>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
</div>
</xsl:variable>
<xsl:variable name="floatstyle">
<xsl:call-template name="floatstyle"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$floatstyle != ''">
<xsl:call-template name="floater">
<xsl:with-param name="class"><xsl:value-of
select="$class"/>-float</xsl:with-param>
<xsl:with-param name="floatstyle" select="$floatstyle"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="semiformal.object">
<xsl:param name="placement" select="'before'"/>
<xsl:param name="class" select="local-name(.)"/>
<xsl:choose>
<xsl:when test="title or info/title">
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
<xsl:with-param name="class" select="$class"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="informal.object">
<xsl:with-param name="class" select="$class"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="figure">
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="table">
<xsl:choose>
<xsl:when test="tgroup|mediaobject|graphic">
<xsl:call-template name="calsTable"/>
</xsl:when>
<xsl:when test="caption">
<xsl:call-template name="htmlTable.with.caption"/>
</xsl:when>
<xsl:otherwise>
<!-- do not use xsl:copy because of XHTML's needs -->
<xsl:element name="table" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
<xsl:call-template name="htmlTable"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Handle html markup table like formal.object -->
<xsl:template name="htmlTable.with.caption">
<xsl:param name="class">
<xsl:apply-templates select="." mode="class.value"/>
</xsl:param>
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="id.warning"/>
<xsl:variable name="content">
<div class="{$class}">
<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:choose>
<xsl:when test="$placement = 'before'">
<xsl:call-template name="formal.object.heading"/>
<div class="{$class}-contents">
<xsl:apply-templates select="." mode="htmlTable"/>
</div>
<xsl:call-template name="table.longdesc"/>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$spacing.paras != 0"><p/></xsl:if>
<div class="{$class}-contents">
<xsl:apply-templates select="." mode="htmlTable"/>
</div>
<xsl:call-template name="table.longdesc"/>
<xsl:call-template name="formal.object.heading"/>
</xsl:otherwise>
</xsl:choose>
</div>
<xsl:if test="not($formal.object.break.after = '0')">
<br class="{$class}-break"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="floatstyle">
<xsl:call-template name="floatstyle"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$floatstyle != ''">
<xsl:call-template name="floater">
<xsl:with-param name="class"><xsl:value-of
select="$class"/>-float</xsl:with-param>
<xsl:with-param name="floatstyle" select="$floatstyle"/>
<xsl:with-param name="content" select="$content"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="calsTable">
<xsl:if test="tgroup/tbody/tr
|tgroup/thead/tr
|tgroup/tfoot/tr">
<xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
</xsl:if>
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="table|informaltable" mode="class.value">
<xsl:choose>
<xsl:when test="@tabstyle">
<xsl:value-of select="@tabstyle"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="htmlTable">
<xsl:if test="tgroup/tbody/row
|tgroup/thead/row
|tgroup/tfoot/row">
<xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
</xsl:if>
<xsl:apply-templates mode="htmlTable"/>
<xsl:if test=".//footnote|../title//footnote">
<tbody class="footnotes">
<tr>
<td colspan="50">
<xsl:apply-templates select=".//footnote|../title//footnote" mode="table.footnote.mode"/>
</td>
</tr>
</tbody>
</xsl:if>
</xsl:template>
<xsl:template match="example">
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="equation">
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="formal.object">
<xsl:with-param name="placement" select="$placement"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="figure/title"></xsl:template>
<xsl:template match="figure/titleabbrev"></xsl:template>
<xsl:template match="table/title"></xsl:template>
<xsl:template match="table/titleabbrev"></xsl:template>
<xsl:template match="table/textobject"></xsl:template>
<xsl:template match="example/title"></xsl:template>
<xsl:template match="example/titleabbrev"></xsl:template>
<xsl:template match="equation/title"></xsl:template>
<xsl:template match="equation/titleabbrev"></xsl:template>
<xsl:template match="informalfigure">
<xsl:call-template name="informal.object"/>
</xsl:template>
<xsl:template match="informalexample">
<xsl:call-template name="informal.object"/>
</xsl:template>
<xsl:template match="informaltable">
<xsl:choose>
<xsl:when test="tgroup|mediaobject|graphic">
<xsl:call-template name="informal.object"/>
</xsl:when>
<xsl:otherwise>
<xsl:element name="table" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
<xsl:call-template name="htmlTable"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="informaltable/textobject"></xsl:template>
<xsl:template name="table.longdesc">
<!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
<!-- the table template, but I want the link to be inside the DIV, so... -->
<xsl:variable name="longdesc.uri">
<xsl:call-template name="longdesc.uri">
<xsl:with-param name="mediaobject" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="irrelevant">
<!-- write.longdesc returns the filename ... -->
<xsl:call-template name="write.longdesc">
<xsl:with-param name="mediaobject" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0
and textobject[not(phrase)]">
<xsl:call-template name="longdesc.link">
<xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template match="informalequation">
<xsl:call-template name="informal.object"/>
</xsl:template>
<xsl:template name="floatstyle">
<xsl:if test="(@float and @float != '0') or @floatstyle != ''">
<xsl:choose>
<xsl:when test="@floatstyle != ''">
<xsl:value-of select="@floatstyle"/>
</xsl:when>
<xsl:when test="@float = '1'">
<xsl:value-of select="$default.float.class"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@float"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="floater">
<xsl:param name="content"/>
<xsl:param name="class" select="'float'"/>
<xsl:param name="floatstyle" select="'left'"/>
<div class="{$class}">
<xsl:if test="$floatstyle = 'left' or $floatstyle = 'right'">
<xsl:attribute name="style">
<xsl:text>float: </xsl:text>
<xsl:value-of select="$floatstyle"/>
<xsl:text>;</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="$content"/>
</div>
</xsl:template>
</xsl:stylesheet>

521
build/xsl/html/glossary.xsl Normal file
View File

@ -0,0 +1,521 @@
<?xml version='1.0'?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % common.entities SYSTEM "../common/entities.ent">
%common.entities;
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink='http://www.w3.org/1999/xlink'
exclude-result-prefixes="xlink"
version='1.0'>
<!-- ********************************************************************
$Id: glossary.xsl 9364 2012-05-12 23:43:04Z 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="glossary">
&setup-language-variable;
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="glossary.titlepage"/>
<xsl:choose>
<xsl:when test="glossdiv">
<xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
</xsl:when>
<xsl:when test="glossentry">
<xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="glossdiv">
<xsl:apply-templates select="glossdiv"/>
</xsl:when>
<xsl:when test="glossentry">
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:apply-templates select="glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossentry"/>
</xsl:otherwise>
</xsl:choose>
</dl>
</xsl:when>
<xsl:otherwise>
<!-- empty glossary -->
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="glossary/glossaryinfo"></xsl:template>
<xsl:template match="glossary/info"></xsl:template>
<xsl:template match="glossary/title"></xsl:template>
<xsl:template match="glossary/subtitle"></xsl:template>
<xsl:template match="glossary/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="glosslist">
&setup-language-variable;
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:if test="blockinfo/title|info/title|title">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:apply-templates select="glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossentry"/>
</xsl:otherwise>
</xsl:choose>
</dl>
</div>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="glossdiv">
&setup-language-variable;
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:apply-templates select="glossentry">
<xsl:sort lang="{$language}"
select="translate(glossterm, $lowercase,
$uppercase)"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossentry"/>
</xsl:otherwise>
</xsl:choose>
</dl>
</div>
</xsl:template>
<xsl:template match="glossdiv/title">
<h3>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</h3>
</xsl:template>
<!-- ==================================================================== -->
<!--
GlossEntry ::=
GlossTerm, Acronym?, Abbrev?,
(IndexTerm)*,
RevHistory?,
(GlossSee | GlossDef+)
-->
<xsl:template match="glossentry">
<xsl:choose>
<xsl:when test="$glossentry.show.acronym = 'primary'">
<dt>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:choose>
<xsl:when test="acronym|abbrev">
<xsl:apply-templates select="acronym|abbrev"/>
<xsl:text> (</xsl:text>
<xsl:apply-templates select="glossterm"/>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="glossterm"/>
</xsl:otherwise>
</xsl:choose>
</dt>
</xsl:when>
<xsl:when test="$glossentry.show.acronym = 'yes'">
<dt>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="glossterm"/>
<xsl:if test="acronym|abbrev">
<xsl:text> (</xsl:text>
<xsl:apply-templates select="acronym|abbrev"/>
<xsl:text>)</xsl:text>
</xsl:if>
</dt>
</xsl:when>
<xsl:otherwise>
<dt>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional">
<xsl:choose>
<xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="glossterm"/>
</dt>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="indexterm|revhistory|glosssee|glossdef"/>
</xsl:template>
<xsl:template match="glossentry/glossterm">
<xsl:apply-templates/>
<xsl:if test="following-sibling::glossterm">, </xsl:if>
</xsl:template>
<xsl:template match="glossentry/acronym">
<xsl:apply-templates/>
<xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
</xsl:template>
<xsl:template match="glossentry/abbrev">
<xsl:apply-templates/>
<xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
</xsl:template>
<xsl:template match="glossentry/revhistory">
</xsl:template>
<xsl:template match="glossentry/glosssee">
<xsl:variable name="otherterm" select="@otherterm"/>
<xsl:variable name="targets" select="key('id', $otherterm)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:variable name="xlink" select="@xlink:href"/>
<dd>
<p>
<xsl:variable name="template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'glossary'"/>
<xsl:with-param name="name" select="'see'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$target">
<a>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$target" mode="xref-to"/>
</a>
</xsl:when>
<xsl:when test="$xlink">
<xsl:call-template name="simple.xlink">
<xsl:with-param name="content">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$otherterm != '' and not($target)">
<xsl:message>
<xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
<xsl:value-of select="$otherterm"/>
</xsl:message>
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
</p>
</dd>
</xsl:template>
<xsl:template match="glossentry/glossdef">
<dd>
<xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
<xsl:if test="glossseealso">
<p>
<xsl:variable name="template">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'glossary'"/>
<xsl:with-param name="name" select="'seealso'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:apply-templates select="glossseealso"/>
</xsl:variable>
<xsl:call-template name="substitute-markup">
<xsl:with-param name="template" select="$template"/>
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
</p>
</xsl:if>
</dd>
</xsl:template>
<xsl:template match="glossseealso">
<xsl:variable name="otherterm" select="@otherterm"/>
<xsl:variable name="targets" select="key('id', $otherterm)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:variable name="xlink" select="@xlink:href"/>
<xsl:choose>
<xsl:when test="$target">
<a>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates select="$target" mode="xref-to"/>
</a>
</xsl:when>
<xsl:when test="$xlink">
<xsl:call-template name="simple.xlink">
<xsl:with-param name="content">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$otherterm != '' and not($target)">
<xsl:message>
<xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
<xsl:value-of select="$otherterm"/>
</xsl:message>
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="position() = last()"/>
<xsl:otherwise>
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="'glossary'"/>
<xsl:with-param name="name" select="'seealso-separator'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- Glossary collection -->
<xsl:template match="glossary[@role='auto']" priority="2">
&setup-language-variable;
<xsl:variable name="terms"
select="//glossterm[not(parent::glossdef)]|//firstterm"/>
<xsl:variable name="collection" select="document($glossary.collection, .)"/>
<xsl:call-template name="id.warning"/>
<xsl:if test="$glossary.collection = ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary </xsl:text>
<xsl:text>without a glossary.collection file.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:if test="not($collection) and $glossary.collection != ''">
<xsl:message>
<xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
<xsl:text>open glossary.collection file '</xsl:text>
<xsl:value-of select="$glossary.collection"/>
<xsl:text>'</xsl:text>
</xsl:message>
</xsl:if>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="glossary.titlepage"/>
<xsl:choose>
<xsl:when test="glossdiv and $collection//glossdiv">
<xsl:for-each select="$collection//glossdiv">
<!-- first see if there are any in this div -->
<xsl:variable name="exist.test">
<xsl:for-each select="glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:value-of select="glossterm"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$exist.test != ''">
<xsl:apply-templates select="." mode="auto-glossary">
<xsl:with-param name="terms" select="$terms"/>
</xsl:apply-templates>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:for-each select="$collection//glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$collection//glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</dl>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="*" mode="auto-glossary">
<!-- pop back out to the default mode for most elements -->
<xsl:apply-templates select="."/>
</xsl:template>
<xsl:template match="glossdiv" mode="auto-glossary">
<xsl:param name="terms" select="."/>
&setup-language-variable;
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
<dl>
<xsl:choose>
<xsl:when test="$glossary.sort != 0">
<xsl:for-each select="glossentry">
<xsl:sort lang="{$language}" select="normalize-space(translate(concat(@sortas, glossterm[not(parent::glossentry/@sortas) or parent::glossentry/@sortas = '']), &lowercase;, &uppercase;))"/>
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="glossentry">
<xsl:variable name="cterm" select="glossterm"/>
<xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
<xsl:apply-templates select="." mode="auto-glossary"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</dl>
</div>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

1568
build/xsl/html/graphics.xsl Normal file

File diff suppressed because it is too large Load Diff

336
build/xsl/html/html-rtf.xsl Normal file
View File

@ -0,0 +1,336 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:set="http://exslt.org/sets"
exclude-result-prefixes="exsl set"
version="1.0">
<!-- ********************************************************************
$Id: html-rtf.xsl 8345 2009-03-16 06:44:07Z 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.
******************************************************************** -->
<!-- ==================================================================== -->
<!-- This module contains templates that match against HTML nodes. It is used
to post-process result tree fragments for some sorts of cleanup.
These templates can only ever be fired by a processor that supports
exslt:node-set(). -->
<!-- ==================================================================== -->
<!-- insert.html.p mode templates insert a particular RTF at the beginning
of the first paragraph in the primary RTF. -->
<xsl:template match="/" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:apply-templates mode="insert.html.p">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="insert.html.p">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml"
match="html:p|p" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:if test="not(preceding::p|preceding::html:p)">
<xsl:copy-of select="$mark"/>
</xsl:if>
<xsl:apply-templates mode="insert.html.p">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.p">
<xsl:param name="mark" select="'?'"/>
<xsl:copy/>
</xsl:template>
<!-- ==================================================================== -->
<!-- insert.html.text mode templates insert a particular RTF at the beginning
of the first text-node in the primary RTF. -->
<xsl:template match="/" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:apply-templates mode="insert.html.text">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="insert.html.text">
<xsl:with-param name="mark" select="$mark"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:if test="not(preceding::text())">
<xsl:copy-of select="$mark"/>
</xsl:if>
<xsl:copy/>
</xsl:template>
<xsl:template match="processing-instruction()|comment()" mode="insert.html.text">
<xsl:param name="mark" select="'?'"/>
<xsl:copy/>
</xsl:template>
<!-- ==================================================================== -->
<!-- unwrap.p mode templates remove blocks from HTML p elements (and
other places where blocks aren't allowed) -->
<xsl:template name="unwrap.p">
<xsl:param name="p"/>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0
and function-available('set:leading')
and function-available('set:trailing')">
<xsl:apply-templates select="exsl:node-set($p)" mode="unwrap.p"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$p"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml"
match="html:p|p" mode="unwrap.p">
<!-- xmlns:html is necessary for the xhtml stylesheet case -->
<xsl:variable name="blocks" xmlns:html="http://www.w3.org/1999/xhtml"
select="address|blockquote|div|hr|h1|h2|h3|h4|h5|h6
|layer|p|pre|table|dl|menu|ol|ul|form
|html:address|html:blockquote|html:div|html:hr
|html:h1|html:h2|html:h3|html:h4|html:h5|html:h6
|html:layer|html:p|html:pre|html:table|html:dl
|html:menu|html:ol|html:ul|html:form"/>
<xsl:choose>
<xsl:when test="$blocks">
<xsl:call-template name="unwrap.p.nodes">
<xsl:with-param name="wrap" select="."/>
<xsl:with-param name="first" select="1"/>
<xsl:with-param name="nodes" select="node()"/>
<xsl:with-param name="blocks" select="$blocks"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="unwrap.p"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*" mode="unwrap.p">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="unwrap.p"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="unwrap.p">
<xsl:copy/>
</xsl:template>
<xsl:template name="unwrap.p.nodes">
<xsl:param name="wrap" select="."/>
<xsl:param name="first" select="0"/>
<xsl:param name="nodes"/>
<xsl:param name="blocks"/>
<xsl:variable name="block" select="$blocks[1]"/>
<!-- This template should never get called if these functions aren't available -->
<!-- but this test is still necessary so that processors don't choke on the -->
<!-- function calls if they don't support the set: functions -->
<xsl:if test="function-available('set:leading')
and function-available('set:trailing')">
<xsl:choose>
<xsl:when test="$blocks">
<xsl:variable name="leading" select="set:leading($nodes,$block)"/>
<xsl:variable name="trailing" select="set:trailing($nodes,$block)"/>
<xsl:if test="(($wrap/@id or $wrap/@xml:id)
and $first = 1) or $leading">
<xsl:element name="{local-name($wrap)}" namespace="{namespace-uri($wrap)}">
<xsl:for-each select="$wrap/@*">
<xsl:if test="$first != 0 or local-name(.) != 'id'">
<xsl:copy/>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates select="$leading" mode="unwrap.p"/>
</xsl:element>
</xsl:if>
<xsl:apply-templates select="$block" mode="unwrap.p"/>
<xsl:if test="$trailing">
<xsl:call-template name="unwrap.p.nodes">
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="nodes" select="$trailing"/>
<xsl:with-param name="blocks" select="$blocks[position() &gt; 1]"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="(($wrap/@id or $wrap/@xml:id) and $first = 1) or $nodes">
<xsl:element name="{local-name($wrap)}" namespace="{namespace-uri($wrap)}">
<xsl:for-each select="$wrap/@*">
<xsl:if test="$first != 0 or local-name(.) != 'id'">
<xsl:copy/>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates select="$nodes" mode="unwrap.p"/>
</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<!-- make.verbatim.mode replaces spaces and newlines -->
<xsl:template match="/" mode="make.verbatim.mode">
<xsl:apply-templates mode="make.verbatim.mode"/>
</xsl:template>
<xsl:template match="*" mode="make.verbatim.mode">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="make.verbatim.mode"/>
</xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction()|comment()" mode="make.verbatim.mode">
<xsl:copy/>
</xsl:template>
<xsl:template match="text()" mode="make.verbatim.mode">
<xsl:variable name="text" select="translate(., ' ', '&#160;')"/>
<xsl:choose>
<xsl:when test="not(contains($text, '&#xA;'))">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="len" select="string-length($text)"/>
<xsl:choose>
<xsl:when test="$len = 1">
<br/><xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="half" select="$len div 2"/>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text" select="substring($text, 1, $half)"/>
</xsl:call-template>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text"
select="substring($text, ($half + 1), $len)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="make-verbatim-recursive">
<xsl:param name="text" select="''"/>
<xsl:choose>
<xsl:when test="not(contains($text, '&#xA;'))">
<xsl:value-of select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="len" select="string-length($text)"/>
<xsl:choose>
<xsl:when test="$len = 1">
<br/><xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="half" select="$len div 2"/>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text" select="substring($text, 1, $half)"/>
</xsl:call-template>
<xsl:call-template name="make-verbatim-recursive">
<xsl:with-param name="text"
select="substring($text, ($half + 1), $len)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- remove.empty.div mode templates remove empty blocks -->
<xsl:template name="remove.empty.div">
<xsl:param name="div"/>
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<xsl:apply-templates select="exsl:node-set($div)" mode="remove.empty.div"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$div"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template xmlns:html="http://www.w3.org/1999/xhtml"
match="html:p|p|html:div|div" mode="remove.empty.div">
<xsl:if test="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="remove.empty.div"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="remove.empty.div">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="remove.empty.div"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()|processing-instruction()|comment()" mode="remove.empty.div">
<xsl:copy/>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

698
build/xsl/html/html.xsl Normal file
View File

@ -0,0 +1,698 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: html.xsl 9306 2012-04-28 03:49:00Z 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.
******************************************************************** -->
<!-- These variables set the align attribute value for HTML output based on
the writing-mode specified in the gentext file for the document's lang. -->
<xsl:variable name="direction.align.start">
<xsl:choose>
<xsl:when test="starts-with($writing.mode, 'lr')">left</xsl:when>
<xsl:when test="starts-with($writing.mode, 'rl')">right</xsl:when>
<xsl:otherwise>left</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="direction.align.end">
<xsl:choose>
<xsl:when test="starts-with($writing.mode, 'lr')">right</xsl:when>
<xsl:when test="starts-with($writing.mode, 'rl')">left</xsl:when>
<xsl:otherwise>right</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="direction.mode">
<xsl:choose>
<xsl:when test="starts-with($writing.mode, 'lr')">ltr</xsl:when>
<xsl:when test="starts-with($writing.mode, 'rl')">rtl</xsl:when>
<xsl:otherwise>ltr</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Support switching to <section> for HTML5 stylesheet -->
<!-- This is an internal variable that does not need to be set by a user -->
<xsl:variable name="div.element">div</xsl:variable>
<!-- Support turning off table border with border="" for HTML5 -->
<xsl:variable name="table.border.off">0</xsl:variable>
<!-- The generate.html.title template is currently used for generating HTML -->
<!-- "title" attributes for some inline elements only, but not for any -->
<!-- block elements. It is called in eleven places in the inline.xsl -->
<!-- file. But it's called by all the inline.* templates (e.g., -->
<!-- inline.boldseq), which in turn are called by other (element) -->
<!-- templates, so it results, currently, in supporting generation of the -->
<!-- HTML "title" attribute for a total of about 92 elements. -->
<!-- You can use mode="html.title.attribute" to get a title for -->
<!-- an element specified by a param, including targets of cross references. -->
<xsl:template name="generate.html.title">
<xsl:apply-templates select="." mode="html.title.attribute"/>
</xsl:template>
<xsl:template match="acronym|abbrev" mode="html.title.attribute">
<xsl:if test="alt">
<xsl:attribute name="title">
<xsl:value-of select="normalize-space(alt)"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- Generate a title attribute for the context node -->
<!-- This may be the target of an xref -->
<xsl:template match="*" mode="html.title.attribute">
<xsl:variable name="is.title">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'title'"/>
<xsl:with-param name="name" select="local-name(.)"/>
<xsl:with-param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="is.title-numbered">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'title-numbered'"/>
<xsl:with-param name="name" select="local-name(.)"/>
<xsl:with-param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="is.title-unnumbered">
<xsl:call-template name="gentext.template.exists">
<xsl:with-param name="context" select="'title-unnumbered'"/>
<xsl:with-param name="name" select="local-name(.)"/>
<xsl:with-param name="lang">
<xsl:call-template name="l10n.language"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="has.title.markup">
<xsl:apply-templates select="." mode="title.markup">
<xsl:with-param name="verbose" select="0"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="gentext.title">
<xsl:if test="$has.title.markup != '???TITLE???' and
($is.title != 0 or
$is.title-numbered != 0 or
$is.title-unnumbered != 0)">
<xsl:apply-templates select="."
mode="object.title.markup.textonly"/>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($gentext.title) != 0">
<xsl:attribute name="title">
<xsl:value-of select="$gentext.title"/>
</xsl:attribute>
</xsl:when>
<!-- Fall back to alt if available -->
<xsl:when test="alt">
<xsl:attribute name="title">
<xsl:value-of select="normalize-space(alt)"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="qandaentry" mode="html.title.attribute">
<xsl:apply-templates select="question" mode="html.title.attribute"/>
</xsl:template>
<xsl:template match="question" mode="html.title.attribute">
<xsl:variable name="label.text">
<xsl:apply-templates select="." mode="qanda.label"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($label.text) != 0">
<xsl:attribute name="title">
<xsl:value-of select="$label.text"/>
</xsl:attribute>
</xsl:when>
<!-- Fall back to alt if available -->
<xsl:when test="alt">
<xsl:attribute name="title">
<xsl:value-of select="normalize-space(alt)"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="dir">
<xsl:param name="inherit" select="0"/>
<xsl:variable name="dir">
<xsl:choose>
<xsl:when test="@dir">
<xsl:value-of select="@dir"/>
</xsl:when>
<xsl:when test="$inherit != 0">
<xsl:value-of select="ancestor::*/@dir[1]"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="$dir != ''">
<xsl:attribute name="dir">
<xsl:value-of select="$dir"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template name="anchor">
<xsl:param name="node" select="."/>
<xsl:param name="conditional" select="1"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes != 0">
<!-- No named anchors output when this param is set -->
</xsl:when>
<xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
<a>
<xsl:attribute name="name">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$node"/>
</xsl:call-template>
</xsl:attribute>
</a>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="id.attribute">
<xsl:param name="node" select="."/>
<xsl:param name="conditional" select="1"/>
<xsl:choose>
<xsl:when test="$generate.id.attributes = 0">
<!-- No id attributes when this param is zero -->
</xsl:when>
<xsl:when test="$conditional = 0 or $node/@id or $node/@xml:id">
<xsl:attribute name="id">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$node"/>
</xsl:call-template>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="href.target.uri">
<xsl:param name="context" select="."/>
<xsl:param name="object" select="."/>
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$object"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="href.target">
<xsl:param name="context" select="."/>
<xsl:param name="object" select="."/>
<xsl:text>#</xsl:text>
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$object"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="href.target.with.base.dir">
<xsl:param name="context" select="."/>
<xsl:param name="object" select="."/>
<xsl:if test="$manifest.in.base.dir = 0">
<xsl:value-of select="$chunk.base.dir"/>
</xsl:if>
<xsl:call-template name="href.target">
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="object" select="$object"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="dingbat">
<xsl:param name="dingbat">bullet</xsl:param>
<xsl:call-template name="dingbat.characters">
<xsl:with-param name="dingbat" select="$dingbat"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="dingbat.characters">
<!-- now that I'm using the real serializer, all that dingbat malarky -->
<!-- isn't necessary anymore... -->
<xsl:param name="dingbat">bullet</xsl:param>
<xsl:choose>
<xsl:when test="$dingbat='bullet'">&#x2022;</xsl:when>
<xsl:when test="$dingbat='copyright'">&#x00A9;</xsl:when>
<xsl:when test="$dingbat='trademark'">&#x2122;</xsl:when>
<xsl:when test="$dingbat='trade'">&#x2122;</xsl:when>
<xsl:when test="$dingbat='registered'">&#x00AE;</xsl:when>
<xsl:when test="$dingbat='service'">(SM)</xsl:when>
<xsl:when test="$dingbat='nbsp'">&#x00A0;</xsl:when>
<xsl:when test="$dingbat='ldquo'">&#x201C;</xsl:when>
<xsl:when test="$dingbat='rdquo'">&#x201D;</xsl:when>
<xsl:when test="$dingbat='lsquo'">&#x2018;</xsl:when>
<xsl:when test="$dingbat='rsquo'">&#x2019;</xsl:when>
<xsl:when test="$dingbat='em-dash'">&#x2014;</xsl:when>
<xsl:when test="$dingbat='mdash'">&#x2014;</xsl:when>
<xsl:when test="$dingbat='en-dash'">&#x2013;</xsl:when>
<xsl:when test="$dingbat='ndash'">&#x2013;</xsl:when>
<xsl:otherwise>
<xsl:text>&#x2022;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="id.warning">
<xsl:if test="$id.warnings != 0 and not(@id) and not(@xml:id) and parent::*">
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="title">
<xsl:value-of select="title[1]"/>
</xsl:when>
<xsl:when test="substring(local-name(*[1]),
string-length(local-name(*[1])-3) = 'info')
and *[1]/title">
<xsl:value-of select="*[1]/title[1]"/>
</xsl:when>
<xsl:when test="refmeta/refentrytitle">
<xsl:value-of select="refmeta/refentrytitle"/>
</xsl:when>
<xsl:when test="refnamediv/refname">
<xsl:value-of select="refnamediv/refname[1]"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:message>
<xsl:text>ID recommended on </xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:if test="$title != ''">
<xsl:text>: </xsl:text>
<xsl:choose>
<xsl:when test="string-length($title) &gt; 40">
<xsl:value-of select="substring($title,1,40)"/>
<xsl:text>...</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:message>
</xsl:if>
</xsl:template>
<xsl:template name="generate.class.attribute">
<xsl:param name="class" select="local-name(.)"/>
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="$class"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="class.attribute">
<xsl:param name="class" select="local-name(.)"/>
<!-- permit customization of class attributes -->
<!-- Use element name by default -->
<xsl:variable name="class.value">
<xsl:apply-templates select="." mode="class.value">
<xsl:with-param name="class" select="$class"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:if test="string-length(normalize-space($class.value)) != 0">
<xsl:attribute name="class">
<xsl:value-of select="$class.value"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="class.value">
<xsl:param name="class" select="local-name(.)"/>
<!-- permit customization of class value only -->
<!-- Use element name by default -->
<xsl:value-of select="$class"/>
</xsl:template>
<!-- Apply common attributes such as class, lang, dir -->
<xsl:template name="common.html.attributes">
<xsl:param name="inherit" select="0"/>
<xsl:param name="class" select="local-name(.)"/>
<xsl:apply-templates select="." mode="common.html.attributes">
<xsl:with-param name="class" select="$class"/>
<xsl:with-param name="inherit" select="$inherit"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="common.html.attributes">
<xsl:param name="class" select="local-name(.)"/>
<xsl:param name="inherit" select="0"/>
<xsl:call-template name="generate.html.lang"/>
<xsl:call-template name="dir">
<xsl:with-param name="inherit" select="$inherit"/>
</xsl:call-template>
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="$class"/>
</xsl:apply-templates>
</xsl:template>
<!-- Apply common attributes not including class -->
<xsl:template name="locale.html.attributes">
<xsl:apply-templates select="." mode="locale.html.attributes"/>
</xsl:template>
<xsl:template match="*" mode="locale.html.attributes">
<xsl:call-template name="generate.html.lang"/>
<xsl:call-template name="dir"/>
</xsl:template>
<!-- Pass through any lang attributes -->
<xsl:template name="generate.html.lang">
<xsl:apply-templates select="." mode="html.lang.attribute"/>
</xsl:template>
<xsl:template match="*" mode="html.lang.attribute">
<!-- match the attribute name to the output type -->
<xsl:choose>
<xsl:when test="@lang and $stylesheet.result.type = 'html'">
<xsl:attribute name="lang">
<xsl:value-of select="@lang"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@lang and $stylesheet.result.type = 'xhtml'">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@lang"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@xml:lang and $stylesheet.result.type = 'html'">
<xsl:attribute name="lang">
<xsl:value-of select="@xml:lang"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@xml:lang and $stylesheet.result.type = 'xhtml'">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@xml:lang"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- Insert link to css or insert literal CSS in head element -->
<xsl:template name="generate.css">
<xsl:choose>
<xsl:when test="$generate.css.header = 0">
<xsl:call-template name="generate.css.links"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="generate.css.headers"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="generate.css.headers">
<xsl:call-template name="generate.default.css.header"/>
<xsl:call-template name="generate.custom.css.header"/>
</xsl:template>
<xsl:template name="generate.default.css.header">
<xsl:if test="$make.clean.html != 0 and
$docbook.css.source != ''">
<!-- Select default file relative to stylesheet -->
<xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
<xsl:call-template name="output.css.header">
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.custom.css.header">
<xsl:if test="$custom.css.source != ''">
<!-- Select custom file relative to document -->
<xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
<xsl:call-template name="output.css.header">
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="output.css.header">
<xsl:param name="css.node"/>
<xsl:choose>
<xsl:when test="count($css.node) = 0">
</xsl:when>
<xsl:otherwise>
<style type="text/css">
<xsl:copy-of select="$css.node/text()"/>
</style>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="generate.css.links">
<xsl:call-template name="generate.default.css.link"/>
<xsl:call-template name="generate.custom.css.link"/>
</xsl:template>
<xsl:template name="generate.default.css.link">
<xsl:if test="$make.clean.html != 0 and
$docbook.css.link != 0 and
$docbook.css.source != ''">
<xsl:variable name="filename">
<xsl:call-template name="css.output.filename">
<xsl:with-param name="src" select="$docbook.css.source"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="make.css.link">
<xsl:with-param name="css.filename" select="$filename"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.custom.css.link">
<xsl:if test="$custom.css.source != ''">
<xsl:variable name="filename">
<xsl:call-template name="css.output.filename">
<xsl:with-param name="src" select="$custom.css.source"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="make.css.link">
<xsl:with-param name="css.filename" select="$filename"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- a CSS link reference must take into account the relative
path to a CSS file when chunked HTML is output to more than one directory -->
<xsl:template name="make.css.link">
<xsl:param name="css.filename" select="''"/>
<xsl:variable name="href">
<xsl:call-template name="relative.path.link">
<xsl:with-param name="target.pathname" select="$css.filename"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length($css.filename) != 0">
<link rel="stylesheet"
type="text/css"
href="{$href}"/>
</xsl:if>
</xsl:template>
<!-- And the same applies to script links -->
<xsl:template name="make.script.link">
<xsl:param name="script.filename" select="''"/>
<xsl:variable name="src">
<xsl:call-template name="relative.path.link">
<xsl:with-param name="target.pathname" select="$script.filename"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="string-length($script.filename) != 0">
<script>
<xsl:attribute name="src">
<xsl:value-of select="$src"/>
</xsl:attribute>
<xsl:attribute name="type">
<xsl:value-of select="$html.script.type"/>
</xsl:attribute>
<xsl:call-template name="other.script.attributes">
<xsl:with-param name="script.filename" select="$script.filename"/>
</xsl:call-template>
</script>
</xsl:if>
</xsl:template>
<xsl:template name="other.script.attributes">
<xsl:param name="script.filename"/>
<!-- Placeholder template to allow customization to
insert additional script element attributes if needed -->
</xsl:template>
<xsl:template name="relative.path.link">
<xsl:param name="target.pathname"/>
<xsl:variable name="href.to.uri" select="$target.pathname"/>
<xsl:variable name="href.from.uri">
<xsl:call-template name="href.target.uri">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href.to">
<xsl:call-template name="trim.common.uri.paths">
<xsl:with-param name="uriA" select="$href.to.uri"/>
<xsl:with-param name="uriB" select="$href.from.uri"/>
<xsl:with-param name="return" select="'A'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href.from">
<xsl:call-template name="trim.common.uri.paths">
<xsl:with-param name="uriA" select="$href.to.uri"/>
<xsl:with-param name="uriB" select="$href.from.uri"/>
<xsl:with-param name="return" select="'B'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="depth">
<xsl:call-template name="count.uri.path.depth">
<xsl:with-param name="filename" select="$href.from"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href">
<xsl:call-template name="copy-string">
<xsl:with-param name="string" select="'../'"/>
<xsl:with-param name="count" select="$depth"/>
</xsl:call-template>
<xsl:value-of select="$href.to"/>
</xsl:variable>
<xsl:value-of select="$href"/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="generate.css.files">
<xsl:call-template name="generate.default.css.file"/>
<xsl:call-template name="generate.custom.css.file"/>
</xsl:template>
<xsl:template name="generate.default.css.file">
<xsl:if test="$make.clean.html != 0 and
$generate.css.header = 0 and
$docbook.css.source != ''">
<!-- Select default file relative to stylesheet -->
<xsl:variable name="css.node" select="document($docbook.css.source)/*[1]"/>
<xsl:call-template name="generate.css.file">
<xsl:with-param name="src" select="$docbook.css.source"/>
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.custom.css.file">
<xsl:if test="$custom.css.source != '' and
$generate.css.header = 0">
<!-- Select custom file relative to document -->
<xsl:variable name="css.node" select="document($custom.css.source,.)/*[1]"/>
<xsl:call-template name="generate.css.file">
<xsl:with-param name="src" select="$custom.css.source"/>
<xsl:with-param name="css.node" select="$css.node"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="generate.css.file">
<xsl:param name="css.node"/>
<xsl:param name="src" select="''"/>
<xsl:variable name="css.text" select="$css.node/text()"/>
<xsl:choose>
<xsl:when test="count($css.node) = 0">
<xsl:message>
<xsl:text>ERROR: no root element for CSS source file'</xsl:text>
<xsl:value-of select="$src"/>
<xsl:text>'.</xsl:text>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="filename">
<xsl:call-template name="css.output.pathname">
<xsl:with-param name="src" select="$src"/>
<xsl:with-param name="content" select="$css.node"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="write.text.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="content" select="$css.text"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="css.output.filename">
<xsl:param name="content"/>
<xsl:param name="src" select="''"/>
<xsl:variable name="candidate">
<xsl:choose>
<xsl:when test="string-length($src) = 0">
<xsl:message>
<xsl:text>ERROR: missing CSS input filename.</xsl:text>
</xsl:message>
</xsl:when>
<xsl:when test="substring($src,string-length($src)-3) = '.xml'">
<xsl:value-of select="substring($src, 1, string-length($src) - 4)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$src"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$candidate"/>
</xsl:template>
<xsl:template name="css.output.pathname">
<xsl:param name="content"/>
<xsl:param name="src" select="''"/>
<xsl:variable name="file">
<xsl:call-template name="css.output.filename">
<xsl:with-param name="content" select="$content"/>
<xsl:with-param name="src" select="$src"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="path" select="concat($chunk.base.dir, $file)"/>
<xsl:value-of select="$path"/>
</xsl:template>
</xsl:stylesheet>

136
build/xsl/html/htmltbl.xsl Normal file
View File

@ -0,0 +1,136 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- ********************************************************************
$Id: htmltbl.xsl 9140 2011-10-30 03:42:11Z 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="table" mode="htmlTable">
<xsl:element name="table" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:attribute name="id">
<xsl:call-template name="object.id"/>
</xsl:attribute>
<xsl:call-template name="htmlTable"/>
</xsl:element>
</xsl:template>
<xsl:template match="colgroup" mode="htmlTable">
<xsl:element name="{local-name()}" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:apply-templates mode="htmlTable"/>
</xsl:element>
</xsl:template>
<xsl:template match="col" mode="htmlTable">
<xsl:element name="{local-name()}" namespace="">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
</xsl:element>
</xsl:template>
<!-- Handled by formal.object.title template -->
<xsl:template match="caption" mode="htmlTable"/>
<xsl:template match="tbody|thead|tfoot|tr" mode="htmlTable">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:apply-templates mode="htmlTable"/>
</xsl:element>
</xsl:template>
<xsl:template match="th|td" mode="htmlTable">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@*" mode="htmlTableAtt"/>
<xsl:apply-templates/> <!-- *not* mode=htmlTable -->
</xsl:element>
</xsl:template>
<!-- don't copy through DocBook-specific attributes on HTML table markup -->
<!-- default behavior is to not copy through because there are more
DocBook attributes than HTML attributes -->
<xsl:template mode="htmlTableAtt" match="@*"/>
<!-- copy these through -->
<xsl:template mode="htmlTableAtt"
match="@abbr
| @align
| @axis
| @bgcolor
| @border
| @cellpadding
| @cellspacing
| @char
| @charoff
| @class
| @dir
| @frame
| @headers
| @height
| @lang
| @nowrap
| @onclick
| @ondblclick
| @onkeydown
| @onkeypress
| @onkeyup
| @onmousedown
| @onmousemove
| @onmouseout
| @onmouseover
| @onmouseup
| @rules
| @style
| @summary
| @title
| @valign
| @valign
| @width
| @xml:lang">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="@span|@rowspan|@colspan" mode="htmlTableAtt">
<!-- No need to copy through the DTD's default value "1" of the attribute -->
<xsl:if test="number(.) != 1">
<xsl:attribute name="{local-name(.)}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- map floatstyle to HTML float values -->
<xsl:template match="@floatstyle" mode="htmlTableAtt">
<xsl:attribute name="style">
<xsl:text>float: </xsl:text>
<xsl:choose>
<xsl:when test="contains(., 'left')">left</xsl:when>
<xsl:when test="contains(., 'right')">right</xsl:when>
<xsl:when test="contains(., 'start')">
<xsl:value-of select="$direction.align.start"/>
</xsl:when>
<xsl:when test="contains(., 'end')">
<xsl:value-of select="$direction.align.end"/>
</xsl:when>
<xsl:when test="contains(., 'inside')">
<xsl:value-of select="$direction.align.start"/>
</xsl:when>
<xsl:when test="contains(., 'outside')">
<xsl:value-of select="$direction.align.end"/>
</xsl:when>
<xsl:when test="contains(., 'before')">none</xsl:when>
<xsl:when test="contains(., 'none')">none</xsl:when>
</xsl:choose>
<xsl:text>;</xsl:text>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>

279
build/xsl/html/index.xsl Normal file
View File

@ -0,0 +1,279 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: index.xsl 9297 2012-04-22 03:56:16Z 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="index">
<!-- some implementations use completely empty index tags to indicate -->
<!-- where an automatically generated index should be inserted. so -->
<!-- if the index is completely empty, skip it. Unless generate.index -->
<!-- is non-zero, in which case, this is where the automatically -->
<!-- generated index should go. -->
<xsl:call-template name="id.warning"/>
<xsl:if test="count(*)>0 or $generate.index != '0'">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="index.titlepage"/>
<xsl:choose>
<xsl:when test="indexdiv">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[not(self::indexentry)]"/>
<!-- Because it's actually valid for Index to have neither any -->
<!-- Indexdivs nor any Indexentries, we need to check and make -->
<!-- sure that at least one Indexentry exists, and generate a -->
<!-- wrapper dl if there is at least one; otherwise, do nothing. -->
<xsl:if test="indexentry">
<!-- The indexentry template assumes a parent dl wrapper has -->
<!-- been generated; for Indexes that have Indexdivs, the dl -->
<!-- wrapper is generated by the indexdiv template; however, -->
<!-- for Indexes that lack Indexdivs, if we don't generate a -->
<!-- dl here, HTML output will not be valid. -->
<dl>
<xsl:apply-templates select="indexentry"/>
</dl>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
<xsl:call-template name="generate-index">
<xsl:with-param name="scope" select="(ancestor::book|/)[last()]"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="setindex">
<!-- some implementations use completely empty index tags to indicate -->
<!-- where an automatically generated index should be inserted. so -->
<!-- if the index is completely empty, skip it. Unless generate.index -->
<!-- is non-zero, in which case, this is where the automatically -->
<!-- generated index should go. -->
<xsl:call-template name="id.warning"/>
<xsl:if test="count(*)>0 or $generate.index != '0'">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="setindex.titlepage"/>
<xsl:apply-templates/>
<xsl:if test="count(indexentry) = 0 and count(indexdiv) = 0">
<xsl:call-template name="generate-index">
<xsl:with-param name="scope" select="/"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(parent::article)">
<xsl:call-template name="process.footnotes"/>
</xsl:if>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="index/indexinfo"></xsl:template>
<xsl:template match="index/info"></xsl:template>
<xsl:template match="index/title"></xsl:template>
<xsl:template match="index/subtitle"></xsl:template>
<xsl:template match="index/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="indexdiv">
<xsl:call-template name="id.warning"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:apply-templates select="*[not(self::indexentry)]"/>
<dl>
<xsl:apply-templates select="indexentry"/>
</dl>
</div>
</xsl:template>
<xsl:template match="indexdiv/title">
<h3>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</h3>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="indexterm">
<!-- this one must have a name, even if it doesn't have an ID -->
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<a class="indexterm" name="{$id}"/>
</xsl:template>
<xsl:template match="primary|secondary|tertiary|see|seealso">
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="indexentry">
<xsl:apply-templates select="primaryie"/>
</xsl:template>
<xsl:template match="primaryie">
<dt>
<xsl:apply-templates/>
</dt>
<dd>
<xsl:apply-templates select="following-sibling::seeie
[not(preceding-sibling::secondaryie)]"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::seealsoie
[not(preceding-sibling::secondaryie)]"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::secondaryie"
mode="indexentry"/>
</dd>
</xsl:template>
<!-- Handled in mode to convert flat list to structured output -->
<xsl:template match="secondaryie">
</xsl:template>
<xsl:template match="tertiaryie">
</xsl:template>
<xsl:template match="seeie|seealsoie">
</xsl:template>
<xsl:template match="secondaryie" mode="indexentry">
<dl>
<dt>
<xsl:apply-templates/>
</dt>
<dd>
<!-- select following see* elements up to next secondaryie or tertiary or end -->
<xsl:variable name="after.this"
select="following-sibling::*"/>
<xsl:variable name="next.entry"
select="(following-sibling::secondaryie|following-sibling::tertiaryie)[1]"/>
<xsl:variable name="before.entry"
select="$next.entry/preceding-sibling::*"/>
<xsl:variable name="see.intersection"
select="$after.this[count(.|$before.entry) = count($before.entry)]
[self::seeie or self::seealsoie]"/>
<xsl:choose>
<xsl:when test="count($see.intersection) != 0">
<xsl:apply-templates select="$see.intersection" mode="indexentry"/>
</xsl:when>
<xsl:when test="count($next.entry) = 0">
<xsl:apply-templates select="following-sibling::seeie"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::seealsoie"
mode="indexentry"/>
</xsl:when>
</xsl:choose>
<!-- now process any tertiaryie before the next secondaryie -->
<xsl:variable name="before.next.secondary"
select="following-sibling::secondaryie[1]/preceding-sibling::*"/>
<xsl:variable name="tertiary.intersection"
select="$after.this[count(.|$before.next.secondary) =
count($before.next.secondary)]
[not(self::seeie) and not(self::seealsoie)]"/>
<xsl:choose>
<xsl:when test="count($tertiary.intersection) != 0">
<xsl:apply-templates select="$tertiary.intersection"
mode="indexentry"/>
</xsl:when>
<xsl:when test="not(following-sibling::secondaryie)">
<xsl:apply-templates select="following-sibling::tertiaryie"
mode="indexentry"/>
</xsl:when>
</xsl:choose>
</dd>
</dl>
</xsl:template>
<xsl:template match="tertiaryie" mode="indexentry">
<dl>
<dt>
<xsl:apply-templates/>
</dt>
<dd>
<!-- select following see* elements up to next secondaryie or tertiary or end -->
<xsl:variable name="after.this"
select="following-sibling::*"/>
<xsl:variable name="next.entry"
select="(following-sibling::secondaryie|following-sibling::tertiaryie)[1]"/>
<xsl:variable name="before.entry"
select="$next.entry/preceding-sibling::*"/>
<xsl:variable name="see.intersection"
select="$after.this[count(.|$before.entry) = count($before.entry)]
[self::seeie or self::seealsoie]"/>
<xsl:choose>
<xsl:when test="count($see.intersection) != 0">
<xsl:apply-templates select="$see.intersection" mode="indexentry"/>
</xsl:when>
<xsl:when test="count($next.entry) = 0">
<xsl:apply-templates select="following-sibling::seeie"
mode="indexentry"/>
<xsl:apply-templates select="following-sibling::seealsoie"
mode="indexentry"/>
</xsl:when>
</xsl:choose>
</dd>
</dl>
</xsl:template>
<xsl:template match="seeie" mode="indexentry">
<dt>
<xsl:text>(</xsl:text>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'see'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text>)</xsl:text>
</dt>
</xsl:template>
<xsl:template match="seealsoie" mode="indexentry">
<div>
<xsl:text>(</xsl:text>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'seealso'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text>)</xsl:text>
</div>
</xsl:template>
</xsl:stylesheet>

45
build/xsl/html/info.xsl Normal file
View File

@ -0,0 +1,45 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: info.xsl 9297 2012-04-22 03:56:16Z 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.
******************************************************************** -->
<!-- These templates define the "default behavior" for info
elements. Even if you don't process the *info wrappers,
some of these elements are needed because the elements are
processed from named templates that are called with modes.
Since modes aren't sticky, these rules apply.
(TODO: clarify this comment) -->
<!-- ==================================================================== -->
<!-- called from named templates in a given mode -->
<xsl:template match="corpauthor">
<span>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="jobtitle">
<span>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

1518
build/xsl/html/inline.xsl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: keywords.xsl 6910 2007-06-28 23:23:30Z xmldoc $
********************************************************************
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="keywordset"></xsl:template>
<xsl:template match="subjectset"></xsl:template>
<!-- ==================================================================== -->
<xsl:template match="keywordset" mode="html.header">
<meta name="keywords">
<xsl:attribute name="content">
<xsl:apply-templates select="keyword" mode="html.header"/>
</xsl:attribute>
</meta>
</xsl:template>
<xsl:template match="keyword" mode="html.header">
<xsl:apply-templates/>
<xsl:if test="following-sibling::keyword">, </xsl:if>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

1287
build/xsl/html/lists.xsl Normal file

File diff suppressed because it is too large Load Diff

271
build/xsl/html/math.xsl Normal file
View File

@ -0,0 +1,271 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="mml"
version='1.0'>
<!-- ********************************************************************
$Id: math.xsl 9297 2012-04-22 03:56:16Z 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="inlineequation">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="alt">
</xsl:template>
<xsl:template match="mathphrase">
<span>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates/>
</span>
</xsl:template>
<!-- "Support" for MathML -->
<xsl:template match="mml:*" xmlns:mml="http://www.w3.org/1998/Math/MathML">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- Support for TeX math in alt -->
<xsl:template match="*" mode="collect.tex.math">
<xsl:call-template name="write.text.chunk">
<xsl:with-param name="filename" select="$tex.math.file"/>
<xsl:with-param name="method" select="'text'"/>
<xsl:with-param name="content">
<xsl:choose>
<xsl:when test="$tex.math.in.alt = 'plain'">
<xsl:call-template name="tex.math.plain.head"/>
<xsl:apply-templates select="." mode="collect.tex.math.plain"/>
<xsl:call-template name="tex.math.plain.tail"/>
</xsl:when>
<xsl:when test="$tex.math.in.alt = 'latex'">
<xsl:call-template name="tex.math.latex.head"/>
<xsl:apply-templates select="." mode="collect.tex.math.latex"/>
<xsl:call-template name="tex.math.latex.tail"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Unsupported TeX math notation:
<xsl:value-of select="$tex.math.in.alt"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="encoding" select="$chunker.output.encoding"/>
</xsl:call-template>
</xsl:template>
<!-- PlainTeX -->
<xsl:template name="tex.math.plain.head">
<xsl:text>\nopagenumbers &#xA;</xsl:text>
</xsl:template>
<xsl:template name="tex.math.plain.tail">
<xsl:text>\bye &#xA;</xsl:text>
</xsl:template>
<xsl:template match="inlineequation" mode="collect.tex.math.plain">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="inlinemediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\vfill\eject &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="equation|informalequation" mode="collect.tex.math.plain">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="mediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\vfill\eject &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="text()" mode="collect.tex.math.plain"/>
<!-- LaTeX -->
<xsl:template name="tex.math.latex.head">
<xsl:text>\documentclass{article} &#xA;</xsl:text>
<xsl:text>\pagestyle{empty} &#xA;</xsl:text>
<xsl:text>\begin{document} &#xA;</xsl:text>
</xsl:template>
<xsl:template name="tex.math.latex.tail">
<xsl:text>\end{document} &#xA;</xsl:text>
</xsl:template>
<xsl:template match="inlineequation" mode="collect.tex.math.latex">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="inlinemediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\newpage &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="equation|informalequation" mode="collect.tex.math.latex">
<xsl:variable name="filename">
<xsl:choose>
<xsl:when test="graphic">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="graphic"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="select.mediaobject.filename">
<xsl:with-param name="olist" select="mediaobject/*"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="output.delims">
<xsl:call-template name="tex.math.output.delims"/>
</xsl:variable>
<xsl:variable name="tex" select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
<xsl:if test="$tex">
<xsl:text>\special{dvi2bitmap outputfile </xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>} &#xA;</xsl:text>
<xsl:if test="$output.delims != 0">
<xsl:text>$$</xsl:text>
</xsl:if>
<xsl:value-of select="$tex"/>
<xsl:if test="$output.delims != 0">
<xsl:text>$$ &#xA;</xsl:text>
</xsl:if>
<xsl:text>\newpage &#xA;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="text()" mode="collect.tex.math.latex"/>
<!-- Extracting image filename from mediaobject and graphic elements -->
<xsl:template name="select.mediaobject.filename">
<xsl:param name="olist"
select="imageobject|imageobjectco
|videoobject|audioobject|textobject"/>
<xsl:variable name="mediaobject.index">
<xsl:call-template name="select.mediaobject.index">
<xsl:with-param name="olist" select="$olist"/>
<xsl:with-param name="count" select="1"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$mediaobject.index != ''">
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object"
select="$olist[position() = $mediaobject.index]"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="tex.math.output.delims">
<xsl:variable name="pi.delims">
<xsl:call-template name="pi.dbtex_delims">
<xsl:with-param name="node" select="descendant-or-self::*"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="result">
<xsl:choose>
<xsl:when test="$pi.delims = 'no'">0</xsl:when>
<xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$result"/>
</xsl:template>
</xsl:stylesheet>

447
build/xsl/html/param.xsl Normal file
View File

@ -0,0 +1,447 @@
<?xml version="1.0"?>
<!-- This file is generated from param.xweb -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- ********************************************************************
$Id: param.xweb 9333 2012-05-06 19:41:03Z dcramer $
********************************************************************
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:param name="abstract.notitle.enabled" select="0"/>
<xsl:param name="admon.graphics.extension">.png</xsl:param>
<xsl:param name="admon.graphics" select="0"/>
<xsl:param name="admon.graphics.path">images/</xsl:param>
<xsl:param name="admon.style">
<xsl:value-of select="concat('margin-', $direction.align.start, ': 0.5in; margin-', $direction.align.end, ': 0.5in;')"/>
</xsl:param>
<xsl:param name="admon.textlabel" select="1"/>
<xsl:param name="annotate.toc" select="1"/>
<xsl:param name="annotation.css">
/* ======================================================================
Annotations
*/
div.annotation-list { visibility: hidden;
}
div.annotation-nocss { position: absolute;
visibility: hidden;
}
div.annotation-popup { position: absolute;
z-index: 4;
visibility: hidden;
padding: 0px;
margin: 2px;
border-style: solid;
border-width: 1px;
width: 200px;
background-color: white;
}
div.annotation-title { padding: 1px;
font-weight: bold;
border-bottom-style: solid;
border-bottom-width: 1px;
color: white;
background-color: black;
}
div.annotation-body { padding: 2px;
}
div.annotation-body p { margin-top: 0px;
padding-top: 0px;
}
div.annotation-close { position: absolute;
top: 2px;
right: 2px;
}
</xsl:param>
<xsl:param name="annotation.graphic.close">
http://docbook.sourceforge.net/release/images/annot-close.png</xsl:param>
<xsl:param name="annotation.graphic.open">http://docbook.sourceforge.net/release/images/annot-open.png</xsl:param>
<xsl:param name="annotation.js">
<xsl:text>http://docbook.sourceforge.net/release/script/AnchorPosition.js http://docbook.sourceforge.net/release/script/PopupWindow.js</xsl:text></xsl:param>
<xsl:param name="annotation.support" select="0"/>
<xsl:param name="appendix.autolabel">A</xsl:param>
<xsl:param name="author.othername.in.middle" select="1"/>
<xsl:param name="autotoc.label.in.hyperlink" select="1"/>
<xsl:param name="autotoc.label.separator">. </xsl:param>
<xsl:param name="base.dir"/>
<xsl:param name="biblioentry.item.separator">. </xsl:param>
<xsl:param name="bibliography.collection">http://docbook.sourceforge.net/release/bibliography/bibliography.xml</xsl:param>
<xsl:param name="bibliography.numbered" select="0"/>
<xsl:param name="bibliography.style">normal</xsl:param>
<xsl:param name="blurb.on.titlepage.enabled" select="0"/>
<xsl:param name="bridgehead.in.toc" select="0"/>
<xsl:param name="callout.defaultcolumn">60</xsl:param>
<xsl:param name="callout.graphics.extension">.png</xsl:param>
<xsl:param name="callout.graphics" select="1"/>
<xsl:param name="callout.graphics.number.limit">15</xsl:param>
<xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
<xsl:param name="callout.list.table" select="1"/>
<xsl:param name="callout.unicode" select="0"/>
<xsl:param name="callout.unicode.number.limit">10</xsl:param>
<xsl:param name="callout.unicode.start.character">10102</xsl:param>
<xsl:param name="callouts.extension" select="1"/>
<xsl:param name="chapter.autolabel" select="1"/>
<xsl:param name="chunk.append"/>
<xsl:param name="chunk.first.sections" select="0"/>
<xsl:param name="chunk.quietly" select="0"/>
<xsl:param name="chunk.section.depth" select="1"/>
<xsl:param name="chunk.separate.lots" select="0"/>
<xsl:param name="chunk.toc"/>
<xsl:param name="chunk.tocs.and.lots" select="0"/>
<xsl:param name="chunk.tocs.and.lots.has.title" select="1"/>
<xsl:param name="chunked.filename.prefix"/>
<xsl:param name="citerefentry.link" select="0"/>
<xsl:param name="collect.xref.targets">no</xsl:param>
<xsl:param name="component.label.includes.part.label" select="0"/>
<xsl:param name="contrib.inline.enabled">1</xsl:param>
<xsl:param name="css.decoration" select="1"/>
<xsl:param name="current.docid"/>
<xsl:param name="custom.css.source"/>
<xsl:param name="default.float.class">
<xsl:choose>
<xsl:when test="contains($stylesheet.result.type,'html')">left</xsl:when>
<xsl:otherwise>before</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="default.image.width"/>
<xsl:param name="default.table.frame">all</xsl:param>
<xsl:param name="default.table.width"/>
<xsl:param name="docbook.css.link" select="1"/>
<xsl:param name="docbook.css.source">docbook.css.xml</xsl:param>
<xsl:param name="draft.mode">no</xsl:param>
<xsl:param name="draft.watermark.image">images/draft.png</xsl:param>
<xsl:param name="ebnf.assignment">
<code>::=</code>
</xsl:param>
<xsl:param name="ebnf.statement.terminator"/>
<xsl:param name="ebnf.table.bgcolor">#F5DCB3</xsl:param>
<xsl:param name="ebnf.table.border" select="1"/>
<xsl:param name="eclipse.autolabel" select="0"/>
<xsl:param name="eclipse.plugin.id">com.example.help</xsl:param>
<xsl:param name="eclipse.plugin.name">DocBook Online Help Sample</xsl:param>
<xsl:param name="eclipse.plugin.provider">Example provider</xsl:param>
<xsl:param name="editedby.enabled">1</xsl:param>
<xsl:param name="email.delimiters.enabled" select="1"/>
<xsl:param name="emphasis.propagates.style" select="1"/>
<xsl:param name="entry.propagates.style" select="1"/>
<xsl:param name="exsl.node.set.available">
<xsl:choose>
<xsl:when xmlns:exsl="http://exslt.org/common" exsl:foo="" test="function-available('exsl:node-set') or contains(system-property('xsl:vendor'), 'Apache Software Foundation')">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="firstterm.only.link" select="0"/>
<xsl:param name="footer.rule" select="1"/>
<xsl:param name="footnote.number.format">1</xsl:param>
<xsl:param name="footnote.number.symbols"/>
<xsl:param name="formal.procedures" select="1"/>
<xsl:param name="formal.title.placement">
figure before
example before
equation before
table before
procedure before
task before
</xsl:param>
<xsl:param name="funcsynopsis.decoration" select="1"/>
<xsl:param name="funcsynopsis.style">kr</xsl:param>
<xsl:param name="function.parens" select="0"/>
<xsl:param name="generate.consistent.ids" select="0"/>
<xsl:param name="generate.css.header" select="0"/>
<xsl:param name="generate.id.attributes" select="0"/>
<xsl:param name="generate.index" select="1"/>
<xsl:param name="generate.legalnotice.link" select="0"/>
<xsl:param name="generate.manifest" select="0"/>
<xsl:param name="generate.meta.abstract" select="1"/>
<xsl:param name="generate.revhistory.link" select="0"/>
<xsl:param name="generate.section.toc.level" select="0"/>
<xsl:param name="generate.toc">
appendix toc,title
article/appendix nop
article toc,title
book toc,title,figure,table,example,equation
chapter toc,title
part toc,title
preface toc,title
qandadiv toc
qandaset toc
reference toc,title
sect1 toc
sect2 toc
sect3 toc
sect4 toc
sect5 toc
section toc
set toc,title
</xsl:param>
<xsl:param name="glossary.collection"/>
<xsl:param name="glossary.sort" select="0"/>
<xsl:param name="glossentry.show.acronym">no</xsl:param>
<xsl:param name="glossterm.auto.link" select="0"/>
<xsl:param name="graphic.default.extension"/>
<xsl:param name="graphicsize.extension" select="1"/>
<xsl:param name="graphicsize.use.img.src.path" select="0"/>
<xsl:param name="header.rule" select="1"/>
<xsl:param name="highlight.default.language"/>
<xsl:param name="highlight.source" select="0"/>
<xsl:param name="highlight.xslthl.config"/>
<xsl:param name="html.append"/>
<xsl:param name="html.base"/>
<xsl:param name="html.cellpadding"/>
<xsl:param name="html.cellspacing"/>
<xsl:param name="html.cleanup" select="1"/>
<xsl:param name="html.ext">.html</xsl:param>
<xsl:param name="html.extra.head.links" select="0"/>
<xsl:param name="html.head.legalnotice.link.multiple" select="1"/>
<xsl:param name="html.head.legalnotice.link.types">copyright</xsl:param>
<xsl:param name="html.longdesc" select="1"/>
<xsl:param name="html.longdesc.link" select="$html.longdesc"/>
<xsl:param name="html.script"/>
<xsl:param name="html.script.type">text/javascript</xsl:param>
<xsl:param name="html.stylesheet"/>
<xsl:param name="html.stylesheet.type">text/css</xsl:param>
<xsl:param name="htmlhelp.alias.file">alias.h</xsl:param>
<xsl:param name="htmlhelp.autolabel" select="0"/>
<xsl:param name="htmlhelp.button.back" select="1"/>
<xsl:param name="htmlhelp.button.forward" select="0"/>
<xsl:param name="htmlhelp.button.hideshow" select="1"/>
<xsl:param name="htmlhelp.button.home" select="0"/>
<xsl:param name="htmlhelp.button.home.url"/>
<xsl:param name="htmlhelp.button.jump1" select="0"/>
<xsl:param name="htmlhelp.button.jump1.title">User1</xsl:param>
<xsl:param name="htmlhelp.button.jump1.url"/>
<xsl:param name="htmlhelp.button.jump2" select="0"/>
<xsl:param name="htmlhelp.button.jump2.title">User2</xsl:param>
<xsl:param name="htmlhelp.button.jump2.url"/>
<xsl:param name="htmlhelp.button.locate" select="0"/>
<xsl:param name="htmlhelp.button.next" select="1"/>
<xsl:param name="htmlhelp.button.options" select="1"/>
<xsl:param name="htmlhelp.button.prev" select="1"/>
<xsl:param name="htmlhelp.button.print" select="1"/>
<xsl:param name="htmlhelp.button.refresh" select="0"/>
<xsl:param name="htmlhelp.button.stop" select="0"/>
<xsl:param name="htmlhelp.button.zoom" select="0"/>
<xsl:param name="htmlhelp.chm">htmlhelp.chm</xsl:param>
<xsl:param name="htmlhelp.default.topic"/>
<xsl:param name="htmlhelp.display.progress" select="1"/>
<xsl:param name="htmlhelp.encoding">iso-8859-1</xsl:param>
<xsl:param name="htmlhelp.enhanced.decompilation" select="0"/>
<xsl:param name="htmlhelp.enumerate.images" select="0"/>
<xsl:param name="htmlhelp.force.map.and.alias" select="0"/>
<xsl:param name="htmlhelp.hhc.binary" select="1"/>
<xsl:param name="htmlhelp.hhc.folders.instead.books" select="1"/>
<xsl:param name="htmlhelp.hhc">toc.hhc</xsl:param>
<xsl:param name="htmlhelp.hhc.section.depth">5</xsl:param>
<xsl:param name="htmlhelp.hhc.show.root" select="1"/>
<xsl:param name="htmlhelp.hhc.width"/>
<xsl:param name="htmlhelp.hhk">index.hhk</xsl:param>
<xsl:param name="htmlhelp.hhp">htmlhelp.hhp</xsl:param>
<xsl:param name="htmlhelp.hhp.tail"/>
<xsl:param name="htmlhelp.hhp.window">Main</xsl:param>
<xsl:param name="htmlhelp.hhp.windows"/>
<xsl:param name="htmlhelp.map.file">context.h</xsl:param>
<xsl:param name="htmlhelp.only" select="0"/>
<xsl:param name="htmlhelp.remember.window.position" select="0"/>
<xsl:param name="htmlhelp.show.advanced.search" select="0"/>
<xsl:param name="htmlhelp.show.favorities" select="0"/>
<xsl:param name="htmlhelp.show.menu" select="0"/>
<xsl:param name="htmlhelp.show.toolbar.text" select="1"/>
<xsl:param name="htmlhelp.title"/>
<xsl:param name="htmlhelp.use.hhk" select="0"/>
<xsl:param name="htmlhelp.window.geometry"/>
<xsl:param name="id.warnings" select="0"/>
<xsl:param name="ignore.image.scaling" select="0"/>
<xsl:param name="img.src.path"/>
<xsl:param name="index.links.to.section" select="1"/>
<xsl:param name="index.method">basic</xsl:param>
<xsl:param name="index.number.separator"/>
<xsl:param name="index.on.role" select="0"/>
<xsl:param name="index.on.type" select="0"/>
<xsl:param name="index.prefer.titleabbrev" select="0"/>
<xsl:param name="index.range.separator"/>
<xsl:param name="index.term.separator"/>
<xsl:param name="inherit.keywords" select="1"/>
<xsl:param name="insert.olink.page.number">no</xsl:param>
<xsl:param name="insert.olink.pdf.frag" select="0"/>
<xsl:param name="insert.xref.page.number">no</xsl:param>
<xsl:param name="javahelp.encoding">iso-8859-1</xsl:param>
<xsl:param name="keep.relative.image.uris" select="1"/>
<xsl:param name="l10n.gentext.default.language">en</xsl:param>
<xsl:param name="l10n.gentext.language"/>
<xsl:param name="l10n.gentext.use.xref.language" select="0"/>
<xsl:param name="l10n.lang.value.rfc.compliant" select="1"/>
<xsl:param name="label.from.part" select="0"/>
<xsl:param name="linenumbering.everyNth">5</xsl:param>
<xsl:param name="linenumbering.extension" select="1"/>
<xsl:param name="linenumbering.separator"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="linenumbering.width">3</xsl:param>
<xsl:param name="link.mailto.url"/>
<xsl:param name="make.clean.html" select="0"/>
<xsl:param name="make.graphic.viewport" select="1"/>
<xsl:param name="make.single.year.ranges" select="0"/>
<xsl:param name="make.valid.html" select="0"/>
<xsl:param name="make.year.ranges" select="0"/>
<xsl:param name="manifest">HTML.manifest</xsl:param>
<xsl:param name="manifest.in.base.dir" select="0"/>
<xsl:param name="manual.toc"/>
<xsl:param name="menuchoice.menu.separator"></xsl:param>
<xsl:param name="menuchoice.separator">+</xsl:param>
<xsl:param name="navig.graphics.extension">.gif</xsl:param>
<xsl:param name="navig.graphics" select="0"/>
<xsl:param name="navig.graphics.path">images/</xsl:param>
<xsl:param name="navig.showtitles">1</xsl:param>
<xsl:param name="nominal.image.depth" select="4 * $pixels.per.inch"/>
<xsl:param name="nominal.image.width" select="6 * $pixels.per.inch"/>
<xsl:param name="nominal.table.width">6in</xsl:param>
<xsl:param name="olink.base.uri"/>
<xsl:param name="olink.debug" select="0"/>
<xsl:param name="olink.doctitle">no</xsl:param>
<xsl:param name="olink.fragid">fragid=</xsl:param>
<xsl:param name="olink.lang.fallback.sequence"/>
<xsl:param name="olink.outline.ext">.olink</xsl:param>
<xsl:attribute-set name="olink.properties">
<xsl:attribute name="show-destination">replace</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="olink.pubid">pubid</xsl:param>
<xsl:param name="olink.resolver">/cgi-bin/olink</xsl:param>
<xsl:param name="olink.sysid">sysid</xsl:param>
<xsl:param name="othercredit.like.author.enabled">0</xsl:param>
<xsl:param name="para.propagates.style" select="1"/>
<xsl:param name="part.autolabel">I</xsl:param>
<xsl:param name="phrase.propagates.style" select="1"/>
<xsl:param name="pixels.per.inch">90</xsl:param>
<xsl:param name="points.per.em">10</xsl:param>
<xsl:param name="preface.autolabel" select="0"/>
<xsl:param name="prefer.internal.olink" select="0"/>
<xsl:param name="preferred.mediaobject.role"/>
<xsl:param name="process.empty.source.toc" select="0"/>
<xsl:param name="process.source.toc" select="0"/>
<xsl:param name="profile.arch"/>
<xsl:param name="profile.attribute"/>
<xsl:param name="profile.audience"/>
<xsl:param name="profile.condition"/>
<xsl:param name="profile.conformance"/>
<xsl:param name="profile.lang"/>
<xsl:param name="profile.os"/>
<xsl:param name="profile.revision"/>
<xsl:param name="profile.revisionflag"/>
<xsl:param name="profile.role"/>
<xsl:param name="profile.security"/>
<xsl:param name="profile.separator">;</xsl:param>
<xsl:param name="profile.status"/>
<xsl:param name="profile.userlevel"/>
<xsl:param name="profile.value"/>
<xsl:param name="profile.vendor"/>
<xsl:param name="profile.wordsize"/>
<xsl:param name="punct.honorific">.</xsl:param>
<xsl:param name="qanda.defaultlabel">number</xsl:param>
<xsl:param name="qanda.in.toc" select="0"/>
<xsl:param name="qanda.inherit.numeration" select="1"/>
<xsl:param name="qanda.nested.in.toc" select="0"/>
<xsl:param name="qandadiv.autolabel" select="1"/>
<xsl:param name="refclass.suppress" select="0"/>
<xsl:param name="refentry.generate.name" select="1"/>
<xsl:param name="refentry.generate.title" select="0"/>
<xsl:param name="refentry.separator" select="1"/>
<xsl:param name="refentry.xref.manvolnum" select="1"/>
<xsl:param name="reference.autolabel">I</xsl:param>
<xsl:param name="root.filename">index</xsl:param>
<xsl:param name="rootid"/>
<xsl:param name="runinhead.default.title.end.punct">.</xsl:param>
<xsl:param name="runinhead.title.end.punct">.!?:</xsl:param>
<xsl:param name="section.autolabel" select="0"/>
<xsl:param name="section.autolabel.max.depth">8</xsl:param>
<xsl:param name="section.label.includes.component.label" select="0"/>
<xsl:param name="segmentedlist.as.table" select="0"/>
<xsl:param name="shade.verbatim" select="0"/>
<xsl:attribute-set name="shade.verbatim.style">
<xsl:attribute name="border">0</xsl:attribute>
<xsl:attribute name="bgcolor">#E0E0E0</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="show.comments" select="1"/>
<xsl:param name="show.revisionflag" select="0"/>
<xsl:param name="simplesect.in.toc" select="0"/>
<xsl:param name="spacing.paras" select="0"/>
<xsl:param name="suppress.footer.navigation">0</xsl:param>
<xsl:param name="suppress.header.navigation" select="0"/>
<xsl:param name="suppress.navigation" select="0"/>
<xsl:param name="table.borders.with.css" select="0"/>
<xsl:param name="table.cell.border.color"/>
<xsl:param name="table.cell.border.style">solid</xsl:param>
<xsl:param name="table.cell.border.thickness">0.5pt</xsl:param>
<xsl:param name="table.footnote.number.format">a</xsl:param>
<xsl:param name="table.footnote.number.symbols"/>
<xsl:param name="table.frame.border.color"/>
<xsl:param name="table.frame.border.style">solid</xsl:param>
<xsl:param name="table.frame.border.thickness">0.5pt</xsl:param>
<xsl:param name="tablecolumns.extension" select="1"/>
<xsl:param name="target.database.document">olinkdb.xml</xsl:param>
<xsl:param name="targets.filename">target.db</xsl:param>
<xsl:param name="tex.math.delims" select="1"/>
<xsl:param name="tex.math.file">tex-math-equations.tex</xsl:param>
<xsl:param name="tex.math.in.alt"/>
<xsl:param name="textdata.default.encoding"/>
<xsl:param name="textinsert.extension" select="1"/>
<xsl:param name="toc.list.type">dl</xsl:param>
<xsl:param name="toc.max.depth">8</xsl:param>
<xsl:param name="toc.section.depth">2</xsl:param>
<xsl:param name="ulink.target">_top</xsl:param>
<xsl:param name="use.embed.for.svg" select="0"/>
<xsl:param name="use.extensions" select="0"/>
<xsl:param name="use.id.as.filename" select="0"/>
<xsl:param name="use.local.olink.style" select="0"/>
<xsl:param name="use.role.as.xrefstyle" select="1"/>
<xsl:param name="use.role.for.mediaobject" select="1"/>
<xsl:param name="use.svg" select="1"/>
<xsl:param name="variablelist.as.table" select="0"/>
<xsl:param name="variablelist.term.break.after">0</xsl:param>
<xsl:param name="variablelist.term.separator">, </xsl:param>
<xsl:param name="webhelp.autolabel">0</xsl:param>
<xsl:param name="webhelp.base.dir">docs</xsl:param>
<xsl:param name="webhelp.common.dir">../common/</xsl:param>
<xsl:param name="webhelp.default.topic">index.html</xsl:param>
<xsl:param name="webhelp.include.search.tab">true</xsl:param>
<xsl:param name="webhelp.indexer.language">en</xsl:param>
<xsl:param name="webhelp.start.filename">index.html</xsl:param>
<xsl:param name="webhelp.tree.cookie.id" select="concat( 'treeview-', count(//node()) )"/>
<xsl:param name="writing.mode">
<xsl:call-template name="gentext">
<xsl:with-param name="key">writing-mode</xsl:with-param>
<xsl:with-param name="lang">
<xsl:call-template name="l10n.language">
<xsl:with-param name="target" select="/*[1]"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:param>
<xsl:param name="xref.label-page.separator"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="xref.label-title.separator">: </xsl:param>
<xsl:param name="xref.title-page.separator"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="xref.with.number.and.title" select="1"/>
</xsl:stylesheet>

1296
build/xsl/html/pi.xsl Normal file

File diff suppressed because it is too large Load Diff

456
build/xsl/html/qandaset.xsl Normal file
View File

@ -0,0 +1,456 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc"
version='1.0'>
<!-- ********************************************************************
$Id: qandaset.xsl 9354 2012-05-12 23:29:36Z 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="qandaset">
<xsl:variable name="title" select="(blockinfo/title|info/title|title)[1]"/>
<xsl:variable name="preamble" select="*[local-name(.) != 'title'
and local-name(.) != 'titleabbrev'
and local-name(.) != 'qandadiv'
and local-name(.) != 'qandaentry']"/>
<xsl:variable name="toc">
<xsl:call-template name="pi.dbhtml_toc"/>
</xsl:variable>
<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>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="$title"/>
<xsl:if test="not($title)">
<!-- andhor is output on title if there is one -->
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="((contains($toc.params, 'toc') and $toc != '0') or $toc = '1')
and not(ancestor::answer and not($qanda.nested.in.toc=0))">
<xsl:call-template name="process.qanda.toc"/>
</xsl:if>
<xsl:apply-templates select="$preamble"/>
<xsl:call-template name="process.qandaset"/>
</div>
</xsl:template>
<xsl:template match="qandaset/blockinfo/title|
qandaset/info/title|
qandaset/title">
<xsl:variable name="qalevel">
<xsl:call-template name="qanda.section.level"/>
</xsl:variable>
<xsl:element name="h{string(number($qalevel)+1)}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="qandaset/blockinfo|qandaset/info">
<!-- what should this template really do? -->
<xsl:apply-templates select="legalnotice" mode="titlepage.mode"/>
</xsl:template>
<xsl:template match="qandadiv">
<xsl:variable name="preamble" select="*[local-name(.) != 'title'
and local-name(.) != 'titleabbrev'
and local-name(.) != 'qandadiv'
and local-name(.) != 'qandaentry']"/>
<xsl:if test="blockinfo/title|info/title|title">
<tr class="qandadiv">
<td align="{$direction.align.start}" valign="top" colspan="2">
<xsl:apply-templates select="(blockinfo/title|info/title|title)[1]"/>
</td>
</tr>
</xsl:if>
<xsl:variable name="toc">
<xsl:call-template name="pi.dbhtml_toc"/>
</xsl:variable>
<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 $toc != '0') or $toc = '1'">
<tr class="toc">
<td align="{$direction.align.start}" valign="top" colspan="2">
<xsl:call-template name="process.qanda.toc"/>
</td>
</tr>
</xsl:if>
<xsl:if test="$preamble">
<tr class="toc">
<td align="{$direction.align.start}" valign="top" colspan="2">
<xsl:apply-templates select="$preamble"/>
</td>
</tr>
</xsl:if>
<xsl:apply-templates select="qandadiv|qandaentry"/>
</xsl:template>
<xsl:template match="qandadiv/blockinfo/title|
qandadiv/info/title|
qandadiv/title">
<xsl:variable name="qalevel">
<xsl:call-template name="qandadiv.section.level"/>
</xsl:variable>
<xsl:element name="h{string(number($qalevel)+1)}">
<xsl:apply-templates select="." mode="class.attribute"/>
<xsl:call-template name="id.attribute">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
<xsl:if test="$qandadiv.autolabel != 0">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="qandaentry">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="question">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<tr>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<!-- capture the id of the quandaentry -->
<xsl:call-template name="id.attribute">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<td align="{$direction.align.start}" valign="top">
<!-- and the id of the question too -->
<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="node" select=".."/>
<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:variable name="label.content">
<xsl:apply-templates select="." mode="qanda.label"/>
</xsl:variable>
<xsl:if test="string-length($label.content) &gt; 0">
<p><b>
<xsl:copy-of select="$label.content"/>
</b></p>
</xsl:if>
</td>
<td align="{$direction.align.start}" valign="top">
<xsl:choose>
<xsl:when test="$deflabel = 'none' and not(label)">
<b><xsl:apply-templates select="*[local-name(.) != 'label']"/></b>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[local-name(.) != 'label']"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<xsl:template match="*" mode="qanda.defaultlabel">
<xsl:choose>
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
/@defaultlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="question" mode="qanda.label">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:if test="contains($deflabel, 'number') and not(label)">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:template>
<xsl:template match="answer">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<tr>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<td align="{$direction.align.start}" valign="top">
<xsl:call-template name="anchor"/>
<xsl:variable name="answer.label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:variable>
<xsl:if test="string-length($answer.label) &gt; 0">
<p><b>
<xsl:copy-of select="$answer.label"/>
</b></p>
</xsl:if>
</td>
<td align="{$direction.align.start}" valign="top">
<xsl:apply-templates select="*[local-name(.) != 'label'
and local-name(.) != 'qandaentry']"/>
<!-- * handle nested answer/qandaentry instances -->
<!-- * (bug 1509043 from Daniel Leidert) -->
<xsl:if test="descendant::question">
<xsl:call-template name="process.qandaset"/>
</xsl:if>
</td>
</tr>
</xsl:template>
<xsl:template match="answer" mode="qanda.label">
<xsl:apply-templates select="." mode="label.markup"/>
</xsl:template>
<xsl:template match="label">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="process.qanda.toc">
<!-- * if user wants nested qandaset and qandaentry in main Qandaset TOC, -->
<!-- * then don't also include the nested stuff in the sub TOCs -->
<dl>
<xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
<xsl:apply-templates select="qandaset|qandaentry" mode="qandatoc.mode"/>
</dl>
</xsl:template>
<xsl:template match="qandadiv" mode="qandatoc.mode">
<dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
<dd><xsl:call-template name="process.qanda.toc"/></dd>
</xsl:template>
<xsl:template match="qandadiv/blockinfo/title|
qandadiv/info/title|
qandadiv/title" mode="qandatoc.mode">
<xsl:variable name="qalevel">
<xsl:call-template name="qandadiv.section.level"/>
</xsl:variable>
<xsl:variable name="id">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="parent::*"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="div.label">
<xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
</xsl:variable>
<xsl:if test="string-length($div.label) != 0">
<xsl:copy-of select="$div.label"/>
<xsl:value-of select="$autotoc.label.separator"/>
</xsl:if>
<xsl:text> </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="parent::*"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template match="qandaset" mode="qandatoc.mode">
<xsl:for-each select="qandaentry">
<xsl:apply-templates select="." mode="qandatoc.mode"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="qandaentry" mode="qandatoc.mode">
<xsl:apply-templates select="question" mode="qandatoc.mode"/>
</xsl:template>
<xsl:template match="question" mode="qandatoc.mode">
<xsl:variable name="firstch">
<!-- Use a titleabbrev or title if available -->
<xsl:choose>
<xsl:when test="../blockinfo/titleabbrev">
<xsl:apply-templates select="../blockinfo/titleabbrev[1]/node()"/>
</xsl:when>
<xsl:when test="../blockinfo/title">
<xsl:apply-templates select="../blockinfo/title[1]/node()"/>
</xsl:when>
<xsl:when test="../info/titleabbrev">
<xsl:apply-templates select="../info/titleabbrev[1]/node()"/>
</xsl:when>
<xsl:when test="../titleabbrev">
<xsl:apply-templates select="../titleabbrev[1]/node()"/>
</xsl:when>
<xsl:when test="../info/title">
<xsl:apply-templates select="../info/title[1]/node()"/>
</xsl:when>
<xsl:when test="../title">
<xsl:apply-templates select="../title[1]/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="(*[local-name(.)!='label'])[1]/node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="deflabel">
<xsl:choose>
<xsl:when test="ancestor-or-self::*[@defaultlabel]">
<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
/@defaultlabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$qanda.defaultlabel"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<dt>
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:if test="contains($deflabel,'number') and not(label)">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
</xsl:if>
<xsl:text> </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select=".."/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="$firstch"/>
</a>
</dt>
<!-- * include nested qandaset/qandaentry in TOC if user wants it -->
<xsl:if test="not($qanda.nested.in.toc = 0)">
<xsl:apply-templates select="following-sibling::answer" mode="qandatoc.mode"/>
</xsl:if>
</xsl:template>
<xsl:template match="answer" mode="qandatoc.mode">
<xsl:if test="descendant::question">
<dd>
<xsl:call-template name="process.qanda.toc"/>
</dd>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="process.qandaset">
<xsl:variable name="deflabel">
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<xsl:variable name="label-width">
<xsl:call-template name="pi.dbhtml_label-width"/>
</xsl:variable>
<xsl:variable name="table-summary">
<xsl:call-template name="pi.dbhtml_table-summary"/>
</xsl:variable>
<xsl:variable name="cellpadding">
<xsl:call-template name="pi.dbhtml_cellpadding"/>
</xsl:variable>
<xsl:variable name="cellspacing">
<xsl:call-template name="pi.dbhtml_cellspacing"/>
</xsl:variable>
<table border="{$table.border.off}">
<xsl:if test="$css.decoration != 0">
<xsl:attribute name="style">width: 100%;</xsl:attribute>
</xsl:if>
<xsl:if test="$table-summary != ''">
<xsl:attribute name="summary">
<xsl:value-of select="$table-summary"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$cellpadding != ''">
<xsl:attribute name="cellpadding">
<xsl:value-of select="$cellpadding"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$cellspacing != ''">
<xsl:attribute name="cellspacing">
<xsl:value-of select="$cellspacing"/>
</xsl:attribute>
</xsl:if>
<colgroup>
<col align="{$direction.align.start}">
<xsl:attribute name="width">
<xsl:choose>
<xsl:when test="$label-width != ''">
<xsl:value-of select="$label-width"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>1%</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</col>
<col/>
</colgroup>
<tbody>
<xsl:apply-templates select="qandaentry|qandadiv"/>
</tbody>
</table>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="*" mode="no.wrapper.mode">
<xsl:apply-templates/>
</xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

305
build/xsl/html/refentry.xsl Normal file
View File

@ -0,0 +1,305 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: refentry.xsl 9297 2012-04-22 03:56:16Z 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="reference">
<xsl:call-template name="id.warning"/>
<div>
<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="reference.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="not(partintro) and contains($toc.params, 'toc')">
<xsl:call-template name="division.toc"/>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="reference" mode="division.number">
<xsl:number from="book" count="reference" format="I."/>
</xsl:template>
<xsl:template match="reference/docinfo"></xsl:template>
<xsl:template match="reference/referenceinfo"></xsl:template>
<xsl:template match="reference/title"></xsl:template>
<xsl:template match="reference/subtitle"></xsl:template>
<xsl:template match="reference/titleabbrev"></xsl:template>
<!-- ==================================================================== -->
<xsl:template name="refentry.title">
<xsl:param name="node" select="."/>
<xsl:variable name="refmeta" select="$node//refmeta"/>
<xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
<xsl:variable name="refnamediv" select="$node//refnamediv"/>
<xsl:variable name="refname" select="$refnamediv//refname"/>
<xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$refentrytitle">
<xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
</xsl:when>
<xsl:when test="$refdesc">
<xsl:apply-templates select="$refdesc[1]" mode="title"/>
</xsl:when>
<xsl:when test="$refname">
<xsl:apply-templates select="$refname[1]" mode="title"/>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<h1 class="title">
<xsl:copy-of select="$title"/>
</h1>
</xsl:template>
<xsl:template match="refentry">
<xsl:call-template name="id.warning"/>
<div>
<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:if test="$refentry.separator != 0 and preceding-sibling::refentry">
<div class="refentry.separator">
<hr/>
</div>
</xsl:if>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:call-template name="refentry.titlepage"/>
<xsl:apply-templates/>
<xsl:call-template name="process.footnotes"/>
</div>
</xsl:template>
<xsl:template match="refentry/docinfo|refentry/refentryinfo"></xsl:template>
<xsl:template match="refentry/info"></xsl:template>
<xsl:template match="refentrytitle|refname|refdescriptor" mode="title">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refmeta">
</xsl:template>
<xsl:template match="manvolnum">
<xsl:if test="$refentry.xref.manvolnum != 0">
<xsl:text>(</xsl:text>
<xsl:apply-templates/>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="refmiscinfo">
</xsl:template>
<xsl:template match="refentrytitle">
<xsl:call-template name="inline.charseq"/>
</xsl:template>
<xsl:template match="refnamediv">
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:choose>
<xsl:when test="preceding-sibling::refnamediv">
<!-- no title on secondary refnamedivs! -->
</xsl:when>
<xsl:when test="$refentry.generate.name != 0">
<h2>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefName'"/>
</xsl:call-template>
</h2>
</xsl:when>
<xsl:when test="$refentry.generate.title != 0">
<h2>
<xsl:choose>
<xsl:when test="../refmeta/refentrytitle">
<xsl:apply-templates select="../refmeta/refentrytitle"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="refname[1]"/>
</xsl:otherwise>
</xsl:choose>
</h2>
</xsl:when>
</xsl:choose>
<p>
<xsl:apply-templates/>
</p>
</div>
</xsl:template>
<xsl:template match="refname">
<xsl:if test="not(preceding-sibling::refdescriptor)">
<xsl:apply-templates/>
<xsl:if test="following-sibling::refname">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="refpurpose">
<xsl:if test="node()">
<xsl:text> </xsl:text>
<xsl:call-template name="dingbat">
<xsl:with-param name="dingbat">em-dash</xsl:with-param>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:if>
</xsl:template>
<xsl:template match="refdescriptor">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refclass">
<xsl:if test="$refclass.suppress = 0">
<b>
<xsl:if test="@role">
<xsl:value-of select="@role"/>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</b>
</xsl:if>
</xsl:template>
<xsl:template match="refsynopsisdiv">
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<h2>
<xsl:choose>
<xsl:when test="refsynopsisdiv/title|title">
<xsl:apply-templates select="(refsynopsisdiv/title|title)[1]"
mode="titlepage.mode"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'RefSynopsisDiv'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</h2>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="refsynopsisdivinfo"></xsl:template>
<xsl:template match="refsynopsisdiv/title">
</xsl:template>
<xsl:template match="refsynopsisdiv/title" mode="titlepage.mode">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="refsection|refsect1|refsect2|refsect3">
<div>
<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="anchor">
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<!-- pick up info title -->
<xsl:apply-templates select="(title|info/title)[1]"/>
<xsl:apply-templates select="node()[not(self::title) and not(self::info)]"/>
</div>
</xsl:template>
<xsl:template match="refsection/title|refsection/info/title">
<!-- the ID is output in the block.object call for refsect1 -->
<xsl:variable name="level" select="count(ancestor-or-self::refsection)"/>
<xsl:variable name="refsynopsisdiv">
<xsl:text>0</xsl:text>
<xsl:if test="ancestor::refsynopsisdiv">1</xsl:if>
</xsl:variable>
<xsl:variable name="hlevel">
<xsl:choose>
<xsl:when test="$level+$refsynopsisdiv &gt; 5">6</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level+1+$refsynopsisdiv"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="h{$hlevel}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="refsect1/title|refsect1/info/title">
<!-- the ID is output in the block.object call for refsect1 -->
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="refsect2/title|refsect2/info/title">
<!-- the ID is output in the block.object call for refsect2 -->
<h3>
<xsl:apply-templates/>
</h3>
</xsl:template>
<xsl:template match="refsect3/title|refsect3/info/title">
<!-- the ID is output in the block.object call for refsect3 -->
<h4>
<xsl:apply-templates/>
</h4>
</xsl:template>
<xsl:template match="refsectioninfo|refsection/info"></xsl:template>
<xsl:template match="refsect1info|refsect1/info"></xsl:template>
<xsl:template match="refsect2info|refsect2/info"></xsl:template>
<xsl:template match="refsect3info|refsect3/info"></xsl:template>
<!-- ==================================================================== -->
</xsl:stylesheet>

636
build/xsl/html/sections.xsl Normal file
View File

@ -0,0 +1,636 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
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="section">
<xsl:variable name="depth" select="count(ancestor::section)+1"/>
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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 &lt;= $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::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::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="section/title
|section/info/title
|sectioninfo/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect1">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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 &gt;= 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="sect1/title
|sect1/info/title
|sect1info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect2">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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 &gt;= 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="sect2/title
|sect2/info/title
|sect2info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect3">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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 &gt;= 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="sect3/title
|sect3/info/title
|sect3info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect4">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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 &gt;= 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="sect4/title
|sect4/info/title
|sect4info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="sect5">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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 &gt;= 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="sect5/title
|sect5/info/title
|sect5info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="simplesect">
<xsl:call-template name="id.warning"/>
<xsl:element name="{$div.element}">
<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="simplesect/title|simplesect/info/title"
mode="titlepage.mode" priority="2">
<xsl:call-template name="section.title"/>
</xsl:template>
<xsl:template match="section/title"></xsl:template>
<xsl:template match="section/titleabbrev"></xsl:template>
<xsl:template match="section/subtitle"></xsl:template>
<xsl:template match="sectioninfo"></xsl:template>
<xsl:template match="section/info"></xsl:template>
<xsl:template match="sect1/title"></xsl:template>
<xsl:template match="sect1/titleabbrev"></xsl:template>
<xsl:template match="sect1/subtitle"></xsl:template>
<xsl:template match="sect1info"></xsl:template>
<xsl:template match="sect1/info"></xsl:template>
<xsl:template match="sect2/title"></xsl:template>
<xsl:template match="sect2/subtitle"></xsl:template>
<xsl:template match="sect2/titleabbrev"></xsl:template>
<xsl:template match="sect2info"></xsl:template>
<xsl:template match="sect2/info"></xsl:template>
<xsl:template match="sect3/title"></xsl:template>
<xsl:template match="sect3/subtitle"></xsl:template>
<xsl:template match="sect3/titleabbrev"></xsl:template>
<xsl:template match="sect3info"></xsl:template>
<xsl:template match="sect3/info"></xsl:template>
<xsl:template match="sect4/title"></xsl:template>
<xsl:template match="sect4/subtitle"></xsl:template>
<xsl:template match="sect4/titleabbrev"></xsl:template>
<xsl:template match="sect4info"></xsl:template>
<xsl:template match="sect4/info"></xsl:template>
<xsl:template match="sect5/title"></xsl:template>
<xsl:template match="sect5/subtitle"></xsl:template>
<xsl:template match="sect5/titleabbrev"></xsl:template>
<xsl:template match="sect5info"></xsl:template>
<xsl:template match="sect5/info"></xsl:template>
<xsl:template match="simplesect/title"></xsl:template>
<xsl:template match="simplesect/subtitle"></xsl:template>
<xsl:template match="simplesect/titleabbrev"></xsl:template>
<xsl:template match="simplesect/info"></xsl:template>
<!-- ==================================================================== -->
<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::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 &gt; 5">6</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level + 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="h{$hlevel}">
<xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
<xsl:if test="$css.decoration != '0'">
<xsl:if test="$hlevel&lt;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="bridgehead">
<xsl:variable name="container"
select="(ancestor::appendix
|ancestor::article
|ancestor::bibliography
|ancestor::chapter
|ancestor::glossary
|ancestor::glossdiv
|ancestor::index
|ancestor::partintro
|ancestor::preface
|ancestor::refsect1
|ancestor::refsect2
|ancestor::refsect3
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::sect5
|ancestor::section
|ancestor::setindex
|ancestor::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::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}">
<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="section/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="simplesect/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect1/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect2/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect3/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect4/subtitle" mode="titlepage.mode" priority="2">
<xsl:call-template name="section.subtitle"/>
</xsl:template>
<xsl:template match="sect5/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::section
|ancestor::simplesect
|ancestor::sect1
|ancestor::sect2
|ancestor::sect3
|ancestor::sect4
|ancestor::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>

1653
build/xsl/html/synop.xsl Normal file

File diff suppressed because it is too large Load Diff

1209
build/xsl/html/table.xsl Normal file

File diff suppressed because it is too large Load Diff

77
build/xsl/html/task.xsl Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- ********************************************************************
$Id: task.xsl 9363 2012-05-12 23:42:32Z 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="task">
<xsl:variable name="param.placement"
select="substring-after(normalize-space($formal.title.placement),
concat(local-name(.), ' '))"/>
<xsl:variable name="placement">
<xsl:choose>
<xsl:when test="contains($param.placement, ' ')">
<xsl:value-of select="substring-before($param.placement, ' ')"/>
</xsl:when>
<xsl:when test="$param.placement = ''">before</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.placement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="preamble"
select="*[not(self::title
or self::titleabbrev)]"/>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="anchor"/>
<xsl:if test="(title or info/title) and $placement = 'before'">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
<xsl:apply-templates select="$preamble"/>
<xsl:if test="(title or info/title) and $placement != 'before'">
<xsl:call-template name="formal.object.heading"/>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="task/title">
<!-- nop -->
</xsl:template>
<xsl:template match="tasksummary">
<xsl:call-template name="semiformal.object"/>
</xsl:template>
<xsl:template match="tasksummary/title"/>
<xsl:template match="taskprerequisites">
<xsl:call-template name="semiformal.object"/>
</xsl:template>
<xsl:template match="taskprerequisites/title"/>
<xsl:template match="taskrelated">
<xsl:call-template name="semiformal.object"/>
</xsl:template>
<xsl:template match="taskrelated/title"/>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

1123
build/xsl/html/titlepage.xsl Normal file

File diff suppressed because it is too large Load Diff

352
build/xsl/html/toc.xsl Normal file
View File

@ -0,0 +1,352 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<!-- ********************************************************************
$Id: toc.xsl 9297 2012-04-22 03:56:16Z 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="set/toc | book/toc | part/toc">
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<!-- Do not output the toc element if one is already generated
by the use of $generate.toc parameter, or if
generating a source toc is turned off -->
<xsl:if test="not(contains($toc.params, 'toc')) and
($process.source.toc != 0 or $process.empty.source.toc != 0)">
<xsl:variable name="content">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<xsl:apply-templates />
</xsl:when>
<xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
<!-- trick to switch context node to parent element -->
<xsl:for-each select="parent::*">
<xsl:choose>
<xsl:when test="self::set">
<xsl:call-template name="set.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="self::book">
<xsl:call-template name="division.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="self::part">
<xsl:call-template name="division.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="string-length(normalize-space($content)) != 0">
<xsl:copy-of select="$content"/>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="chapter/toc | appendix/toc | preface/toc | article/toc">
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<!-- Do not output the toc element if one is already generated
by the use of $generate.toc parameter, or if
generating a source toc is turned off -->
<xsl:if test="not(contains($toc.params, 'toc')) and
($process.source.toc != 0 or $process.empty.source.toc != 0)">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="title"/>
<dl>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="*[not(self::title)]"/>
</dl>
</div>
<xsl:call-template name="component.toc.separator"/>
</xsl:when>
<xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
<!-- trick to switch context node to section element -->
<xsl:for-each select="parent::*">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:for-each>
<xsl:call-template name="component.toc.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="section/toc
|sect1/toc
|sect2/toc
|sect3/toc
|sect4/toc
|sect5/toc">
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="node" select="parent::*"/>
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<!-- Do not output the toc element if one is already generated
by the use of $generate.toc parameter, or if
generating a source toc is turned off -->
<xsl:if test="not(contains($toc.params, 'toc')) and
($process.source.toc != 0 or $process.empty.source.toc != 0)">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:apply-templates select="title"/>
<dl>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="*[not(self::title)]"/>
</dl>
</div>
<xsl:call-template name="section.toc.separator"/>
</xsl:when>
<xsl:when test="count(*) = 0 and $process.empty.source.toc != 0">
<!-- trick to switch context node to section element -->
<xsl:for-each select="parent::*">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params, 'title')"/>
</xsl:call-template>
</xsl:for-each>
<xsl:call-template name="section.toc.separator"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="tocpart|tocchap
|toclevel1|toclevel2|toclevel3|toclevel4|toclevel5">
<xsl:variable name="sub-toc">
<xsl:if test="tocchap|toclevel1|toclevel2|toclevel3|toclevel4|toclevel5">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">
<dd>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocchap|toclevel1|toclevel2|
toclevel3|toclevel4|toclevel5"/>
</xsl:element>
</dd>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$toc.list.type}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocchap|toclevel1|toclevel2|
toclevel3|toclevel4|toclevel5"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:apply-templates select="tocentry[position() != last()]"/>
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">
<dt>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocentry[position() = last()]"/>
</dt>
<xsl:copy-of select="$sub-toc"/>
</xsl:when>
<xsl:otherwise>
<li>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates select="tocentry[position() = last()]"/>
<xsl:copy-of select="$sub-toc"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="tocentry|tocdiv|lotentry|tocfront|tocback">
<xsl:choose>
<xsl:when test="$toc.list.type = 'dl'">
<dt>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="tocentry-content"/>
</dt>
</xsl:when>
<xsl:otherwise>
<li>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="tocentry-content"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="tocentry[position() = last()]" priority="2">
<xsl:call-template name="tocentry-content"/>
</xsl:template>
<xsl:template name="tocentry-content">
<xsl:variable name="targets" select="key('id',@linkend)"/>
<xsl:variable name="target" select="$targets[1]"/>
<xsl:choose>
<xsl:when test="@linkend">
<xsl:call-template name="check.id.unique">
<xsl:with-param name="linkend" select="@linkend"/>
</xsl:call-template>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="object" select="$target"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="toc/title">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="toc/subtitle">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="toc/titleabbrev">
</xsl:template>
<!-- ==================================================================== -->
<!-- A lot element must have content, because there is no attribute
to select what kind of list should be generated -->
<xsl:template match="book/lot | part/lot">
<!-- Don't generate a page sequence unless there is content -->
<xsl:variable name="content">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates />
</div>
</xsl:when>
<xsl:when test="not(child::*) and $process.empty.source.toc != 0">
<xsl:call-template name="process.empty.lot"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="string-length(normalize-space($content)) != 0">
<xsl:copy-of select="$content"/>
</xsl:if>
</xsl:template>
<xsl:template match="chapter/lot | appendix/lot | preface/lot | article/lot">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates />
</div>
<xsl:call-template name="component.toc.separator"/>
</xsl:when>
<xsl:when test="not(child::*) and $process.empty.source.toc != 0">
<xsl:call-template name="process.empty.lot"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="section/lot
|sect1/lot
|sect2/lot
|sect3/lot
|sect4/lot
|sect5/lot">
<xsl:choose>
<xsl:when test="* and $process.source.toc != 0">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
<xsl:call-template name="section.toc.separator"/>
</xsl:when>
<xsl:when test="not(child::*) and $process.empty.source.toc != 0">
<xsl:call-template name="process.empty.lot"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="process.empty.lot">
<!-- An empty lot element does not provide any information to indicate
what should be included in it. You can customize this
template to generate a lot based on @role or something -->
<xsl:message>
<xsl:text>Warning: don't know what to generate for </xsl:text>
<xsl:text>lot that has no children.</xsl:text>
</xsl:message>
</xsl:template>
<xsl:template match="lot/title">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="lot/subtitle">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="lot/titleabbrev">
</xsl:template>
</xsl:stylesheet>

410
build/xsl/html/verbatim.xsl Normal file
View File

@ -0,0 +1,410 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim"
xmlns:lxslt="http://xml.apache.org/xslt"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="sverb xverb lxslt exsl"
version='1.0'>
<!-- ********************************************************************
$Id: verbatim.xsl 9297 2012-04-22 03:56:16Z 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.
******************************************************************** -->
<!-- XSLTHL highlighting is turned off by default. See highlighting/README
for instructions on how to turn on XSLTHL -->
<xsl:template name="apply-highlighting">
<xsl:apply-templates/>
</xsl:template>
<lxslt:component prefix="xverb"
functions="numberLines"/>
<xsl:template match="programlisting|screen|synopsis">
<xsl:param name="suppress-numbers" select="'0'"/>
<xsl:call-template name="anchor"/>
<xsl:variable name="div.element">pre</xsl:variable>
<xsl:if test="$shade.verbatim != 0">
<xsl:message>
<xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>
<xsl:text>Use CSS instead,</xsl:text>
</xsl:message>
<xsl:message>
<xsl:text>for example: pre.</xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text> { background-color: #E0E0E0; }</xsl:text>
</xsl:message>
</xsl:if>
<xsl:choose>
<xsl:when test="$suppress-numbers = '0'
and @linenumbering = 'numbered'
and $use.extensions != '0'
and $linenumbering.extension != '0'">
<xsl:variable name="rtf">
<xsl:choose>
<xsl:when test="$highlight.source != 0">
<xsl:call-template name="apply-highlighting"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:if test="@width != ''">
<xsl:attribute name="width">
<xsl:value-of select="@width"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$div.element}">
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:if test="@width != ''">
<xsl:attribute name="width">
<xsl:value-of select="@width"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$highlight.source != 0">
<xsl:call-template name="apply-highlighting"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="literallayout">
<xsl:param name="suppress-numbers" select="'0'"/>
<xsl:variable name="rtf">
<xsl:apply-templates/>
</xsl:variable>
<xsl:if test="$shade.verbatim != 0 and @class='monospaced'">
<xsl:message>
<xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>
<xsl:text>Use CSS instead,</xsl:text>
</xsl:message>
<xsl:message>
<xsl:text>for example: pre.</xsl:text>
<xsl:value-of select="local-name(.)"/>
<xsl:text> { background-color: #E0E0E0; }</xsl:text>
</xsl:message>
</xsl:if>
<xsl:choose>
<xsl:when test="$suppress-numbers = '0'
and @linenumbering = 'numbered'
and $use.extensions != '0'
and $linenumbering.extension != '0'">
<xsl:choose>
<xsl:when test="@class='monospaced'">
<pre>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</pre>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@class='monospaced'">
<pre>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<xsl:copy-of select="$rtf"/>
</pre>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="address">
<xsl:param name="suppress-numbers" select="'0'"/>
<xsl:variable name="rtf">
<xsl:apply-templates/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$suppress-numbers = '0'
and @linenumbering = 'numbered'
and $use.extensions != '0'
and $linenumbering.extension != '0'">
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="number.rtf.lines">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:when>
<xsl:otherwise>
<div>
<xsl:apply-templates select="." mode="common.html.attributes"/>
<xsl:call-template name="id.attribute"/>
<p>
<xsl:call-template name="make-verbatim">
<xsl:with-param name="rtf" select="$rtf"/>
</xsl:call-template>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="number.rtf.lines">
<xsl:param name="rtf" select="''"/>
<xsl:param name="pi.context" select="."/>
<!-- Save the global values -->
<xsl:variable name="global.linenumbering.everyNth"
select="$linenumbering.everyNth"/>
<xsl:variable name="global.linenumbering.separator"
select="$linenumbering.separator"/>
<xsl:variable name="global.linenumbering.width"
select="$linenumbering.width"/>
<!-- Extract the <?dbhtml linenumbering.*?> PI values -->
<xsl:variable name="pi.linenumbering.everyNth">
<xsl:call-template name="pi.dbhtml_linenumbering.everyNth">
<xsl:with-param name="node" select="$pi.context"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pi.linenumbering.separator">
<xsl:call-template name="pi.dbhtml_linenumbering.separator">
<xsl:with-param name="node" select="$pi.context"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="pi.linenumbering.width">
<xsl:call-template name="pi.dbhtml_linenumbering.width">
<xsl:with-param name="node" select="$pi.context"/>
</xsl:call-template>
</xsl:variable>
<!-- Construct the 'in-context' values -->
<xsl:variable name="linenumbering.everyNth">
<xsl:choose>
<xsl:when test="$pi.linenumbering.everyNth != ''">
<xsl:value-of select="$pi.linenumbering.everyNth"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$global.linenumbering.everyNth"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linenumbering.separator">
<xsl:choose>
<xsl:when test="$pi.linenumbering.separator != ''">
<xsl:value-of select="$pi.linenumbering.separator"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$global.linenumbering.separator"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linenumbering.width">
<xsl:choose>
<xsl:when test="$pi.linenumbering.width != ''">
<xsl:value-of select="$pi.linenumbering.width"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$global.linenumbering.width"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="linenumbering.startinglinenumber">
<xsl:choose>
<xsl:when test="$pi.context/@startinglinenumber">
<xsl:value-of select="$pi.context/@startinglinenumber"/>
</xsl:when>
<xsl:when test="$pi.context/@continuation='continues'">
<xsl:variable name="lastLine">
<xsl:choose>
<xsl:when test="$pi.context/self::programlisting">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::programlisting[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::screen">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::screen[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::literallayout">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::literallayout[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::address">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::address[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$pi.context/self::synopsis">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings"
select="preceding::synopsis[@linenumbering='numbered']"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unexpected verbatim environment: </xsl:text>
<xsl:value-of select="local-name($pi.context)"/>
</xsl:message>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$lastLine + 1"/>
</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="function-available('sverb:numberLines')">
<xsl:copy-of select="sverb:numberLines($rtf)"/>
</xsl:when>
<xsl:when test="function-available('xverb:numberLines')">
<xsl:copy-of select="xverb:numberLines($rtf)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>No numberLines function available.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="make-verbatim">
<xsl:param name="rtf"/>
<!-- I want to make this RTF verbatim. There are two possibilities: either
I have access to the exsl:node-set extension function and I can "do it right"
or I have to rely on CSS. -->
<xsl:choose>
<xsl:when test="$exsl.node.set.available != 0">
<xsl:apply-templates select="exsl:node-set($rtf)" mode="make.verbatim.mode"/>
</xsl:when>
<xsl:otherwise>
<span style="white-space: pre;">
<xsl:copy-of select="$rtf"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ======================================================================== -->
<xsl:template name="lastLineNumber">
<xsl:param name="listings"/>
<xsl:param name="number" select="0"/>
<xsl:variable name="lines">
<xsl:call-template name="countLines">
<xsl:with-param name="listing" select="string($listings[1])"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="not($listings)">
<xsl:value-of select="$number"/>
</xsl:when>
<xsl:when test="$listings[1]/@startinglinenumber">
<xsl:value-of select="$number + $listings[1]/@startinglinenumber + $lines - 1"/>
</xsl:when>
<xsl:when test="$listings[1]/@continuation='continues'">
<xsl:call-template name="lastLineNumber">
<xsl:with-param name="listings" select="listings[position() &gt; 1]"/>
<xsl:with-param name="number" select="$number + $lines"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lines"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="countLines">
<xsl:param name="listing"/>
<xsl:param name="count" select="1"/>
<xsl:choose>
<xsl:when test="contains($listing, '&#10;')">
<xsl:call-template name="countLines">
<xsl:with-param name="listing" select="substring-after($listing, '&#10;')"/>
<xsl:with-param name="count" select="$count + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$count"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

1402
build/xsl/html/xref.xsl Normal file

File diff suppressed because it is too large Load Diff

531
build/xsl/lib/lib.xsl Normal file
View File

@ -0,0 +1,531 @@
<?xml version="1.0"?>
<!-- ********************************************************************
$Id: lib.xweb 9040 2011-08-19 21:51:47Z 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.
This module implements DTD-independent functions
******************************************************************** -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template name="dot.count">
<!-- Returns the number of "." characters in a string -->
<xsl:param name="string"/>
<xsl:param name="count" select="0"/>
<xsl:choose>
<xsl:when test="contains($string, '.')">
<xsl:call-template name="dot.count">
<xsl:with-param name="string" select="substring-after($string, '.')"/>
<xsl:with-param name="count" select="$count+1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$count"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="copy-string">
<!-- returns 'count' copies of 'string' -->
<xsl:param name="string"/>
<xsl:param name="count" select="0"/>
<xsl:param name="result"/>
<xsl:choose>
<xsl:when test="$count&gt;0">
<xsl:call-template name="copy-string">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="count" select="$count - 1"/>
<xsl:with-param name="result">
<xsl:value-of select="$result"/>
<xsl:value-of select="$string"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$result"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="string.subst">
<xsl:param name="string"/>
<xsl:param name="target"/>
<xsl:param name="replacement"/>
<xsl:choose>
<xsl:when test="contains($string, $target)">
<xsl:variable name="rest">
<xsl:call-template name="string.subst">
<xsl:with-param name="string" select="substring-after($string, $target)"/>
<xsl:with-param name="target" select="$target"/>
<xsl:with-param name="replacement" select="$replacement"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(substring-before($string, $target), $replacement, $rest)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="xpointer.idref">
<xsl:param name="xpointer">http://...</xsl:param>
<xsl:choose>
<xsl:when test="starts-with($xpointer, '#xpointer(id(')">
<xsl:variable name="rest" select="substring-after($xpointer, '#xpointer(id(')"/>
<xsl:variable name="quote" select="substring($rest, 1, 1)"/>
<xsl:value-of select="substring-before(substring-after($xpointer, $quote), $quote)"/>
</xsl:when>
<xsl:when test="starts-with($xpointer, '#')">
<xsl:value-of select="substring-after($xpointer, '#')"/>
</xsl:when>
<!-- otherwise it's a pointer to some other document -->
</xsl:choose>
</xsl:template>
<xsl:template name="length-magnitude">
<xsl:param name="length" select="'0pt'"/>
<xsl:choose>
<xsl:when test="string-length($length) = 0"/>
<xsl:when test="substring($length,1,1) = '0' or substring($length,1,1) = '1' or substring($length,1,1) = '2' or substring($length,1,1) = '3' or substring($length,1,1) = '4' or substring($length,1,1) = '5' or substring($length,1,1) = '6' or substring($length,1,1) = '7' or substring($length,1,1) = '8' or substring($length,1,1) = '9' or substring($length,1,1) = '.'">
<xsl:value-of select="substring($length,1,1)"/>
<xsl:call-template name="length-magnitude">
<xsl:with-param name="length" select="substring($length,2)"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="length-units">
<xsl:param name="length" select="'0pt'"/>
<xsl:param name="default.units" select="'px'"/>
<xsl:variable name="magnitude">
<xsl:call-template name="length-magnitude">
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="units">
<xsl:value-of select="substring($length, string-length($magnitude)+1)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$units = ''">
<xsl:value-of select="$default.units"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$units"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="length-spec">
<xsl:param name="length" select="'0pt'"/>
<xsl:param name="default.units" select="'px'"/>
<xsl:variable name="magnitude">
<xsl:call-template name="length-magnitude">
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="units">
<xsl:value-of select="substring($length, string-length($magnitude)+1)"/>
</xsl:variable>
<xsl:value-of select="$magnitude"/>
<xsl:choose>
<xsl:when test="$units='cm' or $units='mm' or $units='in' or $units='pt' or $units='pc' or $units='px' or $units='em'">
<xsl:value-of select="$units"/>
</xsl:when>
<xsl:when test="$units = ''">
<xsl:value-of select="$default.units"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unrecognized unit of measure: </xsl:text>
<xsl:value-of select="$units"/>
<xsl:text>.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="length-in-points">
<xsl:param name="length" select="'0pt'"/>
<xsl:param name="em.size" select="10"/>
<xsl:param name="pixels.per.inch" select="90"/>
<xsl:variable name="magnitude">
<xsl:call-template name="length-magnitude">
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="units">
<xsl:value-of select="substring($length, string-length($magnitude)+1)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$units = 'pt'">
<xsl:value-of select="$magnitude"/>
</xsl:when>
<xsl:when test="$units = 'cm'">
<xsl:value-of select="$magnitude div 2.54 * 72.0"/>
</xsl:when>
<xsl:when test="$units = 'mm'">
<xsl:value-of select="$magnitude div 25.4 * 72.0"/>
</xsl:when>
<xsl:when test="$units = 'in'">
<xsl:value-of select="$magnitude * 72.0"/>
</xsl:when>
<xsl:when test="$units = 'pc'">
<xsl:value-of select="$magnitude * 12.0"/>
</xsl:when>
<xsl:when test="$units = 'px'">
<xsl:value-of select="$magnitude div $pixels.per.inch * 72.0"/>
</xsl:when>
<xsl:when test="$units = 'em'">
<xsl:value-of select="$magnitude * $em.size"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unrecognized unit of measure: </xsl:text>
<xsl:value-of select="$units"/>
<xsl:text>.</xsl:text>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="pi-attribute">
<xsl:param name="pis" select="processing-instruction('BOGUS_PI')"/>
<xsl:param name="attribute">filename</xsl:param>
<xsl:param name="count">1</xsl:param>
<xsl:choose>
<xsl:when test="$count&gt;count($pis)">
<!-- not found -->
</xsl:when>
<xsl:otherwise>
<xsl:variable name="pi">
<xsl:value-of select="$pis[$count]"/>
</xsl:variable>
<xsl:variable name="pivalue">
<xsl:value-of select="concat(' ', normalize-space($pi))"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($pivalue,concat(' ', $attribute, '='))">
<xsl:variable name="rest" select="substring-after($pivalue,concat(' ', $attribute,'='))"/>
<xsl:variable name="quote" select="substring($rest,1,1)"/>
<xsl:value-of select="substring-before(substring($rest,2),$quote)"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="$pis"/>
<xsl:with-param name="attribute" select="$attribute"/>
<xsl:with-param name="count" select="$count + 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="lookup.key">
<xsl:param name="key" select="''"/>
<xsl:param name="table" select="''"/>
<xsl:if test="contains($table, ' ')">
<xsl:choose>
<xsl:when test="substring-before($table, ' ') = $key">
<xsl:variable name="rest" select="substring-after($table, ' ')"/>
<xsl:choose>
<xsl:when test="contains($rest, ' ')">
<xsl:value-of select="substring-before($rest, ' ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$rest"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="lookup.key">
<xsl:with-param name="key" select="$key"/>
<xsl:with-param name="table" select="substring-after(substring-after($table,' '), ' ')"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="xpath.location">
<xsl:param name="node" select="."/>
<xsl:param name="path" select="''"/>
<xsl:variable name="next.path">
<xsl:value-of select="local-name($node)"/>
<xsl:if test="$path != ''">/</xsl:if>
<xsl:value-of select="$path"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$node/parent::*">
<xsl:call-template name="xpath.location">
<xsl:with-param name="node" select="$node/parent::*"/>
<xsl:with-param name="path" select="$next.path"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>/</xsl:text>
<xsl:value-of select="$next.path"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="comment-escape-string">
<xsl:param name="string" select="''"/>
<xsl:if test="starts-with($string, '-')">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:call-template name="comment-escape-string.recursive">
<xsl:with-param name="string" select="$string"/>
</xsl:call-template>
<xsl:if test="substring($string, string-length($string), 1) = '-'">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="comment-escape-string.recursive">
<xsl:param name="string" select="''"/>
<xsl:choose>
<xsl:when test="contains($string, '--')">
<xsl:value-of select="substring-before($string, '--')"/>
<xsl:value-of select="'- -'"/>
<xsl:call-template name="comment-escape-string.recursive">
<xsl:with-param name="string" select="substring-after($string, '--')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="str.tokenize.keep.delimiters">
<xsl:param name="string" select="''"/>
<xsl:param name="delimiters" select="' '"/>
<xsl:choose>
<xsl:when test="not($string)"/>
<xsl:when test="not($delimiters)">
<xsl:call-template name="str.tokenize.keep.delimiters-characters">
<xsl:with-param name="string" select="$string"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="delimiters" select="$delimiters"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="str.tokenize.keep.delimiters-characters">
<xsl:param name="string"/>
<xsl:if test="$string">
<ssb:token xmlns:ssb="http://sideshowbarker.net/ns"><xsl:value-of select="substring($string, 1, 1)"/></ssb:token>
<xsl:call-template name="str.tokenize.keep.delimiters-characters">
<xsl:with-param name="string" select="substring($string, 2)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="str.tokenize.keep.delimiters-delimiters">
<xsl:param name="string"/>
<xsl:param name="delimiters"/>
<xsl:variable name="delimiter" select="substring($delimiters, 1, 1)"/>
<xsl:choose>
<xsl:when test="not($delimiter)">
<ssb:token xmlns:ssb="http://sideshowbarker.net/ns"><xsl:value-of select="$string"/></ssb:token>
</xsl:when>
<xsl:when test="contains($string, $delimiter)">
<xsl:if test="not(starts-with($string, $delimiter))">
<xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
<xsl:with-param name="string" select="substring-before($string, $delimiter)"/>
<xsl:with-param name="delimiters" select="substring($delimiters, 2)"/>
</xsl:call-template>
</xsl:if>
<!-- output each delimiter -->
<xsl:value-of select="$delimiter"/>
<xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
<xsl:with-param name="string" select="substring-after($string, $delimiter)"/>
<xsl:with-param name="delimiters" select="$delimiters"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="str.tokenize.keep.delimiters-delimiters">
<xsl:with-param name="string" select="$string"/>
<xsl:with-param name="delimiters" select="substring($delimiters, 2)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="apply-string-subst-map">
<xsl:param name="content"/>
<xsl:param name="map.contents"/>
<xsl:variable name="replaced_text">
<xsl:call-template name="string.subst">
<xsl:with-param name="string" select="$content"/>
<xsl:with-param name="target" select="$map.contents[1]/@oldstring"/>
<xsl:with-param name="replacement" select="$map.contents[1]/@newstring"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$map.contents[2]">
<xsl:call-template name="apply-string-subst-map">
<xsl:with-param name="content" select="$replaced_text"/>
<xsl:with-param name="map.contents" select="$map.contents[position() &gt; 1]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$replaced_text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="count.uri.path.depth">
<xsl:param name="filename" select="''"/>
<xsl:param name="count" select="0"/>
<xsl:choose>
<xsl:when test="contains($filename, '/')">
<xsl:call-template name="count.uri.path.depth">
<xsl:with-param name="filename" select="substring-after($filename, '/')"/>
<xsl:with-param name="count" select="$count + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$count"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="trim.common.uri.paths">
<xsl:param name="uriA" select="''"/>
<xsl:param name="uriB" select="''"/>
<xsl:param name="return" select="'A'"/>
<!-- Resolve any ../ in the path -->
<xsl:variable name="trimmed.uriA">
<xsl:call-template name="resolve.path">
<xsl:with-param name="filename" select="$uriA"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="trimmed.uriB">
<xsl:call-template name="resolve.path">
<xsl:with-param name="filename" select="$uriB"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($trimmed.uriA, '/') and contains($trimmed.uriB, '/') and substring-before($trimmed.uriA, '/') = substring-before($trimmed.uriB, '/')">
<xsl:call-template name="trim.common.uri.paths">
<xsl:with-param name="uriA" select="substring-after($trimmed.uriA, '/')"/>
<xsl:with-param name="uriB" select="substring-after($trimmed.uriB, '/')"/>
<xsl:with-param name="return" select="$return"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$return = 'A'">
<xsl:value-of select="$trimmed.uriA"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$trimmed.uriB"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="resolve.path">
<xsl:param name="filename" select="''"/>
<xsl:choose>
<!-- Leading .. are not eliminated -->
<xsl:when test="starts-with($filename, '../')">
<xsl:value-of select="'../'"/>
<xsl:call-template name="resolve.path">
<xsl:with-param name="filename" select="substring-after($filename, '../')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($filename, '/../')">
<xsl:call-template name="resolve.path">
<xsl:with-param name="filename">
<xsl:call-template name="dirname">
<xsl:with-param name="filename" select="substring-before($filename, '/../')"/>
</xsl:call-template>
<xsl:value-of select="substring-after($filename, '/../')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$filename"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="dirname">
<xsl:param name="filename" select="''"/>
<xsl:if test="contains($filename, '/')">
<xsl:value-of select="substring-before($filename, '/')"/>
<xsl:text>/</xsl:text>
<xsl:call-template name="dirname">
<xsl:with-param name="filename" select="substring-after($filename, '/')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="trim.text">
<xsl:param name="contents" select="."/>
<xsl:variable name="contents-left-trimmed">
<xsl:call-template name="trim-left">
<xsl:with-param name="contents" select="$contents"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="contents-trimmed">
<xsl:call-template name="trim-right">
<xsl:with-param name="contents" select="$contents-left-trimmed"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$contents-trimmed"/>
</xsl:template>
<xsl:template name="trim-left">
<xsl:param name="contents"/>
<xsl:choose>
<xsl:when test="starts-with($contents,'&#10;') or starts-with($contents,'&#13;') or starts-with($contents,' ') or starts-with($contents,'&#9;')">
<xsl:call-template name="trim-left">
<xsl:with-param name="contents" select="substring($contents, 2)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$contents"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="trim-right">
<xsl:param name="contents"/>
<xsl:variable name="last-char">
<xsl:value-of select="substring($contents, string-length($contents), 1)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="($last-char = '&#10;') or ($last-char = '&#13;') or ($last-char = ' ') or ($last-char = '&#9;')">
<xsl:call-template name="trim-right">
<xsl:with-param name="contents" select="substring($contents, 1, string-length($contents) - 1)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$contents"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -14,8 +14,8 @@ src/dbus/interfaces/syncevo-dbus-api-doc.xml: src/dbus/interfaces/syncevo-server
done; \
echo '</reference>' >>$@
src/dbus/interfaces/syncevo-dbus-api-doc.html: src/dbus/interfaces/syncevo-dbus-api-doc.xml
$(AM_V_GEN)$(XSLT) -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $<
src/dbus/interfaces/syncevo-dbus-api-doc.html: src/dbus/interfaces/syncevo-dbus-api-doc.xml build/xsl/html/docbook.xsl
$(AM_V_GEN)$(XSLT) -o $@ $(top_srcdir)/build/xsl/html/docbook.xsl $<
doc_DATA += src/dbus/interfaces/syncevo-dbus-api-doc.html