summaryrefslogtreecommitdiff
path: root/epub3
diff options
context:
space:
mode:
Diffstat (limited to 'epub3')
-rw-r--r--epub3/README329
-rw-r--r--epub3/chunk.xsl29
-rw-r--r--epub3/chunkfast.xsl69
-rw-r--r--epub3/docbook-epub.css.xml142
-rw-r--r--epub3/docbook.xsl19
-rw-r--r--epub3/epub3-chunk-mods.xsl38
-rw-r--r--epub3/epub3-element-mods.xsl2439
-rw-r--r--epub3/profile-chunk.xsl54
-rw-r--r--epub3/profile-docbook.xsl408
-rw-r--r--epub3/titlepage.templates.xml712
-rw-r--r--epub3/titlepage.templates.xsl3841
11 files changed, 8080 insertions, 0 deletions
diff --git a/epub3/README b/epub3/README
new file mode 100644
index 0000000..477e785
--- /dev/null
+++ b/epub3/README
@@ -0,0 +1,329 @@
+DocBook stylesheets for EPUB 3 output
+=============================================
+
+This directory contains XSL stylesheets
+for generating EPUB3 output from DocBook content.
+For more information on EPUB3, see:
+
+http://idpf.org/epub/30
+
+These EPUB3 stylesheets are a customization layer on
+top of the xhtml5/ stylesheets in this distribution, which
+are in turn a customization layer on top of the
+xhtml/ stylesheets in this distribution.
+Using a customization layer enables the EPUB3
+stylesheets to inherit all the features of the
+XHTML stylesheets while making the minimum changes
+for them to produce valid EPUB3.
+
+Usage
+-----------
+The general process for creating an EPUB3 ebook is:
+
+1. Generate chunked XHTML5 content that validates against
+the EPUB3 schemas, and generate the EPUB3 package
+files.
+
+2. Copy any image files into the output directory.
+
+3. Run a zip command to create an .epub file.
+
+4. Validate the .epub file.
+
+
+Following are the steps in more detail.
+
+1. Create the XHTML5 files.
+-----------------------------
+
+The first step is handled by these stylesheets.
+To generate EPUB3-compatible XHTML5 files,
+use one of the following stylesheets as you would any
+other DocBook XSL stylesheet:
+
+epub3/chunk.xsl - Chunked output.
+epub3/profile-chunk.xsl - Profiled chunk output.
+
+Although the stylesheet directory contains a docbook.xsl
+stylesheet for single file output, that is not useful for
+generated EPUB3.
+
+You should set the $base.dir stylesheet param to the
+subdirectory that will contain the .xhtml files and
+the epub package files. Here is an example using xsltproc:
+
+xsltproc \
+ --stringparam base.dir ebook1/OEBPS/ \
+ epub3/chunk.xsl \
+ mybook.xml
+
+After processing a document with this setting, you should find
+the following output:
+
+ebook1/mimetype - required mimetype file.
+ebook1/META-INF/container.xml - required container file
+ebook1/OEBPS/package.opf - required package file
+ebook1/OEBPS/toc.ncx - optional NCX file for backwards compatibility
+ebook1/OEBPS/docbook-epub.css - CSS file
+ebook1/OEBPS/*.xhtml - The chunked content files.
+
+
+2. Copy image files
+---------------------------
+
+Manually copy any image files used in the document
+into the corresponding locations in the $base.dir
+directory. For example, if your document contains:
+
+ <imagedata fileref="images/caution.png"/>
+
+In this example base.dir, you would copy the file to:
+
+ ebook1/OEBPS/images/caution.png
+
+You can get a list of image files from the manifest file
+named ebook1/OEBPS/package.opf that is created by the
+stylesheet. It includes references to image files for
+callouts and admonitions if they are used in the output.
+Note that the header and footer images are turned off for
+EPUB3 output.
+
+
+3. Create the epub3 file.
+-----------------------------
+Change to the directory containing the base.dir (ebook1
+in this example), and run the following zip command to
+create the epub file:
+
+zip -r -X mybook.epub mimetype META-INF OEBPS
+
+The -r option means recursively include all directories.
+The -X option excludes extra file attributes (required by epub3).
+The "mybook.epub" in this example is the output file.
+The other three arguments must appear in this order.
+
+
+4. Validating with epubcheck 3
+-----------------------------------
+
+There is a java program that can be used to check an
+epub3 file for conformance. It is currently available
+from this website:
+
+ http://code.google.com/p/epubcheck/wiki/EPUBCheck30
+
+That website provides a download link, and information on
+how to run the command.
+
+
+Testing with EPUB readers
+----------------------------
+The EPUB3 standard is not yet widely supported. The output of
+these stylesheets has been tested in the following readers:
+
+Apple iBooks on an iPod and iPad.
+ - Handles videodata and audiodata.
+ - Does not format MathML yet.
+ - Handles SVG.
+
+Firefox browser with the EPUBReader version 1.4.10 add-on.
+ - Formats MathML nicely.
+ - Does not handle videodata or audiodata yet.
+ - Handles SVG.
+
+Ibis EPUB3 preview version
+ - Does not format MathML yet.
+ - Does not handle videodata or audiodata yet.
+ - Handles SVG with external viewer.
+
+
+EPUB metadata
+========================
+The info child of the document's root element is used
+by the stylesheet to create EPUB metadata. Note that
+metadata is plain text, so element content is converted
+to text using the XSL normalize-space() function.
+
+Here is the current mapping of info elements to EPUB
+metadata. Any others are ignored for metadata, but
+may appear on the EPUB HTML titlepage, depending on the
+titlepage customization.
+
+NOTE: the <dc:*> elements (not attributes of meta) duplicate
+the meta elements for backwards compatibility, per the
+EPUB3 specification. They can be turned off with the
+$epub.include.optional.metadata.dc.elements parameter.
+
+abstract
+---------
+The content must be converted to a text string for the
+OPF metadata. The stylesheet converts only title, para,
+formalpara, and simpara children in an abstract. All other
+child elements are ignored. It puts any title first.
+The OPF output appears as:
+
+<meta property="dcterms:description">title: abstract text</meta>
+<dc:description>title: abstract text</dc:description>
+
+
+author
+-------
+If uses a personname child, then it applies the
+DocBook XSL person.name template to arrange the name.
+Otherwise processes org or orgname into the content.
+Then it outputs:
+
+<meta id="meta-creator1" property="dcterms:creator">Firstname Surname</meta>
+<dc:creator id="pub-creator1">Firstname Surname</dc:creator>
+
+If there are multiple authors, the number in the id attribute
+is incremented each time.
+
+
+authorgroup
+-------------
+Applies templates to all of its children.
+
+
+bibliocoverage
+---------------
+<meta property="dcterms:coverage">bibliocoverage text</meta>
+<dc:coverage>bibliocoverage text</dc:coverage>
+
+
+biblioid
+--------------
+This usually has @class="isbn" for the ISBN number. It is used
+as the EPUB3 unique-identifier. That isbn value
+is also output as follows:
+
+<meta id="meta-identifier" property="dcterms:identifier">urn:isbn:value</meta>
+<dc:identifier id="pub-identifier">urn:isbn:value</dc:identifier>
+
+A biblioid element with other class names are converted in a similar manner.
+
+
+bibliorelation
+----------------
+<meta property="dcterms:relation">bibliorelation text</meta>
+<dc:relation>bibliorelation text</dc:relation>
+
+
+bibliosource
+----------------
+<meta property="dcterms:source">bibliosource text</meta>
+<dc:source>bibliosource text</dc:source>
+
+
+collab
+------------
+If a personname child is used, then it calls the
+person.name template, otherwise is uses the orgname or
+collabname text.
+
+<meta property="dcterms:contributor">collab text</meta>
+<dc:contributor>collab text</dc:contributor>
+
+
+copyright
+-------------
+Arranges the copyright elements into a text string with
+copyright symbol, dates, and holder, and then
+generates:
+
+<meta property="dcterms:right">Copyright text</meta>
+<dc:right>Copyright text</dc:right>
+
+Also, if there is no info/date element, then the copyright
+year is used to generate:
+
+<meta property="dcterms:date">year</meta>
+<dc:date>year</dc:date>
+
+
+corpauthor
+------------
+<meta id="meta-creator1" property="dcterms:creator">corpauthor text</meta>
+<dc:creator id="pub-creator1">corpauthor text</dc:creator>
+
+
+corpcredit
+------------
+<meta property="dcterms:contributor">corpcredit text</meta>
+<dc:contributor>corpcredit text</dc:contributor>
+
+
+date
+-------------
+<meta property="dcterms:date">date text</meta>
+<dc:date>date text</dc:date>
+
+See also: copyright.
+
+
+editor
+--------------
+If a personname child is used, then it calls the
+person.name template, otherwise is uses the orgname text.
+
+An editor can be considered as either a creator (when there
+is no author) or a contributor. The stylesheet parameter
+'editor.property' can be set to either 'creator' or
+'contributor' (default) at runtime. So the output is either:
+
+<meta property="dcterms:contributor">editor text</meta>
+<dc:contributor>editor text</dc:contributor>
+
+or
+
+<meta property="dcterms:creator">editor text</meta>
+<dc:creator>editor text</dc:creator>
+
+
+isbn, issn, etc.
+-----------------
+Handled like biblioid @class="isbn".
+
+
+keyword
+-----------
+<meta property="dcterms:subject">keyword text</meta>
+<dc:subject>keyword text</dc:subject>
+
+
+keywordset
+------------
+Applies templates to its children.
+
+
+othercredit
+------------
+Handled like collab.
+
+
+pubdate
+------------
+Handled like date.
+
+
+publisher
+--------------
+Applies templates only to publishername.
+
+
+publishername
+---------------
+<meta property="dcterms:publisher">publishername text</meta>
+<dc:publisher>publishername text</dc:publisher>
+
+
+subjectset
+--------------
+Applies templates to subject/subjecterm descendants.
+
+
+subjectterm
+------------------
+<meta property="dcterms:subject">subjecterm text</meta>
+<dc:subject>subjecterm text</dc:subject>
+
diff --git a/epub3/chunk.xsl b/epub3/chunk.xsl
new file mode 100644
index 0000000..be062b5
--- /dev/null
+++ b/epub3/chunk.xsl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:epub="http://www.idpf.org/2007/ops"
+ exclude-result-prefixes="exsl"
+ version="1.0">
+
+<!-- $Id: chunk.xsl,v 1.1 2011-09-16 21:43:45 bobs Exp $ -->
+
+<!-- This is the main driver stylesheet file. It imports or
+includes all the components that it needs. -->
+
+<!-- Import the module that customizes docbook elements -->
+<!-- Put any customizations of element content in this module. -->
+<xsl:import href="docbook.xsl"/>
+
+<xsl:import href="../xhtml/chunk-common.xsl"/>
+
+<xsl:include href="../xhtml/chunk-code.xsl"/>
+
+<!-- The following module has templates that override the stock
+ xhtml templates for HTML5 output.
+ It contains match templates with priority="1" attributes,
+ and named templates. These override any templates that
+ handle chunking behavior -->
+<xsl:include href="epub3-chunk-mods.xsl"/>
+
+</xsl:stylesheet>
diff --git a/epub3/chunkfast.xsl b/epub3/chunkfast.xsl
new file mode 100644
index 0000000..8ec9550
--- /dev/null
+++ b/epub3/chunkfast.xsl
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="cf exsl">
+
+<!-- ********************************************************************
+ $Id: chunkfast.xsl,v 1.1 2011-09-16 21:43:45 bobs Exp $
+ ********************************************************************
+
+ 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:import href="chunk.xsl"/>
+<xsl:param name="chunk.fast" select="1"/>
+
+<xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process-chunk-element">
+ <xsl:choose>
+ <xsl:when test="$chunk.fast != 0 and $exsl.node.set.available != 0">
+ <xsl:variable name="genid" select="generate-id()"/>
+
+ <xsl:variable name="div" select="$chunks[@id=$genid or @xml:id=$genid]"/>
+
+ <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
+ <xsl:variable name="prev" select="key('genid', ($prevdiv/@id|$prevdiv/@xml:id)[1])"/>
+
+ <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
+ <xsl:variable name="next" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
+
+ <xsl:choose>
+ <xsl:when test="$onechunk != 0 and parent::*">
+ <xsl:apply-imports/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="process-chunk">
+ <xsl:with-param name="prev" select="$prev"/>
+ <xsl:with-param name="next" select="$next"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$onechunk != 0 and not(parent::*)">
+ <xsl:call-template name="chunk-all-sections"/>
+ </xsl:when>
+ <xsl:when test="$onechunk != 0">
+ <xsl:apply-imports/>
+ </xsl:when>
+ <xsl:when test="$chunk.first.sections = 0">
+ <xsl:call-template name="chunk-first-section-with-parent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="chunk-all-sections"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/epub3/docbook-epub.css.xml b/epub3/docbook-epub.css.xml
new file mode 100644
index 0000000..9f28011
--- /dev/null
+++ b/epub3/docbook-epub.css.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<style>
+
+/********************************/
+/* start of styles in block.xsl */
+
+.formalpara-title {
+ font-weight: bold;
+}
+
+div.blockquote-title {
+ font-weight: bold;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+span.msgmain-title {
+ font-weight: bold;
+}
+
+span.msgsub-title {
+ font-weight: bold;
+}
+
+span.msgrel-title {
+ font-weight: bold;
+}
+
+div.msglevel, div.msgorig, div.msgaud {
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+span.msglevel-title, span.msgorig-title, span.msgaud-title {
+ font-weight: bold;
+}
+
+div.msgexplan {
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+span.msgexplan-title {
+ font-weight: bold;
+}
+
+div.sidebar {
+ border: 0.5pt solid black;
+ margin-top: 1em;
+ margin-bottom: 1em;
+ padding: 8px;
+}
+
+/* end of styles in block.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in autotoc.xsl */
+
+/* top level entries */
+nav&gt;ol&gt;li&gt;a {
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+
+/* end of styles in autotoc.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in formal.xsl */
+
+div.figure-title {
+ font-weight: bold;
+}
+
+div.example-title {
+ font-weight: bold;
+}
+
+div.equation-title {
+ font-weight: bold;
+}
+
+div.table-title {
+ font-weight: bold;
+}
+
+div.sidebar-title {
+ font-weight: bold;
+}
+
+
+/* end of styles in formal.xsl */
+/********************************/
+
+/********************************/
+/* start of styles in verbatim.xsl */
+
+div.programlisting {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
+
+div.screen {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
+
+div.synopsis {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
+
+/* end of styles in verbatim.xsl */
+/********************************/
+
+/********************************/
+/* NAVIGATION */
+
+nav ol {
+list-style-type: none;
+margin: 0 0 0 2em;
+padding: 0 0 0 0;
+}
+
+nav ol li {
+margin: 0 0 0 0;
+padding: 0 0 0 0;
+}
+
+nav ol li a {
+text-decoration: none;
+color: black;
+font-family: sans-serif;
+}
+
+#guide {
+display: none;
+}
+
+</style>
diff --git a/epub3/docbook.xsl b/epub3/docbook.xsl
new file mode 100644
index 0000000..af099b8
--- /dev/null
+++ b/epub3/docbook.xsl
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
+<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
+]>
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="#default"
+ version="1.0">
+
+<!-- $Id: docbook.xsl,v 1.1 2011-09-16 21:43:45 bobs Exp $ -->
+
+<xsl:import href="../xhtml5/docbook.xsl"/>
+
+<xsl:include href="epub3-element-mods.xsl"/>
+
+</xsl:stylesheet>
diff --git a/epub3/epub3-chunk-mods.xsl b/epub3/epub3-chunk-mods.xsl
new file mode 100644
index 0000000..b4ea68d
--- /dev/null
+++ b/epub3/epub3-chunk-mods.xsl
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:epub="http://www.idpf.org/2007/ops"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/"
+ xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:opf="http://www.idpf.org/2007/opf"
+ xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:xtext="xalan://com.nwalsh.xalan.Text"
+ extension-element-prefixes="stext xtext"
+ exclude-result-prefixes="exsl dc ncx opf stext str xtext"
+ version="1.0">
+
+<!-- $Id: epub3-chunk-mods.xsl,v 1.1 2011-09-16 21:43:45 bobs Exp $ -->
+
+<xsl:include href="../xhtml5/html5-chunk-mods.xsl"/>
+
+<!--==============================================================-->
+<!-- DocBook XSL Parameter settings -->
+<!--==============================================================-->
+
+<!--==============================================================-->
+<!-- Template customizations -->
+<!--==============================================================-->
+
+<!-- EPUB3: customize to generate package files -->
+<xsl:template match="*" mode="process.root" priority="2">
+ <xsl:apply-templates select="."/>
+ <xsl:call-template name="generate.css.files"/>
+
+ <xsl:call-template name="generate.epub.files"/>
+
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/epub3/epub3-element-mods.xsl b/epub3/epub3-element-mods.xsl
new file mode 100644
index 0000000..64f2629
--- /dev/null
+++ b/epub3/epub3-element-mods.xsl
@@ -0,0 +1,2439 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY uppercase "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
+<!ENTITY lowercase "'abcdefghijklmnopqrstuvwxyz'">
+]>
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:set="http://exslt.org/sets"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:epub="http://www.idpf.org/2007/ops"
+ xmlns:m="http://www.w3.org/1998/Math/MathML"
+ xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon"
+ xmlns:ssml="http://www.w3.org/2001/10/synthesis"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:opf="http://www.idpf.org/2007/opf"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"
+ xmlns:date="http://exslt.org/dates-and-times"
+ xmlns:dcterms="http://purl.org/dc/terms/"
+ xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/"
+ xmlns:db="http://docbook.org/ns/docbook"
+ xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory"
+ xmlns:str="http://exslt.org/strings"
+ xmlns:xtext="xalan://com.nwalsh.xalan.Text"
+
+ extension-element-prefixes="stext xtext"
+ exclude-result-prefixes="#default cf date db dc dcterms epub exsl m ncx opf pls set ssml stext str svg xtext"
+ version="1.0">
+
+<!-- $Id: epub3-element-mods.xsl,v 1.1 2011-09-16 21:43:45 bobs Exp $ -->
+
+<xsl:import href="titlepage.templates.xsl"/>
+
+<!--
+<xsl:key name="image-filerefs" match="graphic|inlinegraphic|imagedata" use="@fileref"/>
+-->
+
+<!--==============================================================-->
+<!-- DocBook XSL Parameter settings -->
+<!--==============================================================-->
+<!-- separate file for toc -->
+<xsl:param name="chunk.tocs.and.lots" select="1"/>
+<xsl:param name="toc.section.depth" select="2"/>
+<xsl:param name="generate.toc">
+book toc,title,figure,table,example,equation
+article toc,title,figure,table,example,equation
+</xsl:param>
+<xsl:param name="generate.manifest" select="0"/>
+<xsl:param name="manifest.in.base.dir" select="1"/>
+<xsl:param name="base.dir" select="'OEBPS/'"/>
+<xsl:param name="index.links.to.section" select="0"/>
+
+<!-- Turning this on crashes ADE, which is unbelievably awesome -->
+<xsl:param name="formal.object.break.after">0</xsl:param>
+
+<xsl:param name="callout.graphics" select="1"/>
+<xsl:param name="callout.graphics.extension">.png</xsl:param>
+<xsl:param name="callout.graphics.number.limit" select="15"/>
+<xsl:param name="callout.graphics.path" select="'images/callouts/'"/>
+<xsl:param name="show.comments" select="0"/>
+
+<!-- no navigation in .epub -->
+<xsl:param name="suppress.navigation" select="'1'"/>
+
+<!-- EPUB3: use ol lists in table of contents -->
+<xsl:param name="toc.list.type">ol</xsl:param>
+<xsl:param name="autotoc.label.in.hyperlink" select="1"/>
+
+<xsl:param name="css.decoration" select="1"/>
+<!-- generate the css file from a source file -->
+<xsl:param name="make.clean.html" select="1"/>
+<!-- specify the default epub3 stylesheet -->
+<xsl:param name="docbook.css.source">docbook-epub.css.xml</xsl:param>
+<!-- for custom CSS, use the custom.css.source param -->
+<xsl:param name="custom.css.source"></xsl:param>
+
+<!--==============================================================-->
+<!-- New EPUB3 Parameters -->
+<!--==============================================================-->
+<xsl:param name="epub.version">3.0</xsl:param>
+<!-- optional ncx for backwards compatibility -->
+<xsl:param name="epub.include.ncx" select="1"/>
+<xsl:param name="epub.ncx.depth">4</xsl:param> <!-- Not functional until http://code.google.com/p/epubcheck/issues/detail?id=70 is resolved -->
+<!-- currently optional duplicate dcterms properties, may be required in future -->
+<xsl:param name="epub.include.metadata.dcterms" select="1"/>
+<!-- optional guide element for backwards compatibility -->
+<xsl:param name="epub.include.guide" select="1"/>
+<!-- some dc: currently required, to be replaced in future version -->
+<xsl:param name="epub.include.metadata.dc.elements" select="1"/>
+<!-- Some dc: elements will remain optional according to the spec -->
+<xsl:param name="epub.include.optional.metadata.dc.elements" select="1"/>
+<xsl:param name="epub.autolabel" select="0"/>
+<xsl:param
+ name="epub.vocabulary.profile.content">http://www.idpf.org/epub/30/profile/content/</xsl:param>
+<xsl:param
+ name="epub.vocabulary.profile.package">http://www.idpf.org/epub/30/profile/package/</xsl:param>
+<xsl:param name="epub.output.epub.types" select="1"/>
+<xsl:param name="epub.oebps.dir" select="'OEBPS'"/>
+<xsl:param name="epub.metainf.dir" select="'META-INF/'"/>
+<xsl:param name="epub.ncx.filename" select="'toc.ncx'"/>
+<xsl:param name="epub.mimetype.filename" select="'mimetype'"/>
+<xsl:param name="epub.mimetype.value" select="'application/epub+zip'"/>
+<xsl:param name="epub.container.filename" select="'container.xml'"/>
+<xsl:param name="epub.package.filename" select="'package.opf'"/>
+<xsl:param name="epub.cover.filename" select="concat('cover', $html.ext)"/>
+<xsl:param name="epub.cover.linear" select="0" />
+
+<!-- names of id attributes used in package files -->
+<xsl:param name="epub.meta.identifier.id">meta-identifier</xsl:param>
+<xsl:param name="epub.dc.identifier.id">pub-identifier</xsl:param>
+<xsl:param name="epub.meta.title.id">meta-title</xsl:param>
+<xsl:param name="epub.dc.title.id">pub-title</xsl:param>
+<xsl:param name="epub.meta.language.id">meta-language</xsl:param>
+<xsl:param name="epub.dc.language.id">pub-language</xsl:param>
+<xsl:param name="epub.meta.creator.id">meta-creator</xsl:param>
+<xsl:param name="epub.dc.creator.id">pub-creator</xsl:param>
+<xsl:param name="epub.ncx.toc.id">ncxtoc</xsl:param>
+<xsl:param name="epub.ncx.manifest.id">ncx</xsl:param>
+<xsl:param name="epub.ncx.mediatype">application/x-dtbncx+xml</xsl:param>
+<xsl:param name="epub.xhtml.mediatype">application/xhtml+xml</xsl:param>
+<xsl:param name="epub.html.toc.id">htmltoc</xsl:param>
+<xsl:param name="epub.cover.filename.id" select="'cover'"/>
+<xsl:param name="epub.cover.image.id" select="'cover-image'"/>
+
+<xsl:param name="epub.embedded.fonts"></xsl:param>
+<xsl:param name="epub.namespace">http://www.idpf.org/2007/ops</xsl:param>
+<xsl:param name="opf.namespace">http://www.idpf.org/2007/opf</xsl:param>
+<xsl:param name="ncx.namespace">http://www.daisy.org/z3986/2005/ncx/</xsl:param>
+<xsl:param name="dc.namespace">http://purl.org/dc/elements/1.1/</xsl:param>
+<!-- prefix generated ids in package elements so they differ from content ids -->
+<xsl:param name="epub.package.id.prefix">id-</xsl:param>
+<!-- editor is either a creator or contributor -->
+<xsl:param name="editor.property">contributor</xsl:param>
+
+<!-- Generate full output path -->
+<xsl:param name="epub.package.dir" select="concat($base.dir, '../')"/>
+
+<xsl:param name="epub.ncx.pathname"
+ select="concat($base.dir, $epub.ncx.filename)"/>
+<xsl:param name="epub.container.pathname"
+ select="concat($epub.package.dir, $epub.metainf.dir,
+ $epub.container.filename)"/>
+<xsl:param name="epub.package.pathname"
+ select="concat($base.dir, $epub.package.filename)"/>
+<xsl:param name="epub.cover.pathname"
+ select="concat($base.dir, $epub.cover.filename)"/>
+<xsl:param name="epub.mimetype.pathname"
+ select="concat($epub.package.dir, $epub.mimetype.filename)"/>
+
+<xsl:param name="kindle.extensions" select="0"/>
+
+<!--==============================================================-->
+<!-- Internal variables used for computing certain metadata -->
+<!--==============================================================-->
+<xsl:variable name="epub3.chunk.hierarchy">
+ <xsl:apply-templates select="/*" mode="find.chunks"/>
+</xsl:variable>
+
+<xsl:variable name="chunkset" select="exsl:node-set($epub3.chunk.hierarchy)//cf:div"/>
+
+<!--==============================================================-->
+<!-- Template customizations -->
+<!--==============================================================-->
+
+<!-- This is used only by ncx piece -->
+<xsl:variable name="root.is.a.chunk">
+ <xsl:choose>
+ <xsl:when test="/*[not(self::book)][not(sect1) or not(section)]">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="/book[*[last()][self::bookinfo]]|book[bookinfo]">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="/book[*[last()][self::info]]|book[info]">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="/bibliography">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<!-- EPUB3: Add generation of epub publication files -->
+<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>
+ <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:call-template name="generate.epub.files"/>
+
+</xsl:template>
+
+<xsl:template name="generate.epub.files">
+ <!-- Generate epub3 files -->
+ <xsl:message>
+ <xsl:text>Generating EPUB package files.</xsl:text>
+ </xsl:message>
+
+ <xsl:apply-templates select="." mode="opf"/>
+ <xsl:apply-templates select="." mode="container"/>
+ <xsl:call-template name="mimetype"/>
+ <xsl:if test="$epub.include.ncx != 0">
+ <xsl:call-template name="ncx"/>
+ </xsl:if>
+</xsl:template>
+
+<!-- Generate the package file -->
+<xsl:template match="*" mode="opf">
+
+ <xsl:variable name="lang">
+ <xsl:call-template name="l10n.language"/>
+ </xsl:variable>
+
+ <xsl:variable name="content">
+ <!-- use xsl:element so output does not have a namespace prefix -->
+ <xsl:element name="package" namespace="{$opf.namespace}">
+ <!-- Add the package namespaces at the top -->
+ <xsl:call-template name="add.package.namespaces"/>
+
+ <xsl:attribute name="version">
+ <xsl:value-of select="$epub.version"/>
+ </xsl:attribute>
+ <xsl:attribute name="xml:lang">
+ <xsl:value-of select="$lang"/>
+ </xsl:attribute>
+ <!-- No profile att in 2011-09-06 spec
+ <xsl:attribute name="profile">
+ <xsl:value-of select="$epub.vocabulary.profile.package"/>
+ </xsl:attribute>
+ -->
+ <xsl:attribute name="unique-identifier">
+ <xsl:value-of select="$epub.dc.identifier.id"/>
+ </xsl:attribute>
+
+
+ <xsl:call-template name="package.metadata"/>
+ <xsl:call-template name="package.manifest"/>
+ <xsl:call-template name="package.spine"/>
+
+ <xsl:if test="$epub.include.guide != 0">
+ <xsl:call-template name="package.guide"/>
+ </xsl:if>
+
+ </xsl:element>
+ </xsl:variable>
+
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:value-of select="$epub.package.pathname" />
+ </xsl:with-param>
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="method" select="'xml'" />
+ <xsl:with-param name="encoding" select="'utf-8'" />
+ <xsl:with-param name="indent" select="'yes'" />
+ <xsl:with-param name="quiet" select="$chunk.quietly" />
+ <xsl:with-param name="doctype-public" select="''"/> <!-- intentionally blank -->
+ <xsl:with-param name="doctype-system" select="''"/> <!-- intentionally blank -->
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="package.metadata">
+
+ <xsl:element name="metadata" namespace="{$opf.namespace}">
+
+ <xsl:call-template name="metadata.identifier"/>
+ <xsl:call-template name="metadata.title"/>
+ <xsl:call-template name="metadata.language"/>
+ <xsl:call-template name="metadata.modified"/>
+ <xsl:call-template name="metadata.cover"/>
+ <xsl:call-template name="metadata.other.info"/>
+
+ </xsl:element>
+</xsl:template>
+
+<xsl:template name="doc.title">
+ <xsl:apply-templates select="." mode="title.markup"/>
+</xsl:template>
+
+<xsl:template name="metadata.identifier">
+ <xsl:variable name="package.id.value">
+ <xsl:call-template name="package-identifier"/>
+ </xsl:variable>
+
+ <xsl:if test="$epub.include.metadata.dc.elements != 0">
+ <!-- dc:identifier element -->
+ <dc:identifier>
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.dc.identifier.id"/>
+ </xsl:attribute>
+ <!--
+ <xsl:attribute name="prefer">
+ <xsl:value-of select="$epub.meta.identifier.id"/>
+ </xsl:attribute>
+ -->
+ <xsl:copy-of select="$package.id.value"/>
+ </dc:identifier>
+ </xsl:if>
+
+ <xsl:if test="$epub.include.metadata.dcterms != 0">
+ <!-- equivalent meta identifier element -->
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.meta.identifier.id"/>
+ </xsl:attribute>
+ <xsl:attribute name="property">dcterms:identifier</xsl:attribute>
+ <xsl:copy-of select="$package.id.value"/>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="metadata.title">
+ <xsl:variable name="doc.title">
+ <xsl:call-template name="doc.title"/>
+ </xsl:variable>
+
+ <xsl:if test="$epub.include.metadata.dc.elements != 0">
+ <dc:title>
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.dc.title.id"/>
+ </xsl:attribute>
+ <!--
+ <xsl:attribute name="prefer">
+ <xsl:value-of select="$epub.meta.title.id"/>
+ </xsl:attribute>
+ -->
+ <xsl:value-of select="normalize-space($doc.title)"/>
+ </dc:title>
+ </xsl:if>
+
+ <xsl:if test="$epub.include.metadata.dcterms != 0">
+ <!-- equivalent meta title element -->
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:title</xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.meta.title.id"/>
+ </xsl:attribute>
+ <xsl:value-of select="normalize-space($doc.title)"/>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="metadata.language">
+ <xsl:variable name="lang">
+ <xsl:call-template name="l10n.language"/>
+ </xsl:variable>
+
+ <xsl:if test="$epub.include.metadata.dc.elements != 0">
+ <dc:language>
+ <xsl:if test="$kindle.extensions = 0">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.dc.language.id"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$lang"/>
+ </dc:language>
+ </xsl:if>
+
+ <xsl:if test="$epub.include.metadata.dcterms != 0">
+ <!-- equivalent meta lang element -->
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:language</xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.meta.language.id"/>
+ </xsl:attribute>
+ <xsl:value-of select="$lang"/>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="metadata.modified">
+ <xsl:variable name="local.datetime" select="date:date-time()"/>
+ <xsl:variable name="utc.datetime">
+ <xsl:call-template name="convert.date.to.utc">
+ <xsl:with-param name="date" select="$local.datetime"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($utc.datetime) != 0">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:modified</xsl:attribute>
+ <xsl:value-of select="$utc.datetime"/>
+ </xsl:element>
+ <xsl:comment>The preceding date value is actually local time (not UTC) in UTC format because there is no function in XSLT 1.0 to generate a correct UTC time</xsl:comment>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">
+ <xsl:text>ERROR: no last-modified date value could be determined, </xsl:text>
+ <xsl:text>so cannot output required meta element with </xsl:text>
+ <xsl:text>dcterms:modified attribute. Exiting.</xsl:text>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="convert.date.to.utc">
+ <xsl:param name="date" select="''"/>
+ <!-- input format is YYYY-MM-DDTHH:MM:SS-X:00
+ where -X:00 is the offset from UTC. -->
+
+ <!-- output format is YYYY-MM-DDTHH:MM:SSZ with no offset -->
+ <!-- FIX ME: Not so easy without a proper UTC date function. -->
+ <!-- Currently it just converts the local time to this format, which is
+ not the correct UTC time. -->
+ <xsl:value-of select="concat(substring($date,1,19), 'Z')"/>
+</xsl:template>
+
+<!-- This cover meta element used by kindlegen, at least -->
+<xsl:template name="metadata.cover">
+ <xsl:variable name="info" select="./*[contains(local-name(.), 'info')][1]"/>
+ <xsl:variable name="cover.image"
+ select="$info//mediaobject[@role='cover' or ancestor::cover]"/>
+
+ <xsl:if test="$cover.image">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="content">
+ <xsl:value-of select="$epub.cover.image.id"/>
+ </xsl:attribute>
+ <xsl:attribute name="name">cover</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="metadata.other.info">
+ <!-- Take info relative to selected root element -->
+ <xsl:variable name="info" select="./*[contains(local-name(.), 'info')][1]"/>
+
+ <xsl:apply-templates select="$info/*" mode="opf.metadata"/>
+</xsl:template>
+
+<xsl:template match="*" mode="opf.metadata">
+ <!-- default is no output -->
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="opf.metadata">
+ <xsl:apply-templates select="*" mode="opf.metadata"/>
+</xsl:template>
+
+<xsl:template match="author|corpauthor" mode="opf.metadata">
+ <xsl:variable name="n">
+ <xsl:choose>
+ <xsl:when test="self::corpauthor">
+ <xsl:apply-templates/>
+ </xsl:when>
+ <xsl:when test="org/orgname">
+ <xsl:apply-templates select="org/orgname"/>
+ </xsl:when>
+ <xsl:when test="orgname">
+ <xsl:apply-templates select="orgname"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="person.name">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="string-length($n) != 0">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="concat($epub.meta.creator.id, position())"/>
+ </xsl:attribute>
+ <xsl:attribute name="property">dcterms:creator</xsl:attribute>
+ <xsl:value-of select="normalize-space(string($n))"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:creator>
+ <xsl:attribute name="id">
+ <xsl:value-of select="concat($epub.dc.creator.id, position())"/>
+ </xsl:attribute>
+ <xsl:value-of select="$n"/>
+ </dc:creator>
+ </xsl:if>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="editor" mode="opf.metadata">
+ <xsl:variable name="n">
+ <xsl:choose>
+ <xsl:when test="orgname">
+ <xsl:apply-templates select="orgname"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="person.name">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="name">
+ <xsl:choose>
+ <xsl:when test="string-length($editor.property) != 0">
+ <xsl:value-of select="$editor.property"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>contributor</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">
+ <xsl:text>dcterms:</xsl:text>
+ <xsl:value-of select="$name"/>
+ </xsl:attribute>
+ <xsl:value-of select="normalize-space($n)"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <xsl:choose>
+ <xsl:when test="$name = 'creator'">
+ <dc:creator>
+ <xsl:value-of select="normalize-space($n)"/>
+ </dc:creator>
+ </xsl:when>
+ <xsl:when test="$name = 'contributor'">
+ <dc:contributor>
+ <xsl:value-of select="normalize-space($n)"/>
+ </dc:contributor>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element namespace="{$dc.namespace}" name="{$name}">
+ <xsl:value-of select="normalize-space($n)"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+
+</xsl:template>
+
+<xsl:template match="corpcredit" mode="opf.metadata">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:contributor</xsl:attribute>
+ <xsl:value-of select="normalize-space(.)"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:contributor>
+ <xsl:value-of select="normalize-space(.)"/>
+ </dc:contributor>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="collab|othercredit" mode="opf.metadata">
+ <xsl:variable name="content">
+ <xsl:choose>
+ <xsl:when test="collabname">
+ <xsl:apply-templates select="collabname"/>
+ </xsl:when>
+ <xsl:when test="org/orgname">
+ <xsl:apply-templates select="org/orgname"/>
+ </xsl:when>
+ <xsl:when test="orgname">
+ <xsl:apply-templates select="orgname"/>
+ </xsl:when>
+ <xsl:when test="personname|firstname|surname|othername">
+ <xsl:call-template name="person.name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:contributor</xsl:attribute>
+ <xsl:value-of select="normalize-space($content)"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:contributor>
+ <xsl:value-of select="normalize-space($content)"/>
+ </dc:contributor>
+ </xsl:if>
+
+</xsl:template>
+
+<xsl:template match="date|pubdate" mode="opf.metadata">
+ <xsl:variable name="date">
+ <xsl:call-template name="format.meta.date">
+ <xsl:with-param name="string" select="normalize-space(.)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="string-length($date) != 0">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:date</xsl:attribute>
+ <xsl:value-of select="$date"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:date>
+ <xsl:value-of select="$date"/>
+ </dc:date>
+ </xsl:if>
+ </xsl:if>
+
+</xsl:template>
+
+<!-- EPUB3 meta date should be of the form:
+ YYYY, YYYY-MM or YYYY-MM-DD -->
+<xsl:template name="format.meta.date">
+ <xsl:param name="string" select="''"/>
+
+ <!-- FIXME: this needs further work, so just return the date string for now -->
+ <xsl:variable name="date">
+ <xsl:choose>
+ <xsl:when test="string-length($string) = 0">
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- construct a date one digit at a time until it fails to match format -->
+ <xsl:if test="contains('1234567890', substring($string,1,1))">
+ <xsl:value-of select="substring($string,1,1)"/>
+ </xsl:if>
+ <xsl:if test="contains('1234567890', substring($string,2,1))">
+ <xsl:value-of select="substring($string,2,1)"/>
+ </xsl:if>
+ <xsl:if test="contains('1234567890', substring($string,3,1))">
+ <xsl:value-of select="substring($string,3,1)"/>
+ </xsl:if>
+ <xsl:if test="contains('1234567890', substring($string,4,1))">
+ <xsl:value-of select="substring($string,4,1)"/>
+ </xsl:if>
+ <!-- FIXME: continue -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:value-of select="$string"/>
+
+</xsl:template>
+
+
+<!-- Space separate the compontents of the abstract (dropping the inline markup, sadly) -->
+<xsl:template match="abstract" mode="opf.metadata">
+ <xsl:variable name="content">
+ <xsl:for-each select="formalpara|para|simpara|title">
+ <xsl:choose>
+ <xsl:when test="self::formalpara">
+ <xsl:value-of select="normalize-space(string(title))"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="normalize-space(string(para))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="self::title">
+ <xsl:text>:</xsl:text>
+ </xsl:if>
+ <xsl:if test="not(position() = last())">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:description</xsl:attribute>
+ <xsl:copy-of select="$content"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:description>
+ <xsl:copy-of select="$content"/>
+ </dc:description>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="subjectset" mode="opf.metadata">
+ <xsl:apply-templates select="subject/subjectterm" mode="opf.metadata"/>
+</xsl:template>
+
+<xsl:template match="subjectterm" mode="opf.metadata">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:subject</xsl:attribute>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:subject>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </dc:subject>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="keywordset" mode="opf.metadata">
+ <xsl:apply-templates select="keyword" mode="opf.metadata"/>
+</xsl:template>
+
+<xsl:template match="keyword" mode="opf.metadata">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:subject</xsl:attribute>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:subject>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </dc:subject>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="publisher" mode="opf.metadata">
+ <xsl:apply-templates select="publishername" mode="opf.metadata"/>
+</xsl:template>
+
+<xsl:template match="publishername" mode="opf.metadata">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:publisher</xsl:attribute>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:publisher>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </dc:publisher>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="bibliocoverage" mode="opf.metadata">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:coverage</xsl:attribute>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:coverage>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </dc:coverage>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="bibliorelation" mode="opf.metadata">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:relation</xsl:attribute>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:relation>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </dc:relation>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="bibliosource" mode="opf.metadata">
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:source</xsl:attribute>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </xsl:element>
+
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:source>
+ <xsl:value-of select="normalize-space(string(.))"/>
+ </dc:source>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="copyright" mode="opf.metadata">
+ <xsl:variable name="copyright.date">
+ <xsl:call-template name="copyright.years">
+ <xsl:with-param name="years" select="year"/>
+ <xsl:with-param name="print.ranges" select="$make.year.ranges"/>
+ <xsl:with-param name="single.year.ranges" select="$make.single.year.ranges"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- if no docbook date element, use copyright year for single date metadata -->
+ <xsl:if test="not(../date)">
+ <xsl:variable name="date.content">
+ <xsl:call-template name="format.meta.date">
+ <xsl:with-param name="string">
+ <xsl:call-template name="copyright.years">
+ <xsl:with-param name="years" select="year[last()]"/>
+ <xsl:with-param name="print.ranges" select="0"/>
+ <xsl:with-param name="single.year.ranges" select="0"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:date</xsl:attribute>
+ <xsl:copy-of select="$date.content"/>
+ </xsl:element>
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:date>
+ <xsl:copy-of select="$date.content"/>
+ </dc:date>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:variable name="rights.content">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'Copyright'"/>
+ </xsl:call-template>
+ <xsl:call-template name="gentext.space"/>
+ <xsl:text>&#x00A9;</xsl:text>
+ <xsl:call-template name="gentext.space"/>
+ <xsl:value-of select="$copyright.date"/>
+ <xsl:call-template name="gentext.space"/>
+ <xsl:apply-templates select="holder" mode="titlepage.mode"/>
+ </xsl:variable>
+
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:rights</xsl:attribute>
+ <xsl:copy-of select="$rights.content"/>
+ </xsl:element>
+ <xsl:if test="$epub.include.optional.metadata.dc.elements != 0">
+ <dc:rights>
+ <xsl:copy-of select="$rights.content"/>
+ </dc:rights>
+ </xsl:if>
+
+ <xsl:element name="meta" namespace="{$opf.namespace}">
+ <xsl:attribute name="property">dcterms:rightsHolder</xsl:attribute>
+ <xsl:apply-templates select="holder" mode="titlepage.mode"/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template name="package.guide">
+
+ <xsl:variable name="info" select="./*[contains(local-name(.), 'info')][1]"/>
+
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="contains($toc.params, 'toc') or
+ $info/cover or
+ $info//mediaobject[@role='cover' or ancestor::cover]">
+ <xsl:element namespace="{$opf.namespace}" name="guide">
+ <xsl:if test="$info/cover or
+ $info//mediaobject[@role='cover' or ancestor::cover]">
+ <xsl:element namespace="{$opf.namespace}" name="reference">
+ <xsl:attribute name="href">
+ <xsl:value-of select="$epub.cover.filename" />
+ </xsl:attribute>
+ <xsl:attribute name="type">cover</xsl:attribute>
+ <xsl:attribute name="title">Cover</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+
+ <xsl:if test="contains($toc.params, 'toc')">
+ <xsl:element namespace="{$opf.namespace}" name="reference">
+ <xsl:attribute name="href">
+ <xsl:call-template name="toc-href">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="type">toc</xsl:attribute>
+ <xsl:attribute name="title">Table of Contents</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+
+<xsl:template name="package-identifier">
+
+ <xsl:variable name="info" select="./*[contains(local-name(.), 'info')][1]"/>
+
+ <xsl:choose>
+ <xsl:when test="$info/biblioid">
+ <xsl:if test="$info/biblioid[1][@class = 'doi' or
+ @class = 'isbn' or
+ @class = 'isrn' or
+ @class = 'istc' or
+ @class = 'issn']">
+ <xsl:text>urn:</xsl:text>
+ <xsl:value-of select="$info/biblioid[1]/@class"/>
+ <xsl:text>:</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="normalize-space($info/biblioid[1])"/>
+ </xsl:when>
+ <xsl:when test="$info/isbn">
+ <xsl:text>urn:isbn:</xsl:text>
+ <xsl:value-of select="$info/isbn[1]"/>
+ </xsl:when>
+ <xsl:when test="$info/issn">
+ <xsl:text>urn:issn:</xsl:text>
+ <xsl:value-of select="$info/issn[1]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$info/invpartnumber">
+ <xsl:value-of select="$info/invpartnumber[1]"/>
+ </xsl:when>
+ <xsl:when test="$info/issuenum">
+ <xsl:value-of select="$info/issuenum[1]"/>
+ </xsl:when>
+ <xsl:when test="$info/productnumber">
+ <xsl:value-of select="$info/productnumber[1]"/>
+ </xsl:when>
+ <xsl:when test="$info/seriesvolnums">
+ <xsl:value-of select="$info/seriesvolnums[1]"/>
+ </xsl:when>
+ <xsl:when test="$info/volumenum">
+ <xsl:value-of select="$info/volumenum[1]"/>
+ </xsl:when>
+ <!-- Deprecated -->
+ <xsl:when test="$info/pubsnumber">
+ <xsl:value-of select="$info/pubsnumber[1]"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:text>_</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@id">
+ <xsl:value-of select="@id"/>
+ </xsl:when>
+ <xsl:when test="@xml:id">
+ <xsl:value-of select="@xml:id"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- TODO: Do UUIDs here -->
+ <xsl:value-of select="generate-id(.)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- EPUB3: add epub:type attribute where appropriate -->
+<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:call-template name="generate.html.title"/>
+ <xsl:apply-templates select="." mode="epub.type"/>
+</xsl:template>
+
+<xsl:template match="*" mode="epub.type" priority="-1"/>
+
+<xsl:template match="chapter
+ |appendix
+ |epigraph
+ |warning
+ |preface
+ |index
+ |colophon
+ |glossary
+ |biblioentry
+ |bibliography
+ |dedication
+ |sidebar
+ |footnote
+ |glossterm
+ |glossdef
+ |bridgehead
+ |part" mode="epub.type">
+ <xsl:variable name="type" select="local-name()"/>
+
+ <xsl:if test="$epub.output.epub.types != 0">
+ <xsl:attribute name="epub:type">
+ <xsl:value-of select="$type"/>
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="section[parent::chapter] | sect1" mode="epub.type">
+ <xsl:if test="$epub.output.epub.types != 0">
+ <xsl:attribute name="epub:type">subchapter</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="section[not(parent::chapter)] |
+ sect2 |
+ sect3 |
+ sect4 |
+ sect5 |
+ sect6" mode="epub.type">
+ <xsl:if test="$epub.output.epub.types != 0">
+ <xsl:attribute name="epub:type">division</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="note|tip|caution|important" mode="epub.type">
+ <xsl:if test="$epub.output.epub.types != 0">
+ <xsl:attribute name="epub:type">notice</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="orderedlist|itemizedlist|variablelist|simplelist" mode="epub.type">
+ <xsl:if test="$epub.output.epub.types != 0">
+ <xsl:attribute name="epub:type">list</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="listitem" mode="epub.type">
+ <xsl:if test="$epub.output.epub.types != 0">
+ <xsl:attribute name="epub:type">list-item</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<!-- EPUB3: to add attributes to root output element -->
+<xsl:template name="root.attributes">
+ <!-- collect and output all namespace declarations -->
+ <xsl:call-template name="all.namespaces"/>
+</xsl:template>
+
+<xsl:template name="all.namespaces">
+ <!-- add the epub3 namespaces to the top output element -->
+ <xsl:variable name="temp">
+ <epub:foo/>
+ <m:foo/>
+ <pls:foo/>
+ <ssml:foo/>
+ <svg:foo/>
+ </xsl:variable>
+
+ <xsl:variable name="nodes" select="exsl:node-set($temp)"/>
+ <xsl:for-each select="$nodes//*/namespace::*">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+
+</xsl:template>
+
+<xsl:template name="add.package.namespaces">
+ <!-- add the epub3 package namespaces to the top output element -->
+ <xsl:variable name="temp">
+ <dc:foo/>
+ <dcterms:foo/>
+ </xsl:variable>
+
+ <xsl:variable name="nodes" select="exsl:node-set($temp)"/>
+ <xsl:for-each select="$nodes//*[local-name(.) ='foo']/namespace::*">
+ <xsl:if test="contains(., 'purl.org')">
+ <xsl:copy-of select="."/>
+ </xsl:if>
+ </xsl:for-each>
+
+</xsl:template>
+
+
+<xsl:template name="footnotes.attributes">
+ <xsl:if test="$epub.output.epub.types != 0">
+ <xsl:attribute name="epub:type">footnotes</xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="package.manifest">
+ <xsl:element name="manifest" namespace="{$opf.namespace}">
+ <xsl:if test="$epub.include.ncx != 0">
+ <xsl:call-template name="manifest.ncx"/>
+ </xsl:if>
+ <xsl:call-template name="manifest.fonts"/>
+ <xsl:call-template name="manifest.toc"/>
+ <xsl:call-template name="manifest.css"/>
+ <xsl:call-template name="manifest.cover"/>
+ <xsl:call-template name="manifest.other.items"/>
+ <xsl:call-template name="manifest.content.items"/>
+ <xsl:call-template name="user.manifest.items"/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template name="user.manifest.items"/>
+
+<xsl:template name="manifest.css">
+ <xsl:if test="$html.stylesheet != ''">
+ <xsl:call-template name="css.item">
+ <xsl:with-param name="stylesheets" select="$html.stylesheet"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="string-length($docbook.css.source) != 0">
+ <xsl:variable name="dfilename">
+ <xsl:call-template name="css.output.filename">
+ <xsl:with-param name="src" select="$docbook.css.source"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="media-type">text/css</xsl:attribute>
+ <xsl:attribute name="id">docbook-css</xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$dfilename"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="string-length($custom.css.source) != 0">
+ <xsl:variable name="cfilename">
+ <xsl:call-template name="css.output.filename">
+ <xsl:with-param name="src" select="$custom.css.source"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="media-type">text/css</xsl:attribute>
+ <xsl:attribute name="id">custom-css</xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$cfilename"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="css.item">
+ <xsl:param name="stylesheets" select="''"/>
+ <xsl:param name="count" select="1"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($stylesheets, ' ')">
+ <xsl:variable name="css.filename" select="substring-before($stylesheets, ' ')"/>
+ <xsl:if test="$css.filename != ''">
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="media-type">text/css</xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:text>html-css</xsl:text>
+ <xsl:if test="$count &gt; 1">
+ <xsl:value-of select="$count"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$css.filename"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+
+ <xsl:call-template name="css.item">
+ <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
+ <xsl:with-param name="count" select="$count + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$stylesheets != ''">
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="media-type">text/css</xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:text>html-css</xsl:text>
+ <xsl:if test="$count &gt; 1">
+ <xsl:value-of select="$count"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$stylesheets"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="manifest.ncx">
+ <xsl:element name="item" namespace="{$opf.namespace}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.ncx.manifest.id"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$epub.ncx.filename"/>
+ </xsl:attribute>
+ <xsl:attribute name="media-type">
+ <xsl:value-of select="$epub.ncx.mediatype"/>
+ </xsl:attribute>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template name="manifest.fonts"/>
+
+<!--Misc items in the manifest based on content -->
+<xsl:template name="manifest.other.items">
+</xsl:template>
+
+
+<xsl:template name="manifest.cover">
+ <xsl:variable name="info" select="./*[contains(local-name(.), 'info')][1]"/>
+ <xsl:variable name="cover.image"
+ select="$info//mediaobject[@role='cover' or ancestor::cover]"/>
+
+ <xsl:if test="$cover.image">
+
+ <!-- generate the manifest link to that page -->
+ <xsl:variable name="olist" select="$cover.image/imageobject|$cover.image/imageobjectco
+ |$cover.image/videoobject|$cover.image/audioobject
+ |$cover.image/textobject"/>
+
+ <xsl:variable name="object.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:variable name="object" select="$olist[position() = $object.index]"/>
+
+ <xsl:variable name="image.filename">
+ <xsl:call-template name="mediaobject.filename">
+ <xsl:with-param name="object" select="$object"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="image.extension">
+ <xsl:call-template name="filename-extension">
+ <xsl:with-param name="filename" select="$image.filename"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="image.type">
+ <xsl:call-template name="graphic.format.content-type">
+ <xsl:with-param name="format" select="translate($image.extension,
+ &lowercase;, &uppercase;)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- Reference to cover html file -->
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.cover.filename.id"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$epub.cover.filename"/>
+ </xsl:attribute>
+ <xsl:attribute name="media-type">
+ <xsl:value-of select="$epub.xhtml.mediatype"/>
+ </xsl:attribute>
+ </xsl:element>
+
+ <!-- special item with property="cover-image" -->
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.cover.image.id"/>
+ </xsl:attribute>
+ <xsl:attribute name="properties">cover-image</xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$image.filename"/>
+ </xsl:attribute>
+ <xsl:if test="$image.type">
+ <xsl:attribute name="media-type">
+ <xsl:value-of select="$image.type"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+
+ <!-- And generate the cover html file -->
+ <xsl:apply-templates select="$cover.image"/>
+
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="manifest.toc">
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="contains($toc.params, 'toc')">
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.html.toc.id"/>
+ </xsl:attribute>
+ <xsl:attribute name="properties">nav</xsl:attribute>
+ <xsl:attribute name="media-type">
+ <xsl:value-of select="$epub.xhtml.mediatype"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:call-template name="toc-href">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="toc-href">
+ <xsl:param name="node" select="."/>
+ <!-- FIXME -->
+ <xsl:apply-templates select="$node" mode="recursive-chunk-filename">
+ <xsl:with-param name="recursive" select="true()"/>
+ </xsl:apply-templates>
+ <xsl:text>-toc</xsl:text>
+ <xsl:value-of select="$html.ext"/>
+</xsl:template>
+
+<xsl:template match="*" mode="recursive-chunk-filename">
+ <!-- placeholder for real template in chunking stylesheet -->
+ <xsl:value-of select="concat(local-name(.), '-', generate-id(.))"/>
+</xsl:template>
+
+<xsl:template name="manifest.content.items">
+ <xsl:apply-templates select="." mode="package.manifest"/>
+ <xsl:call-template name="manifest.images"/>
+</xsl:template>
+
+<xsl:template match="text()" mode="package.manifest"/>
+
+<xsl:template match="mediaobject|mediaobjectco|inlinemediaobject" priority="1"
+ mode="package.manifest">
+ <!-- These are handled out of line so a unique list is created
+ to remove duplicate references -->
+</xsl:template>
+
+<xsl:template match="*" mode="package.manifest">
+
+ <xsl:variable name="is.chunk">
+ <xsl:call-template name="chunk">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="$is.chunk != 0">
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="context" select="/"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="id" select="concat($epub.package.id.prefix, generate-id())"/>
+
+ <xsl:variable name="properties.set">
+ <xsl:call-template name="svg.property"/>
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="mathml.property"/>
+ </xsl:variable>
+
+ <xsl:variable name="properties" select="normalize-space($properties.set)"/>
+
+ <xsl:element namespace="{$opf.namespace}" name="item">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="$href"/>
+ </xsl:attribute>
+ <xsl:attribute name="media-type">application/xhtml+xml</xsl:attribute>
+ <xsl:if test="string-length($properties) != 0">
+ <xsl:attribute name="properties">
+ <xsl:value-of select="$properties"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates mode="package.manifest"/>
+
+</xsl:template>
+
+<xsl:template name="svg.property">
+ <xsl:param name="this.chunk" select="."/>
+
+ <xsl:variable name="genid" select="generate-id($this.chunk)"/>
+
+ <!-- get the chunkfast div element for this chunk -->
+ <xsl:variable name="div" select="$chunkset[@id=$genid or @xml:id=$genid]"/>
+
+ <!-- get the chunkfast div element the next chunk -->
+ <xsl:variable name="nextdiv"
+ select="($div/following-sibling::cf:div|
+ $div/following::cf:div|
+ $div/cf:div)[1]"/>
+
+ <!-- get the element corresponding to the next chunk -->
+ <xsl:variable name="next.chunk" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
+
+ <xsl:choose>
+ <xsl:when test="$next.chunk">
+ <xsl:variable name="this.imagedata"
+ select="$this.chunk//imagedata"/>
+ <xsl:variable name="before.next"
+ select="$next.chunk/preceding::imagedata"/>
+
+ <!-- select for an SVG imagedata in the intersection of them -->
+ <xsl:variable name="intersection"
+ select="$this.imagedata[count(.|$before.next) = count($before.next)]"/>
+
+ <xsl:variable name="svg.imagedata"
+ select="$intersection[contains(
+ substring(@fileref, string-length(@fileref)-3,4), '.svg')]"/>
+
+ <xsl:if test="count($svg.imagedata) != 0">
+ <xsl:text>svg</xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="this.imagedata"
+ select="$this.chunk//imagedata"/>
+ <xsl:variable name="svg.imagedata"
+ select="$this.imagedata[contains(
+ substring(@fileref, string-length(@fileref)-3,4), '.svg')]"/>
+ <xsl:if test="count($svg.imagedata) != 0">
+ <xsl:text>svg</xsl:text>
+ </xsl:if>
+
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="mathml.property">
+ <xsl:param name="this.chunk" select="."/>
+
+ <xsl:variable name="genid" select="generate-id($this.chunk)"/>
+
+ <!-- get the chunkfast div element for this chunk -->
+ <xsl:variable name="div" select="$chunkset[@id=$genid or @xml:id=$genid]"/>
+
+ <!-- get the chunkfast div element the next chunk -->
+ <xsl:variable name="nextdiv"
+ select="($div/following-sibling::cf:div|
+ $div/following::cf:div|
+ $div/cf:div)[1]"/>
+
+ <!-- get the element corresponding to the next chunk -->
+ <xsl:variable name="next.chunk" select="key('genid', ($nextdiv/@id|$nextdiv/@xml:id)[1])"/>
+
+ <xsl:variable name="this.math"
+ select="$this.chunk//m:*"/>
+ <xsl:variable name="before.next"
+ select="$next.chunk/preceding::m:*"/>
+
+ <!-- select for an SVG imagedata in the intersection of them -->
+ <xsl:variable name="intersection"
+ select="$this.math[count(.|$before.next) = count($before.next)]"/>
+
+ <xsl:if test="count($intersection) != 0">
+ <xsl:text>mathml</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="manifest.image.item">
+</xsl:template>
+
+<!-- Need a uniqued list of images -->
+<xsl:template name="manifest.images">
+ <xsl:message>Generating image list ...</xsl:message>
+ <xsl:variable name="imagelist">
+ <xsl:choose>
+ <xsl:when test="$rootid != ''">
+ <xsl:apply-templates select="key('id', $rootid)" mode="enumerate-images"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="/" mode="enumerate-images"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$exsl.node.set.available != 0 and
+ function-available('set:distinct')">
+ <xsl:for-each select="set:distinct(exsl:node-set($imagelist)/*)">
+ <xsl:if test="string-length(tmp-href) != 0">
+ <!-- convert the child elements to attributes -->
+ <xsl:element name="item" namespace="{$opf.namespace}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="tmp-href"/>
+ </xsl:attribute>
+ <xsl:attribute name="media-type">
+ <xsl:value-of select="media-type"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="$exsl.node.set.available != 0">
+ <xsl:for-each select="exsl:node-set($imagelist)/*">
+ <xsl:element name="item" namespace="{$opf.namespace}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="tmp-href"/>
+ </xsl:attribute>
+ <xsl:attribute name="media-type">
+ <xsl:value-of select="media-type"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">
+ <xsl:text>ERROR: cannot process images list without </xsl:text>
+ <xsl:text>exsl:node-set() function</xsl:text>
+ </xsl:message>
+ <!-- cannot do this without node-set() -->
+ </xsl:otherwise>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template match="*" mode="enumerate-images">
+ <xsl:apply-templates mode="enumerate-images"/>
+</xsl:template>
+
+<xsl:template match="text()" mode="enumerate-images"/>
+
+<xsl:template match="graphic|inlinegraphic[@format!='linespecific']"
+ mode="enumerate-images">
+</xsl:template>
+
+<!-- cover image handled separates to give it an extra property attribute -->
+<xsl:template match="mediaobject[@role='cover' or ancestor::cover]"
+ mode="enumerate-images"/>
+
+<xsl:template match="mediaobject|inlinemediaobject" mode="enumerate-images">
+
+ <xsl:variable name="olist"
+ select="imageobject[not(@role = 'poster')]
+ |imageobjectco
+ |videoobject
+ |audioobject
+ |textobject"/>
+
+ <xsl:variable name="object.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:variable name="object" select="$olist[position() = $object.index]"/>
+
+ <xsl:apply-templates select="$object" mode="enumerate-images"/>
+
+ <!-- also include a poster image if present -->
+ <xsl:apply-templates select="imageobject[@role = 'poster']" mode="enumerate-images"/>
+
+</xsl:template>
+
+<xsl:template match="imageobject|videoobject|audioobject" mode="enumerate-images">
+ <xsl:param name="object" select="."/>
+
+ <xsl:if test="$object">
+ <xsl:variable name="image.filename">
+ <xsl:call-template name="mediaobject.filename">
+ <xsl:with-param name="object" select="$object"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="image.extension">
+ <xsl:call-template name="filename-extension">
+ <xsl:with-param name="filename" select="$image.filename"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="image.type">
+ <xsl:call-template name="graphic.format.content-type">
+ <xsl:with-param name="format" select="translate($image.extension,
+ &lowercase;, &uppercase;)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:element name="tmp-filename" namespace="">
+ <xsl:element name="tmp-href" namespace="">
+ <xsl:value-of select="$image.filename"/>
+ </xsl:element>
+ <xsl:element name="media-type" namespace="">
+ <xsl:value-of select="$image.type"/>
+ </xsl:element>
+ </xsl:element>
+
+ </xsl:if>
+</xsl:template>
+
+<!-- Add in the generated images -->
+<xsl:template match="note|caution|warning|important|tip" mode="enumerate-images">
+ <xsl:if test="$admon.graphics != 0">
+ <xsl:variable name="image.filename">
+ <xsl:call-template name="admon.graphic"/>
+ </xsl:variable>
+
+ <xsl:variable name="image.type">
+ <xsl:call-template name="graphic.format.content-type">
+ <xsl:with-param name="format" select="translate(
+ substring-after($admon.graphics.extension,'.'),
+ &lowercase;, &uppercase;)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:element name="tmp-filename" namespace="">
+ <xsl:element name="tmp-href" namespace="">
+ <xsl:value-of select="$image.filename"/>
+ </xsl:element>
+ <xsl:element name="media-type" namespace="">
+ <xsl:value-of select="$image.type"/>
+ </xsl:element>
+ </xsl:element>
+
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="callout" mode="enumerate-images">
+ <!-- process arearefs to get name of callout bug image files -->
+ <xsl:if test="$callout.graphics != 0">
+ <xsl:variable name="arearefs">
+ <xsl:call-template name="callout.arearefs">
+ <xsl:with-param name="arearefs" select="@arearefs"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="nodes" select="exsl:node-set($arearefs)"/>
+
+ <xsl:for-each select="$nodes//*[@src]">
+ <xsl:variable name="image.filename" select="@src"/>
+
+ <xsl:variable name="image.type">
+ <xsl:call-template name="graphic.format.content-type">
+ <xsl:with-param name="format" select="translate(
+ substring-after($callout.graphics.extension,'.'),
+ &lowercase;, &uppercase;)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:element name="tmp-filename" namespace="">
+ <xsl:element name="tmp-href" namespace="">
+ <xsl:value-of select="$image.filename"/>
+ </xsl:element>
+ <xsl:element name="media-type" namespace="">
+ <xsl:value-of select="$image.type"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="co" mode="enumerate-images">
+ <!-- process co to get name of callout bug image file -->
+ <xsl:if test="$callout.graphics != 0">
+ <xsl:variable name="result">
+ <xsl:apply-templates select="." mode="callout-bug"/>
+ </xsl:variable>
+
+ <xsl:variable name="nodes" select="exsl:node-set($result)"/>
+
+ <xsl:for-each select="$nodes//*[@src]">
+ <xsl:variable name="image.filename" select="@src"/>
+
+ <xsl:variable name="image.type">
+ <xsl:call-template name="graphic.format.content-type">
+ <xsl:with-param name="format" select="translate(
+ substring-after($callout.graphics.extension,'.'),
+ &lowercase;, &uppercase;)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:element name="tmp-filename" namespace="">
+ <xsl:element name="tmp-href" namespace="">
+ <xsl:value-of select="$image.filename"/>
+ </xsl:element>
+ <xsl:element name="media-type" namespace="">
+ <xsl:value-of select="$image.type"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+
+ </xsl:if>
+
+</xsl:template>
+
+<!-- ======================================================== -->
+<!-- NCX templates are for backwards compatibility with EPUB2 -->
+<!-- ======================================================== -->
+
+<xsl:template name="ncx">
+ <xsl:message>Generating NCX file ...</xsl:message>
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:value-of select="$epub.ncx.pathname" />
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'" />
+ <xsl:with-param name="encoding" select="'utf-8'" />
+ <xsl:with-param name="indent" select="'no'" />
+ <xsl:with-param name="quiet" select="$chunk.quietly" />
+ <xsl:with-param name="doctype-public" select="''"/> <!-- intentionally blank -->
+ <xsl:with-param name="doctype-system" select="''"/> <!-- intentionally blank -->
+ <xsl:with-param name="content">
+ <xsl:element name="ncx" namespace="{$ncx.namespace}">
+ <xsl:attribute name="version">2005-1</xsl:attribute>
+
+ <!-- Via Martin Goerner: On covers: the IDPF2.0 standard unfortunately does not have a provision for
+ covers. We had to add one and we did so in conjunction with the IDPF and
+ various publishers. The tag chosen to define the covers is:
+ <meta name="cover" content="-reference to a manifest item-">
+ Then, we also added a bit of logic to get rid cleanly of the HTML cover
+ people usually add because the logical cover is not specced by the IDPF. So,
+ if the HTML cover item is marked linear="no" AND there is a guide item of
+ type="cover" pointing to it AND there is a logical cover specified in a
+ <meta name="cover"> tag, THEN, the HTML cover is discarded. -->
+ <xsl:element name="head" namespace="{$ncx.namespace}">
+ <xsl:if test="/*/*[cover or contains(name(.), 'info')]//mediaobject[@role='cover' or ancestor::cover]">
+ <xsl:element name="meta" namespace="{$ncx.namespace}">
+ <xsl:attribute name="name">cover</xsl:attribute>
+ <xsl:attribute name="content">
+ <xsl:value-of select="$epub.cover.filename.id"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="meta" namespace="{$ncx.namespace}">
+ <xsl:attribute name="name">dtb:uid</xsl:attribute>
+ <xsl:attribute name="content"><xsl:call-template name="package-identifier"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+
+ <xsl:choose>
+ <xsl:when test="$rootid != ''">
+ <xsl:variable name="title">
+ <xsl:if test="$epub.autolabel != 0">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="key('id',$rootid)" mode="label.markup" />
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)" />
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="key('id',$rootid)" mode="title.markup" />
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="object" select="key('id',$rootid)" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="docTitle" namespace="{$ncx.namespace}">
+ <xsl:element name="text" namespace="{$ncx.namespace}"><xsl:value-of select="normalize-space($title)" /> </xsl:element>
+ </xsl:element>
+ <xsl:element name="navMap" namespace="{$ncx.namespace}">
+ <xsl:apply-templates select="key('id',$rootid)/*" mode="ncx" />
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="title">
+ <xsl:if test="$epub.autolabel != 0">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="/*" mode="label.markup" />
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of select="concat($label.markup,$autotoc.label.separator)" />
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="/*" mode="title.markup" />
+ </xsl:variable>
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="object" select="/" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="docTitle" namespace="{$ncx.namespace}">
+ <xsl:element name="text" namespace="{$ncx.namespace}">
+ <xsl:value-of select="normalize-space($title)" />
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="navMap" namespace="{$ncx.namespace}">
+ <xsl:choose>
+ <xsl:when test="$root.is.a.chunk != '0'">
+ <xsl:apply-templates select="/*" mode="ncx" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="/*/*" mode="ncx" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:otherwise>
+
+ </xsl:choose>
+ </xsl:element>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="book|
+ article|
+ topic|
+ part|
+ reference|
+ preface|
+ chapter|
+ bibliography|
+ appendix|
+ glossary|
+ section|
+ sect1|
+ sect2|
+ sect3|
+ sect4|
+ sect5|
+ refentry|
+ colophon|
+ bibliodiv[title]|
+ setindex|
+ index"
+ mode="ncx">
+ <xsl:variable name="depth" select="count(ancestor::*)"/>
+ <xsl:variable name="title">
+ <xsl:if test="$epub.autolabel != 0">
+ <xsl:variable name="label.markup">
+ <xsl:apply-templates select="." mode="label.markup" />
+ </xsl:variable>
+ <xsl:if test="normalize-space($label.markup)">
+ <xsl:value-of
+ select="concat($label.markup,$autotoc.label.separator)" />
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="." mode="title.markup" />
+ </xsl:variable>
+
+ <xsl:variable name="href">
+ <xsl:call-template name="href.target.with.base.dir">
+ <xsl:with-param name="context" select="/" />
+ <!-- Generate links relative to the location of root file/toc.xml file -->
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="id">
+ <xsl:value-of select="generate-id(.)"/>
+ </xsl:variable>
+ <xsl:variable name="order">
+ <xsl:value-of select="$depth +
+ count(preceding::part|
+ preceding::reference|
+ preceding::book[parent::set]|
+ preceding::preface|
+ preceding::chapter|
+ preceding::bibliography|
+ preceding::appendix|
+ preceding::article|
+ preceding::topic|
+ preceding::glossary|
+ preceding::section[not(parent::partintro)]|
+ preceding::sect1[not(parent::partintro)]|
+ preceding::sect2[not(ancestor::partintro)]|
+ preceding::sect3[not(ancestor::partintro)]|
+ preceding::sect4[not(ancestor::partintro)]|
+ preceding::sect5[not(ancestor::partintro)]|
+ preceding::refentry|
+ preceding::colophon|
+ preceding::bibliodiv[title]|
+ preceding::index)"/>
+ </xsl:variable>
+
+ <xsl:element name="navPoint" namespace="{$ncx.namespace}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id"/>
+ </xsl:attribute>
+
+ <xsl:attribute name="playOrder">
+ <xsl:choose>
+ <xsl:when test="/*[self::set]">
+ <xsl:value-of select="$order"/>
+ </xsl:when>
+ <xsl:when test="$root.is.a.chunk != '0'">
+ <xsl:value-of select="$order + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$order - 0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:element name="navLabel" namespace="{$ncx.namespace}">
+ <xsl:element name="text" namespace="{$ncx.namespace}"><xsl:value-of select="normalize-space($title)"/> </xsl:element>
+ </xsl:element>
+ <xsl:element name="content" namespace="{$ncx.namespace}">
+ <xsl:attribute name="src">
+ <xsl:value-of select="$href"/>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:apply-templates select="book[parent::set]|part|reference|preface|chapter|bibliography|appendix|article|topic|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv[title]|setindex|index" mode="ncx"/>
+ </xsl:element>
+
+</xsl:template>
+
+<xsl:template match="text()" mode="ncx" />
+
+<xsl:template name="package.spine">
+
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:element namespace="http://www.idpf.org/2007/opf" name="spine">
+ <xsl:if test="$epub.include.ncx != 0">
+ <xsl:attribute name="toc">
+ <xsl:value-of select="$epub.ncx.manifest.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:call-template name="spine.cover"/>
+
+
+ <xsl:if test="contains($toc.params, 'toc')">
+ <xsl:element namespace="http://www.idpf.org/2007/opf" name="itemref">
+ <xsl:attribute name="idref"> <xsl:value-of select="$epub.html.toc.id"/> </xsl:attribute>
+ <xsl:attribute name="linear">yes</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+
+ <!-- TODO: be nice to have a idref="titlepage" here -->
+ <xsl:choose>
+ <xsl:when test="$root.is.a.chunk != '0'">
+ <xsl:apply-templates select="/*" mode="package.spine"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="/*/*" mode="package.spine"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:element>
+</xsl:template>
+
+<xsl:template name="spine.cover">
+ <xsl:variable name="info" select="./*[contains(local-name(.), 'info')][1]"/>
+ <xsl:variable name="cover.image"
+ select="$info//mediaobject[@role='cover' or ancestor::cover]"/>
+
+ <xsl:if test="$cover.image">
+ <!-- generate the spine reference to that cover html file -->
+ <xsl:element namespace="http://www.idpf.org/2007/opf" name="itemref">
+ <xsl:attribute name="idref">
+ <xsl:value-of select="$epub.cover.filename.id"/>
+ </xsl:attribute>
+ <xsl:attribute name="linear">
+ <xsl:choose>
+ <xsl:when test="$epub.cover.linear">
+ <xsl:text>yes</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>no</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="*" mode="package.spine">
+ <xsl:variable name="is.chunk">
+ <xsl:call-template name="chunk">
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="$is.chunk != 0">
+ <xsl:element namespace="http://www.idpf.org/2007/opf" name="itemref">
+ <xsl:attribute name="idref">
+ <xsl:value-of select="concat($epub.package.id.prefix, generate-id(.))"/>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:apply-templates select="*|.//refentry" mode="package.spine"/>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="*" mode="container">
+ <xsl:call-template name="container"/>
+</xsl:template>
+
+<xsl:template name="container">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:value-of select="$epub.container.pathname" />
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'" />
+ <xsl:with-param name="encoding" select="'utf-8'" />
+ <xsl:with-param name="indent" select="'no'" />
+ <xsl:with-param name="quiet" select="$chunk.quietly" />
+ <xsl:with-param name="doctype-public" select="''"/> <!-- intentionally blank -->
+ <xsl:with-param name="doctype-system" select="''"/> <!-- intentionally blank -->
+
+ <xsl:with-param name="content">
+ <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="container">
+ <xsl:attribute name="version">1.0</xsl:attribute>
+ <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="rootfiles">
+ <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="rootfile">
+ <xsl:attribute name="full-path">
+ <xsl:value-of
+ select="concat($epub.oebps.dir, '/', $epub.package.filename)"/>
+ </xsl:attribute>
+ <xsl:attribute name="media-type">
+ <xsl:text>application/oebps-package+xml</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="mimetype">'
+ <xsl:call-template name="write.text.chunk">
+ <xsl:with-param name="filename" select="$epub.mimetype.pathname"/>
+ <xsl:with-param name="content" select="$epub.mimetype.value"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="mediaobject[@role='cover' or ancestor::cover]">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:value-of select="$epub.cover.pathname" />
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'" />
+ <xsl:with-param name="encoding" select="'utf-8'" />
+ <xsl:with-param name="indent" select="'no'" />
+ <xsl:with-param name="quiet" select="$chunk.quietly" />
+ <xsl:with-param name="content">
+ <xsl:element namespace="http://www.w3.org/1999/xhtml" name="html">
+ <xsl:element namespace="http://www.w3.org/1999/xhtml" name="head">
+ <xsl:element namespace="http://www.w3.org/1999/xhtml" name="title">Cover</xsl:element>
+ <xsl:element namespace="http://www.w3.org/1999/xhtml" name="style">
+ <xsl:attribute name="type">text/css</xsl:attribute>
+ <!-- Help the cover image scale nicely in the CSS then apply a max-width to look better in Adobe Digital Editions -->
+ <xsl:text> img { max-width: 100%; }</xsl:text>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element namespace="http://www.w3.org/1999/xhtml" name="body">
+ <xsl:element namespace="http://www.w3.org/1999/xhtml" name="div">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$epub.cover.image.id"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="imageobject[@role='front-large']">
+ <xsl:apply-templates select="imageobject[@role='front-large']"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="imageobject[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <!-- If this is defined as an explicit cover page, then process
+ any remaining text -->
+ <xsl:if test="ancestor::cover">
+ <xsl:apply-templates select="ancestor::cover/para"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- EPUB3: use <nav> and <ol> in TOC lists -->
+<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"/>
+ <nav epub:type="toc">
+ <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>
+ </nav>
+ </div>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$qanda.in.toc != 0">
+ <div class="toc">
+ <xsl:copy-of select="$toc.title"/>
+ <nav epub:type="toc">
+ <xsl:element name="{$toc.list.type}">
+ <xsl:if test="$nodes.plus">
+ <xsl:apply-templates select="$nodes.plus" mode="toc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ </nav>
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <div class="toc">
+ <xsl:copy-of select="$toc.title"/>
+ <nav epub:type="toc">
+ <xsl:element name="{$toc.list.type}">
+ <xsl:if test="$nodes">
+ <xsl:apply-templates select="$nodes" mode="toc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ </nav>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:otherwise>
+ </xsl:choose>
+</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:variable name="epub.type">
+ <xsl:choose>
+ <xsl:when test="$titles='table'">lot</xsl:when>
+ <xsl:when test="$titles='figure'">loi</xsl:when>
+ <xsl:when test="$titles='equation'">loi</xsl:when>
+ <xsl:when test="$titles='example'">loi</xsl:when>
+ <xsl:when test="$titles='procedure'">loi</xsl:when>
+ <xsl:otherwise>loi</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:if test="$nodes">
+ <div class="list-of-{$titles}s">
+ <nav epub:type="{$epub.type}">
+ <h4 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>
+ </h4>
+
+ <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>
+ </nav>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+<!-- EPUB3: add hidden="" for sections below toc.section.depth -->
+<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="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(.) = '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(..) = '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">
+ <xsl:element name="{$toc.list.type}">
+ <xsl:choose>
+ <xsl:when test="$toc.listitem.type = 'li'
+ and $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">
+ <!-- No @hidden attribute -->
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Add empty @hidden attribute if too deep -->
+ <xsl:attribute name="hidden"></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <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="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
+ ( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
+ ($qanda.in.toc != 0 and count($nodes.plus)&gt;0) ) ">
+ <xsl:copy-of select="$subtoc.list"/>
+ </xsl:if>
+ </xsl:element>
+</xsl:template>
+
+<!-- Inserted when a title is blank to avoid epubcheck error -->
+<xsl:param name="toc.entry.default.text">&#xA0;</xsl:param>
+
+<!-- EPUB3: either <a> or <span>, but not both -->
+<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"/>
+
+ <xsl:variable name="title">
+ <xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <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:choose>
+ <xsl:when test="string-length(normalize-space($title)) != 0">
+ <xsl:copy-of select="$title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$toc.entry.default.text"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </a>
+</xsl:template>
+
+<!-- Make sure all text is inside the <a> element for epub3 -->
+<xsl:template match="figure|table|example|equation|procedure" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+
+ <xsl:element name="{$toc.listitem.type}">
+ <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: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:apply-templates select="." mode="titleabbrev.markup"/>
+ </a>
+ </xsl:element>
+</xsl:template>
+
+<!-- Remove spans from refentry TOC lines for epub3check -->
+<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}" namespace="http://www.w3.org/1999/xhtml">
+ <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"/>
+ <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 -->
+ <!-- Set allow-anchors=0 to avoid indexterms and other links -->
+ <xsl:text> - </xsl:text>
+ <xsl:apply-templates select="refnamediv/refpurpose" mode="no.anchor.mode"/>
+ </xsl:if>
+ </a>
+ </xsl:element>
+</xsl:template>
+
+<!-- Copy these here so relative document() open gets the correct css source -->
+<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:stylesheet>
diff --git a/epub3/profile-chunk.xsl b/epub3/profile-chunk.xsl
new file mode 100644
index 0000000..64ed1fe
--- /dev/null
+++ b/epub3/profile-chunk.xsl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl">
+
+<!-- ********************************************************************
+ $Id: profile-chunk.xsl,v 1.1 2011-09-16 21:43:45 bobs Exp $
+ ********************************************************************
+
+ 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.
+
+ ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<!-- First import the non-chunking templates that format elements
+ within each chunk file. In a customization, you should
+ create a separate non-chunking customization layer such
+ as mydocbook.xsl that imports the original docbook.xsl and
+ customizes any presentation templates. Then your chunking
+ customization should import mydocbook.xsl instead of
+ docbook.xsl. -->
+<xsl:import href="docbook.xsl"/>
+
+<!-- chunk-common.xsl contains all the named templates for chunking.
+ In a customization file, you import chunk-common.xsl, then
+ add any customized chunking templates of the same name.
+ They will have import precedence over the original
+ chunking templates in chunk-common.xsl. -->
+<xsl:import href="../xhtml/chunk-common.xsl"/>
+
+<!-- The manifest.xsl module is no longer imported because its
+ templates were moved into chunk-common and chunk-code -->
+
+<!-- chunk-code.xsl contains all the chunking templates that use
+ a match attribute. In a customization it should be referenced
+ using <xsl:include> instead of <xsl:import>, and then add
+ any customized chunking templates with match attributes. But be sure
+ to add a priority="1" to such customized templates to resolve
+ its conflict with the original, since they have the
+ same import precedence.
+
+ Using xsl:include prevents adding another layer
+ of import precedence, which would cause any
+ customizations that use xsl:apply-imports to wrongly
+ apply the chunking version instead of the original
+ non-chunking version to format an element. -->
+<xsl:include href="../xhtml/profile-chunk-code.xsl"/>
+
+<xsl:include href="epub3-chunk-mods.xsl"/>
+
+</xsl:stylesheet>
diff --git a/epub3/profile-docbook.xsl b/epub3/profile-docbook.xsl
new file mode 100644
index 0000000..7ff667d
--- /dev/null
+++ b/epub3/profile-docbook.xsl
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets.-->
+<!--This file was created automatically by xsl2profile-->
+<!--from the DocBook XSL stylesheets.-->
+<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" xmlns="http://www.w3.org/1999/xhtml" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="db ng exsl exslt exslt" version="1.0">
+
+<xsl:output method="xml" encoding="UTF-8" indent="no"/>
+
+<!-- ********************************************************************
+ $Id: profile-docbook.xsl,v 1.1 2011-09-16 21:43:45 bobs Exp $
+ ********************************************************************
+
+ 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="../xhtml/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="../xhtml/autotoc.xsl"/>
+<xsl:include href="../xhtml/autoidx.xsl"/>
+<xsl:include href="../xhtml/lists.xsl"/>
+<xsl:include href="../xhtml/callout.xsl"/>
+<xsl:include href="../xhtml/verbatim.xsl"/>
+<xsl:include href="../xhtml/graphics.xsl"/>
+<xsl:include href="../xhtml/xref.xsl"/>
+<xsl:include href="../xhtml/formal.xsl"/>
+<xsl:include href="../xhtml/table.xsl"/>
+<xsl:include href="../xhtml/htmltbl.xsl"/>
+<xsl:include href="../xhtml/sections.xsl"/>
+<xsl:include href="../xhtml/inline.xsl"/>
+<xsl:include href="../xhtml/footnote.xsl"/>
+<xsl:include href="../xhtml/html.xsl"/>
+<xsl:include href="../xhtml/info.xsl"/>
+<xsl:include href="../xhtml/keywords.xsl"/>
+<xsl:include href="../xhtml/division.xsl"/>
+<xsl:include href="../xhtml/toc.xsl"/>
+<xsl:include href="../xhtml/index.xsl"/>
+<xsl:include href="../xhtml/refentry.xsl"/>
+<xsl:include href="../xhtml/math.xsl"/>
+<xsl:include href="../xhtml/admon.xsl"/>
+<xsl:include href="../xhtml/component.xsl"/>
+<xsl:include href="../xhtml/biblio.xsl"/>
+<xsl:include href="../xhtml/biblio-iso690.xsl"/>
+<xsl:include href="../xhtml/glossary.xsl"/>
+<xsl:include href="../xhtml/block.xsl"/>
+<xsl:include href="../xhtml/task.xsl"/>
+<xsl:include href="../xhtml/qandaset.xsl"/>
+<xsl:include href="../xhtml/synop.xsl"/>
+<xsl:include href="../xhtml/titlepage.xsl"/>
+<xsl:include href="../xhtml/titlepage.templates.xsl"/>
+<xsl:include href="../xhtml/pi.xsl"/>
+<xsl:include href="../xhtml/ebnf.xsl"/>
+<xsl:include href="../xhtml/chunker.xsl"/>
+<xsl:include href="../xhtml/html-rtf.xsl"/>
+<xsl:include href="../xhtml/annotations.xsl"/>
+<xsl:include href="../common/stripns.xsl"/>
+
+<xsl:param name="stylesheet.result.type" select="'xhtml'"/>
+<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"><xslo:if xmlns:xslo="http://www.w3.org/1999/XSL/Transform" test="starts-with($writing.mode, 'rl')"><xslo:attribute name="dir">rtl</xslo:attribute></xslo:if>
+<!-- no apply-templates; make it empty except for dir for rtl-->
+</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="$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 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>
+// Create PopupWindow objects</xsl:text>
+ <xsl:for-each select="//annotation">
+ <xsl:text>
+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>");
+</xsl:text>
+ <xsl:text>popup_</xsl:text>
+ <xsl:value-of select="generate-id(.)"/>
+ <xsl:text>.offsetY = 15;
+</xsl:text>
+ <xsl:text>popup_</xsl:text>
+ <xsl:value-of select="generate-id(.)"/>
+ <xsl:text>.autoHide();
+</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: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:template>
+
+<xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="*/self::ng:* or */self::db:*"><xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>Note: namesp. cut : processing stripped document</xslo:message><xslo:apply-templates select="exslt:node-set($stripped-content)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><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="false()"/>
+ <!-- Can't process unless namespace removed -->
+ <xsl:when test="false()"/>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$rootid != ''">
+ <xsl:choose>
+ <xsl:when test="count($profiled-nodes//*[@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="$profiled-nodes//*[@id=$rootid]" mode="process.root"/>
+ <xsl:if test="$tex.math.in.alt != ''">
+ <xsl:apply-templates select="$profiled-nodes//*[@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="$profiled-nodes" mode="collect.targets"/>
+ </xsl:if>
+ <xsl:if test="$collect.xref.targets != 'only'">
+ <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
+ <xsl:if test="$tex.math.in.alt != ''">
+ <xsl:apply-templates select="$profiled-nodes" 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>
+ <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.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>
diff --git a/epub3/titlepage.templates.xml b/epub3/titlepage.templates.xml
new file mode 100644
index 0000000..c9b8ee5
--- /dev/null
+++ b/epub3/titlepage.templates.xml
@@ -0,0 +1,712 @@
+<t:templates xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0"
+ xmlns:param="http://nwalsh.com/docbook/xsl/template/1.0/param"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="article" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <hr/>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="set" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <hr/>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="book" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <isbn/>
+ <issn/>
+ <biblioid/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <hr/>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="part" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:force="1"
+ t:named-template="division.title"
+ param:node="ancestor-or-self::part[1]"/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<t:titlepage t:element="partintro" t:wrapper="div">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="reference" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <hr/>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="refentry" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+<!-- uncomment this if you want refentry titlepages
+ <title t:force="1"
+ t:named-template="refentry.title"
+ param:node="ancestor-or-self::refentry[1]"/>
+-->
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator/>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+ <t:titlepage t:element="dedication" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:force="1"
+ t:named-template="component.title"
+ param:node="ancestor-or-self::dedication[1]"/>
+ <subtitle/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="acknowledgements" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:force="1"
+ t:named-template="component.title"
+ param:node="ancestor-or-self::acknowledgements[1]"/>
+ <subtitle/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="preface" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="chapter" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="appendix" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="section" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <xsl:if test="count(parent::*)='0'"><hr/></xsl:if>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<t:titlepage t:element="sect1" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <xsl:if test="count(parent::*)='0'"><hr/></xsl:if>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<t:titlepage t:element="sect2" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <xsl:if test="count(parent::*)='0'"><hr/></xsl:if>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<t:titlepage t:element="sect3" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <xsl:if test="count(parent::*)='0'"><hr/></xsl:if>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<t:titlepage t:element="sect4" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <xsl:if test="count(parent::*)='0'"><hr/></xsl:if>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<t:titlepage t:element="sect5" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <xsl:if test="count(parent::*)='0'"><hr/></xsl:if>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<t:titlepage t:element="simplesect" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title/>
+ <subtitle/>
+ <corpauthor/>
+ <authorgroup/>
+ <author/>
+ <othercredit/>
+ <releaseinfo/>
+ <copyright/>
+ <legalnotice/>
+ <pubdate/>
+ <revision/>
+ <revhistory/>
+ <abstract/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ <xsl:if test="count(parent::*)='0'"><hr/></xsl:if>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="bibliography" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:force="1"
+ t:named-template="component.title"
+ param:node="ancestor-or-self::bibliography[1]"/>
+ <subtitle/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="glossary" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:force="1"
+ t:named-template="component.title"
+ param:node="ancestor-or-self::glossary[1]"/>
+ <subtitle/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="index" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:force="1"
+ t:named-template="component.title"
+ param:node="ancestor-or-self::index[1]"/>
+ <subtitle/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+<t:titlepage t:element="setindex" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:force="1"
+ t:named-template="component.title"
+ param:node="ancestor-or-self::setindex[1]"/>
+ <subtitle/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+<t:titlepage t:element="sidebar" t:wrapper="div" class="titlepage">
+ <t:titlepage-content t:side="recto">
+ <title
+ t:named-template="formal.object.heading"
+ param:object="ancestor-or-self::sidebar[1]"/>
+ <subtitle/>
+ </t:titlepage-content>
+
+ <t:titlepage-content t:side="verso">
+ </t:titlepage-content>
+
+ <t:titlepage-separator>
+ </t:titlepage-separator>
+
+ <t:titlepage-before t:side="recto">
+ </t:titlepage-before>
+
+ <t:titlepage-before t:side="verso">
+ </t:titlepage-before>
+</t:titlepage>
+
+<!-- ==================================================================== -->
+
+</t:templates>
diff --git a/epub3/titlepage.templates.xsl b/epub3/titlepage.templates.xsl
new file mode 100644
index 0000000..e2b5e37
--- /dev/null
+++ b/epub3/titlepage.templates.xsl
@@ -0,0 +1,3841 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="1.0" exclude-result-prefixes="exsl">
+
+<!-- This stylesheet was created by template/titlepage.xsl-->
+
+<xsl:template name="article.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="articleinfo/title">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/title"/>
+ </xsl:when>
+ <xsl:when test="artheader/title">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="articleinfo/subtitle">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="artheader/subtitle">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/corpauthor"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/corpauthor"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/authorgroup"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/authorgroup"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/author"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/author"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/othercredit"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/othercredit"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/releaseinfo"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/releaseinfo"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/copyright"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/copyright"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/legalnotice"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/legalnotice"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/pubdate"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/pubdate"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/revision"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/revision"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/revhistory"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/revhistory"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/abstract"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/abstract"/>
+ <xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="article.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="article.titlepage.separator"><hr xmlns="http://www.w3.org/1999/xhtml"/>
+</xsl:template>
+
+<xsl:template name="article.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="article.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="article.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="article.titlepage.before.recto"/>
+ <xsl:call-template name="article.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="article.titlepage.before.verso"/>
+ <xsl:call-template name="article.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="article.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="article.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="article.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="article.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="article.titlepage.recto.style">
+<xsl:apply-templates select="." mode="article.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="set.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="setinfo/title">
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="setinfo/subtitle">
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/corpauthor"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/authorgroup"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/author"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/othercredit"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/releaseinfo"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/copyright"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/legalnotice"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/pubdate"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/revision"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/revhistory"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="setinfo/abstract"/>
+ <xsl:apply-templates mode="set.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="set.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="set.titlepage.separator"><hr xmlns="http://www.w3.org/1999/xhtml"/>
+</xsl:template>
+
+<xsl:template name="set.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="set.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="set.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="set.titlepage.before.recto"/>
+ <xsl:call-template name="set.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="set.titlepage.before.verso"/>
+ <xsl:call-template name="set.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="set.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="set.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="set.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="set.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="set.titlepage.recto.style">
+<xsl:apply-templates select="." mode="set.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="book.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="bookinfo/title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="bookinfo/subtitle">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/isbn"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/isbn"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/issn"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/issn"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/biblioid"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/biblioid"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/corpauthor"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/authorgroup"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/author"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/othercredit"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/copyright"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/pubdate"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revision"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revhistory"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/abstract"/>
+ <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="book.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="book.titlepage.separator"><hr xmlns="http://www.w3.org/1999/xhtml"/>
+</xsl:template>
+
+<xsl:template name="book.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="book.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="book.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="book.titlepage.before.recto"/>
+ <xsl:call-template name="book.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="book.titlepage.before.verso"/>
+ <xsl:call-template name="book.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="book.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="book.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="book.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="isbn" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="issn" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="biblioid" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="book.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="book.titlepage.recto.style">
+<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="part.titlepage.recto">
+ <div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:call-template name="division.title">
+<xsl:with-param name="node" select="ancestor-or-self::part[1]"/>
+</xsl:call-template></div>
+ <xsl:choose>
+ <xsl:when test="partinfo/subtitle">
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/corpauthor"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/corpauthor"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/authorgroup"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/authorgroup"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/author"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/author"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/othercredit"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/othercredit"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/releaseinfo"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/releaseinfo"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/copyright"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/copyright"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/legalnotice"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/legalnotice"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/pubdate"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/pubdate"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/revision"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/revision"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/revhistory"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/revhistory"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="partinfo/abstract"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="docinfo/abstract"/>
+ <xsl:apply-templates mode="part.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="part.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="part.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="part.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="part.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="part.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="part.titlepage.before.recto"/>
+ <xsl:call-template name="part.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="part.titlepage.before.verso"/>
+ <xsl:call-template name="part.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="part.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="part.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="part.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="part.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="part.titlepage.recto.style">
+<xsl:apply-templates select="." mode="part.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="partintro.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="partintroinfo/title">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/title"/>
+ </xsl:when>
+ <xsl:when test="docinfo/title">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="partintroinfo/subtitle">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/corpauthor"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/corpauthor"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/authorgroup"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/authorgroup"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/author"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/author"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/othercredit"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/othercredit"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/releaseinfo"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/releaseinfo"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/copyright"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/copyright"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/legalnotice"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/legalnotice"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/pubdate"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/pubdate"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/revision"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/revision"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/revhistory"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/revhistory"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="partintroinfo/abstract"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="docinfo/abstract"/>
+ <xsl:apply-templates mode="partintro.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="partintro.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="partintro.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="partintro.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="partintro.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="partintro.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="partintro.titlepage.before.recto"/>
+ <xsl:call-template name="partintro.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="partintro.titlepage.before.verso"/>
+ <xsl:call-template name="partintro.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="partintro.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="partintro.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="partintro.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="partintro.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="partintro.titlepage.recto.style">
+<xsl:apply-templates select="." mode="partintro.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="reference.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="referenceinfo/title">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/title"/>
+ </xsl:when>
+ <xsl:when test="docinfo/title">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="referenceinfo/subtitle">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/corpauthor"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/corpauthor"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/authorgroup"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/authorgroup"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/author"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/author"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/othercredit"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/othercredit"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/releaseinfo"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/releaseinfo"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/copyright"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/copyright"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/legalnotice"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/legalnotice"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/pubdate"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/pubdate"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/revision"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/revision"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/revhistory"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/revhistory"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="referenceinfo/abstract"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="docinfo/abstract"/>
+ <xsl:apply-templates mode="reference.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="reference.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="reference.titlepage.separator"><hr xmlns="http://www.w3.org/1999/xhtml"/>
+</xsl:template>
+
+<xsl:template name="reference.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="reference.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="reference.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="reference.titlepage.before.recto"/>
+ <xsl:call-template name="reference.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="reference.titlepage.before.verso"/>
+ <xsl:call-template name="reference.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="reference.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="reference.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="reference.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="reference.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="reference.titlepage.recto.style">
+<xsl:apply-templates select="." mode="reference.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="refentry.titlepage.recto">
+</xsl:template>
+
+<xsl:template name="refentry.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="refentry.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="refentry.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="refentry.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="refentry.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="refentry.titlepage.before.recto"/>
+ <xsl:call-template name="refentry.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="refentry.titlepage.before.verso"/>
+ <xsl:call-template name="refentry.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="refentry.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="refentry.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="refentry.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template name="dedication.titlepage.recto">
+ <div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="dedication.titlepage.recto.style">
+<xsl:call-template name="component.title">
+<xsl:with-param name="node" select="ancestor-or-self::dedication[1]"/>
+</xsl:call-template></div>
+ <xsl:choose>
+ <xsl:when test="dedicationinfo/subtitle">
+ <xsl:apply-templates mode="dedication.titlepage.recto.auto.mode" select="dedicationinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="dedication.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="dedication.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="dedication.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="dedication.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="dedication.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="dedication.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="dedication.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="dedication.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="dedication.titlepage.before.recto"/>
+ <xsl:call-template name="dedication.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="dedication.titlepage.before.verso"/>
+ <xsl:call-template name="dedication.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="dedication.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="dedication.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="dedication.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="dedication.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="dedication.titlepage.recto.style">
+<xsl:apply-templates select="." mode="dedication.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="acknowledgements.titlepage.recto">
+ <div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="acknowledgements.titlepage.recto.style">
+<xsl:call-template name="component.title">
+<xsl:with-param name="node" select="ancestor-or-self::acknowledgements[1]"/>
+</xsl:call-template></div>
+ <xsl:choose>
+ <xsl:when test="acknowledgementsinfo/subtitle">
+ <xsl:apply-templates mode="acknowledgements.titlepage.recto.auto.mode" select="acknowledgementsinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="acknowledgements.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="acknowledgements.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="acknowledgements.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="acknowledgements.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="acknowledgements.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="acknowledgements.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="acknowledgements.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="acknowledgements.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="acknowledgements.titlepage.before.recto"/>
+ <xsl:call-template name="acknowledgements.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="acknowledgements.titlepage.before.verso"/>
+ <xsl:call-template name="acknowledgements.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="acknowledgements.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="acknowledgements.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="acknowledgements.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="acknowledgements.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="acknowledgements.titlepage.recto.style">
+<xsl:apply-templates select="." mode="acknowledgements.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="preface.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="prefaceinfo/title">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/title"/>
+ </xsl:when>
+ <xsl:when test="docinfo/title">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="prefaceinfo/subtitle">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/corpauthor"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/corpauthor"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/authorgroup"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/authorgroup"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/author"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/author"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/othercredit"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/othercredit"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/releaseinfo"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/releaseinfo"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/copyright"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/copyright"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/legalnotice"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/legalnotice"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/pubdate"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/pubdate"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/revision"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/revision"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/revhistory"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/revhistory"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="prefaceinfo/abstract"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="docinfo/abstract"/>
+ <xsl:apply-templates mode="preface.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="preface.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="preface.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="preface.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="preface.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="preface.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="preface.titlepage.before.recto"/>
+ <xsl:call-template name="preface.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="preface.titlepage.before.verso"/>
+ <xsl:call-template name="preface.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="preface.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="preface.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="preface.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="preface.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="preface.titlepage.recto.style">
+<xsl:apply-templates select="." mode="preface.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="chapter.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="chapterinfo/title">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/title"/>
+ </xsl:when>
+ <xsl:when test="docinfo/title">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="chapterinfo/subtitle">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/corpauthor"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/corpauthor"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/authorgroup"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/authorgroup"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/author"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/author"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/othercredit"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/othercredit"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/releaseinfo"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/releaseinfo"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/copyright"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/copyright"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/legalnotice"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/legalnotice"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/pubdate"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/pubdate"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/revision"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/revision"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/revhistory"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/revhistory"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="chapterinfo/abstract"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="docinfo/abstract"/>
+ <xsl:apply-templates mode="chapter.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="chapter.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="chapter.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="chapter.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="chapter.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="chapter.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="chapter.titlepage.before.recto"/>
+ <xsl:call-template name="chapter.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="chapter.titlepage.before.verso"/>
+ <xsl:call-template name="chapter.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="chapter.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="chapter.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="chapter.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="chapter.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="chapter.titlepage.recto.style">
+<xsl:apply-templates select="." mode="chapter.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="appendix.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="appendixinfo/title">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/title"/>
+ </xsl:when>
+ <xsl:when test="docinfo/title">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="appendixinfo/subtitle">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/corpauthor"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/corpauthor"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/authorgroup"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/authorgroup"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/author"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/author"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/othercredit"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/othercredit"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/releaseinfo"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/releaseinfo"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/copyright"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/copyright"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/legalnotice"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/legalnotice"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/pubdate"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/pubdate"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/revision"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/revision"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/revhistory"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/revhistory"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="appendixinfo/abstract"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="docinfo/abstract"/>
+ <xsl:apply-templates mode="appendix.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="appendix.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="appendix.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="appendix.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="appendix.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="appendix.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="appendix.titlepage.before.recto"/>
+ <xsl:call-template name="appendix.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="appendix.titlepage.before.verso"/>
+ <xsl:call-template name="appendix.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="appendix.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="appendix.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="appendix.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="appendix.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="appendix.titlepage.recto.style">
+<xsl:apply-templates select="." mode="appendix.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="section.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="sectioninfo/title">
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="sectioninfo/subtitle">
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/corpauthor"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/authorgroup"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/author"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/othercredit"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/releaseinfo"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/copyright"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/legalnotice"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/pubdate"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/revision"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/revhistory"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="sectioninfo/abstract"/>
+ <xsl:apply-templates mode="section.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="section.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="section.titlepage.separator"><xsl:if test="count(parent::*)='0'"><hr xmlns="http://www.w3.org/1999/xhtml"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="section.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="section.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="section.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="section.titlepage.before.recto"/>
+ <xsl:call-template name="section.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="section.titlepage.before.verso"/>
+ <xsl:call-template name="section.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="section.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="section.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="section.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="section.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="section.titlepage.recto.style">
+<xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="sect1.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="sect1info/title">
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="sect1info/subtitle">
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/corpauthor"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/authorgroup"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/author"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/othercredit"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/releaseinfo"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/copyright"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/legalnotice"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/pubdate"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/revision"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/revhistory"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="sect1info/abstract"/>
+ <xsl:apply-templates mode="sect1.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="sect1.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="sect1.titlepage.separator"><xsl:if test="count(parent::*)='0'"><hr xmlns="http://www.w3.org/1999/xhtml"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="sect1.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="sect1.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="sect1.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="sect1.titlepage.before.recto"/>
+ <xsl:call-template name="sect1.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="sect1.titlepage.before.verso"/>
+ <xsl:call-template name="sect1.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="sect1.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="sect1.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="sect1.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="sect1.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect1.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect1.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="sect2.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="sect2info/title">
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="sect2info/subtitle">
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/corpauthor"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/authorgroup"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/author"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/othercredit"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/releaseinfo"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/copyright"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/legalnotice"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/pubdate"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/revision"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/revhistory"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="sect2info/abstract"/>
+ <xsl:apply-templates mode="sect2.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="sect2.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="sect2.titlepage.separator"><xsl:if test="count(parent::*)='0'"><hr xmlns="http://www.w3.org/1999/xhtml"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="sect2.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="sect2.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="sect2.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="sect2.titlepage.before.recto"/>
+ <xsl:call-template name="sect2.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="sect2.titlepage.before.verso"/>
+ <xsl:call-template name="sect2.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="sect2.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="sect2.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="sect2.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="sect2.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect2.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect2.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="sect3.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="sect3info/title">
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="sect3info/subtitle">
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/corpauthor"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/authorgroup"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/author"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/othercredit"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/releaseinfo"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/copyright"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/legalnotice"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/pubdate"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/revision"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/revhistory"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="sect3info/abstract"/>
+ <xsl:apply-templates mode="sect3.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="sect3.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="sect3.titlepage.separator"><xsl:if test="count(parent::*)='0'"><hr xmlns="http://www.w3.org/1999/xhtml"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="sect3.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="sect3.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="sect3.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="sect3.titlepage.before.recto"/>
+ <xsl:call-template name="sect3.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="sect3.titlepage.before.verso"/>
+ <xsl:call-template name="sect3.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="sect3.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="sect3.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="sect3.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="sect3.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect3.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect3.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="sect4.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="sect4info/title">
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="sect4info/subtitle">
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/corpauthor"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/authorgroup"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/author"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/othercredit"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/releaseinfo"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/copyright"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/legalnotice"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/pubdate"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/revision"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/revhistory"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="sect4info/abstract"/>
+ <xsl:apply-templates mode="sect4.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="sect4.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="sect4.titlepage.separator"><xsl:if test="count(parent::*)='0'"><hr xmlns="http://www.w3.org/1999/xhtml"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="sect4.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="sect4.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="sect4.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="sect4.titlepage.before.recto"/>
+ <xsl:call-template name="sect4.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="sect4.titlepage.before.verso"/>
+ <xsl:call-template name="sect4.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="sect4.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="sect4.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="sect4.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="sect4.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect4.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect4.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="sect5.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="sect5info/title">
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="sect5info/subtitle">
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/corpauthor"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/authorgroup"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/author"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/othercredit"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/releaseinfo"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/copyright"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/legalnotice"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/pubdate"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/revision"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/revhistory"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="sect5info/abstract"/>
+ <xsl:apply-templates mode="sect5.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="sect5.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="sect5.titlepage.separator"><xsl:if test="count(parent::*)='0'"><hr xmlns="http://www.w3.org/1999/xhtml"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="sect5.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="sect5.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="sect5.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="sect5.titlepage.before.recto"/>
+ <xsl:call-template name="sect5.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="sect5.titlepage.before.verso"/>
+ <xsl:call-template name="sect5.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="sect5.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="sect5.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="sect5.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="sect5.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sect5.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sect5.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="simplesect.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="simplesectinfo/title">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/title"/>
+ </xsl:when>
+ <xsl:when test="docinfo/title">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="simplesectinfo/subtitle">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/corpauthor"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/corpauthor"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/corpauthor"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/authorgroup"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/authorgroup"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/authorgroup"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/author"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/author"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/author"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/othercredit"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/othercredit"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/othercredit"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/releaseinfo"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/releaseinfo"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/releaseinfo"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/copyright"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/copyright"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/copyright"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/legalnotice"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/legalnotice"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/legalnotice"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/pubdate"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/pubdate"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/pubdate"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/revision"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/revision"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/revision"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/revhistory"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/revhistory"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/revhistory"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="simplesectinfo/abstract"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="docinfo/abstract"/>
+ <xsl:apply-templates mode="simplesect.titlepage.recto.auto.mode" select="info/abstract"/>
+</xsl:template>
+
+<xsl:template name="simplesect.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="simplesect.titlepage.separator"><xsl:if test="count(parent::*)='0'"><hr xmlns="http://www.w3.org/1999/xhtml"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="simplesect.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="simplesect.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="simplesect.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="simplesect.titlepage.before.recto"/>
+ <xsl:call-template name="simplesect.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="simplesect.titlepage.before.verso"/>
+ <xsl:call-template name="simplesect.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="simplesect.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="simplesect.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="simplesect.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="author" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="copyright" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="legalnotice" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revision" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template match="abstract" mode="simplesect.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="simplesect.titlepage.recto.style">
+<xsl:apply-templates select="." mode="simplesect.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="bibliography.titlepage.recto">
+ <div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="bibliography.titlepage.recto.style">
+<xsl:call-template name="component.title">
+<xsl:with-param name="node" select="ancestor-or-self::bibliography[1]"/>
+</xsl:call-template></div>
+ <xsl:choose>
+ <xsl:when test="bibliographyinfo/subtitle">
+ <xsl:apply-templates mode="bibliography.titlepage.recto.auto.mode" select="bibliographyinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="bibliography.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="bibliography.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="bibliography.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="bibliography.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="bibliography.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="bibliography.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="bibliography.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="bibliography.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="bibliography.titlepage.before.recto"/>
+ <xsl:call-template name="bibliography.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="bibliography.titlepage.before.verso"/>
+ <xsl:call-template name="bibliography.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="bibliography.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="bibliography.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="bibliography.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="bibliography.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="bibliography.titlepage.recto.style">
+<xsl:apply-templates select="." mode="bibliography.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="glossary.titlepage.recto">
+ <div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="glossary.titlepage.recto.style">
+<xsl:call-template name="component.title">
+<xsl:with-param name="node" select="ancestor-or-self::glossary[1]"/>
+</xsl:call-template></div>
+ <xsl:choose>
+ <xsl:when test="glossaryinfo/subtitle">
+ <xsl:apply-templates mode="glossary.titlepage.recto.auto.mode" select="glossaryinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="glossary.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="glossary.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="glossary.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="glossary.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="glossary.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="glossary.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="glossary.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="glossary.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="glossary.titlepage.before.recto"/>
+ <xsl:call-template name="glossary.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="glossary.titlepage.before.verso"/>
+ <xsl:call-template name="glossary.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="glossary.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="glossary.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="glossary.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="glossary.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="glossary.titlepage.recto.style">
+<xsl:apply-templates select="." mode="glossary.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="index.titlepage.recto">
+ <div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="index.titlepage.recto.style">
+<xsl:call-template name="component.title">
+<xsl:with-param name="node" select="ancestor-or-self::index[1]"/>
+</xsl:call-template></div>
+ <xsl:choose>
+ <xsl:when test="indexinfo/subtitle">
+ <xsl:apply-templates mode="index.titlepage.recto.auto.mode" select="indexinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="index.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="index.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="index.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="index.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="index.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="index.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="index.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="index.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="index.titlepage.before.recto"/>
+ <xsl:call-template name="index.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="index.titlepage.before.verso"/>
+ <xsl:call-template name="index.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="index.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="index.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="index.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="index.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="index.titlepage.recto.style">
+<xsl:apply-templates select="." mode="index.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="setindex.titlepage.recto">
+ <div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="setindex.titlepage.recto.style">
+<xsl:call-template name="component.title">
+<xsl:with-param name="node" select="ancestor-or-self::setindex[1]"/>
+</xsl:call-template></div>
+ <xsl:choose>
+ <xsl:when test="setindexinfo/subtitle">
+ <xsl:apply-templates mode="setindex.titlepage.recto.auto.mode" select="setindexinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="setindex.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="setindex.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="setindex.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="setindex.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="setindex.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="setindex.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="setindex.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="setindex.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="setindex.titlepage.before.recto"/>
+ <xsl:call-template name="setindex.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="setindex.titlepage.before.verso"/>
+ <xsl:call-template name="setindex.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="setindex.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="setindex.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="setindex.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="setindex.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="setindex.titlepage.recto.style">
+<xsl:apply-templates select="." mode="setindex.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+<xsl:template name="sidebar.titlepage.recto">
+ <xsl:choose>
+ <xsl:when test="sidebarinfo/title">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="sidebarinfo/title"/>
+ </xsl:when>
+ <xsl:when test="docinfo/title">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="docinfo/title"/>
+ </xsl:when>
+ <xsl:when test="info/title">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="info/title"/>
+ </xsl:when>
+ <xsl:when test="title">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="title"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="sidebarinfo/subtitle">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="sidebarinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="docinfo/subtitle">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="docinfo/subtitle"/>
+ </xsl:when>
+ <xsl:when test="info/subtitle">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="info/subtitle"/>
+ </xsl:when>
+ <xsl:when test="subtitle">
+ <xsl:apply-templates mode="sidebar.titlepage.recto.auto.mode" select="subtitle"/>
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<xsl:template name="sidebar.titlepage.verso">
+</xsl:template>
+
+<xsl:template name="sidebar.titlepage.separator">
+</xsl:template>
+
+<xsl:template name="sidebar.titlepage.before.recto">
+</xsl:template>
+
+<xsl:template name="sidebar.titlepage.before.verso">
+</xsl:template>
+
+<xsl:template name="sidebar.titlepage">
+ <div xmlns="http://www.w3.org/1999/xhtml" class="titlepage">
+ <xsl:variable name="recto.content">
+ <xsl:call-template name="sidebar.titlepage.before.recto"/>
+ <xsl:call-template name="sidebar.titlepage.recto"/>
+ </xsl:variable>
+ <xsl:variable name="recto.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$recto.content"/></div>
+ </xsl:if>
+ <xsl:variable name="verso.content">
+ <xsl:call-template name="sidebar.titlepage.before.verso"/>
+ <xsl:call-template name="sidebar.titlepage.verso"/>
+ </xsl:variable>
+ <xsl:variable name="verso.elements.count">
+ <xsl:choose>
+ <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')">
+ <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count &gt; 0)">
+ <div><xsl:copy-of select="$verso.content"/></div>
+ </xsl:if>
+ <xsl:call-template name="sidebar.titlepage.separator"/>
+ </div>
+</xsl:template>
+
+<xsl:template match="*" mode="sidebar.titlepage.recto.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="*" mode="sidebar.titlepage.verso.mode">
+ <!-- if an element isn't found in this mode, -->
+ <!-- try the generic titlepage.mode -->
+ <xsl:apply-templates select="." mode="titlepage.mode"/>
+</xsl:template>
+
+<xsl:template match="title" mode="sidebar.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sidebar.titlepage.recto.style">
+<xsl:call-template name="formal.object.heading">
+<xsl:with-param name="object" select="ancestor-or-self::sidebar[1]"/>
+</xsl:call-template>
+</div>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="sidebar.titlepage.recto.auto.mode">
+<div xmlns="http://www.w3.org/1999/xhtml" xsl:use-attribute-sets="sidebar.titlepage.recto.style">
+<xsl:apply-templates select="." mode="sidebar.titlepage.recto.mode"/>
+</div>
+</xsl:template>
+
+</xsl:stylesheet>
+