| 1 |
<?xml version='1.0'?> |
| 2 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 3 |
xmlns:d="http://docbook.org/ns/docbook" |
| 4 |
xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0" |
| 5 |
xmlns:param="http://nwalsh.com/docbook/xsl/template/1.0/param" |
| 6 |
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" |
| 7 |
xmlns:fo="http://www.w3.org/1999/XSL/Format" |
| 8 |
xmlns:exsl="http://exslt.org/common" |
| 9 |
exclude-result-prefixes="doc t param exsl d" |
| 10 |
version='1.0'> |
| 11 |
|
| 12 |
<!-- ******************************************************************** |
| 13 |
|
| 14 |
This file is part of the XSL DocBook Stylesheet distribution. |
| 15 |
See ../README or http://cdn.docbook.org/release/xsl/current/ for |
| 16 |
copyright and other information. |
| 17 |
|
| 18 |
******************************************************************** --> |
| 19 |
|
| 20 |
<!-- ==================================================================== --> |
| 21 |
<xsl:variable name="db.prefix">d:</xsl:variable> |
| 22 |
|
| 23 |
<xsl:template match="/"> |
| 24 |
<xsl:text>
</xsl:text> |
| 25 |
<xsl:apply-templates/> |
| 26 |
<xsl:text>
</xsl:text> |
| 27 |
</xsl:template> |
| 28 |
|
| 29 |
<doc:reference xmlns="" xml:id="template"> |
| 30 |
<?dbhtml dir="template"?> |
| 31 |
<?dbhtml filename="index.html"?> |
| 32 |
<info> |
| 33 |
<title>Titlepage Template Stylesheet Reference</title> |
| 34 |
<releaseinfo role="meta"> |
| 35 |
</releaseinfo> |
| 36 |
</info> |
| 37 |
<partintro xml:id="intro_partintro"> |
| 38 |
<title>Introduction</title> |
| 39 |
<para>This is technical reference documentation for the |
| 40 |
“titlepage” templates in the DocBook XSL Stylesheets.</para> |
| 41 |
<para>This is not intended to be user documentation. It is |
| 42 |
provided for developers writing customization layers for the |
| 43 |
stylesheets.</para> |
| 44 |
</partintro> |
| 45 |
</doc:reference> |
| 46 |
|
| 47 |
<!-- ==================================================================== --> |
| 48 |
|
| 49 |
<xsl:preserve-space elements="*"/> |
| 50 |
<xsl:strip-space elements="xsl:* t:*"/> |
| 51 |
|
| 52 |
<!-- ==================================================================== --> |
| 53 |
|
| 54 |
<doc:template name="get.namespace.prefix"> |
| 55 |
<refpurpose>Obtain namespace prefix for an element identified by a string containing qualified name</refpurpose> |
| 56 |
<refdescription> |
| 57 |
<para>This template interprets a string containing a qualified name of an element |
| 58 |
and returns the namespace prefix, if any.</para> |
| 59 |
<para>Element name could be an XPath expression starting with the element name; this |
| 60 |
template will first determine if the occurrence of a colon is preceded by a valid |
| 61 |
NCName, assuming only ASCII characters.</para> |
| 62 |
</refdescription> |
| 63 |
</doc:template> |
| 64 |
|
| 65 |
<xsl:template name="get.namespace.prefix"> |
| 66 |
<xsl:param name="element.name"/> |
| 67 |
|
| 68 |
<xsl:if test="contains($element.name, ':') and |
| 69 |
translate(substring-before($element.name, ':'), |
| 70 |
'ABCDEFGGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789','') = ''"> |
| 71 |
<xsl:value-of select="substring-before($element.name, ':')"/> |
| 72 |
</xsl:if> |
| 73 |
</xsl:template> |
| 74 |
|
| 75 |
<doc:template name="get.namespace.uri"> |
| 76 |
<refpurpose>Obtain URI for an element identified by a string containing qualified name</refpurpose> |
| 77 |
<refdescription> |
| 78 |
<para>This template interprets a string containing a qualified name of an element |
| 79 |
and returns the namespace URI for that element, looking for namespace prefixes |
| 80 |
starting from a reference node.</para> |
| 81 |
</refdescription> |
| 82 |
</doc:template> |
| 83 |
|
| 84 |
<xsl:template name="get.namespace.uri"> |
| 85 |
<xsl:param name="element.name"/> |
| 86 |
<xsl:param name="reference.node" select="."/> |
| 87 |
<xsl:param name="missing.namespace.warning" select="not(/t:templates/@t:missing-namespace-ok = 'yes')"/> |
| 88 |
|
| 89 |
<xsl:variable name="ns.prefix"> |
| 90 |
<xsl:call-template name="get.namespace.prefix"> |
| 91 |
<xsl:with-param name="element.name" select="$element.name"/> |
| 92 |
</xsl:call-template> |
| 93 |
</xsl:variable> |
| 94 |
|
| 95 |
<xsl:choose> |
| 96 |
<xsl:when test="$reference.node/ancestor-or-self::*/namespace::*[local-name(.) = $ns.prefix]"> |
| 97 |
<xsl:value-of select="$reference.node/ancestor-or-self::*/namespace::*[local-name(.) = $ns.prefix]"/> |
| 98 |
</xsl:when> |
| 99 |
<xsl:when test="$missing.namespace.warning"> |
| 100 |
<xsl:message> |
| 101 |
<xsl:text>WARNING: Namespace '</xsl:text> |
| 102 |
<xsl:value-of select="$ns.prefix"/> |
| 103 |
<xsl:text>' not defined for t:element="</xsl:text> |
| 104 |
<xsl:value-of select="$element.name"/> |
| 105 |
<xsl:text>"; if this is intentional (output has is not in a namespace), add </xsl:text> |
| 106 |
<xsl:text>t:missing-namespace-ok="yes" attribute to t:templates to suppress this warning.</xsl:text> |
| 107 |
</xsl:message> |
| 108 |
</xsl:when> |
| 109 |
</xsl:choose> |
| 110 |
</xsl:template> |
| 111 |
|
| 112 |
<doc:template name="output.wrapper"> |
| 113 |
<refpurpose>Output the wrapper element</refpurpose> |
| 114 |
|
| 115 |
<refdescription> |
| 116 |
<para>This template locates the namespace for the defined wrapper element |
| 117 |
and output it within that namespace. The content of the element is passed |
| 118 |
via the content argument.</para> |
| 119 |
<para>The attribute sets to use for the wrapper element and the element to |
| 120 |
copy non-template attributes from are also passed as arguments.</para> |
| 121 |
</refdescription> |
| 122 |
</doc:template> |
| 123 |
|
| 124 |
<xsl:template name="output.wrapper"> |
| 125 |
<xsl:param name="wrapper" select="ancestor-or-self::t:titlepage[@t:wrapper]"/> |
| 126 |
<xsl:param name="attr.copy.from" select="."/> |
| 127 |
<xsl:param name="attr.sets" select="''"/> |
| 128 |
<xsl:param name="content"/> |
| 129 |
|
| 130 |
<xsl:variable name="ns.uri"> |
| 131 |
<xsl:call-template name="get.namespace.uri"> |
| 132 |
<xsl:with-param name="element.name" select="$wrapper/@t:wrapper"/> |
| 133 |
<xsl:with-param name="reference.node" select="$wrapper"></xsl:with-param> |
| 134 |
</xsl:call-template> |
| 135 |
</xsl:variable> |
| 136 |
|
| 137 |
<xsl:element name="{$wrapper/@t:wrapper}" namespace="{$ns.uri}"> |
| 138 |
<xsl:if test="$attr.sets != ''"> |
| 139 |
<xsl:attribute name="xsl:use-attribute-sets"><xsl:value-of select="$attr.sets"/></xsl:attribute> |
| 140 |
</xsl:if> |
| 141 |
<xsl:for-each select="$attr.copy.from/@*"> |
| 142 |
<xsl:if test="not(starts-with(namespace-uri(.), 'http://nwalsh.com/docbook/xsl/template/1.0'))"> |
| 143 |
<xsl:copy/> |
| 144 |
</xsl:if> |
| 145 |
</xsl:for-each> |
| 146 |
<xsl:copy-of select="$content"/> |
| 147 |
</xsl:element> |
| 148 |
</xsl:template> |
| 149 |
|
| 150 |
<doc:template match="t:templates" xmlns="" id="templates"> |
| 151 |
<refpurpose>Construct a stylesheet for the templates provided</refpurpose> |
| 152 |
|
| 153 |
<refdescription> |
| 154 |
<para>The <literal>t:templates</literal> element is the root of a |
| 155 |
set of templates. This template creates an appropriate |
| 156 |
<literal>xsl:stylesheet</literal> for the templates.</para> |
| 157 |
|
| 158 |
<para>If the <literal>t:templates</literal> element has a |
| 159 |
<literal>base-stylesheet</literal> attribute, an |
| 160 |
<literal>xsl:import</literal> statement is constructed for it.</para> |
| 161 |
|
| 162 |
<para>If the <literal>t:templates</literal> element has a |
| 163 |
<literal>copy-namespaces</literal> attribute, it is interpreted as a |
| 164 |
space-separated list of namespace prefixes to be copied from the template |
| 165 |
to the resulting stylesheet. Default namespace is always copied.</para> |
| 166 |
</refdescription> |
| 167 |
</doc:template> |
| 168 |
|
| 169 |
<xsl:template match="t:templates"> |
| 170 |
<xsl:element name="xsl:stylesheet"> |
| 171 |
|
| 172 |
<xsl:if test="$db.prefix = 'd:'"> |
| 173 |
<xsl:for-each select="document('')/xsl:stylesheet/namespace::d"> |
| 174 |
<xsl:copy/> |
| 175 |
</xsl:for-each> |
| 176 |
</xsl:if> |
| 177 |
|
| 178 |
<xsl:for-each select="document('')/xsl:stylesheet/namespace::exsl"> |
| 179 |
<xsl:copy/> |
| 180 |
</xsl:for-each> |
| 181 |
|
| 182 |
<!-- Two spaces at the beginning of $copied.ns so that the default namespace will be copied --> |
| 183 |
<xsl:variable name="copied.ns" select="concat(' ',@t:copy-namespaces,' ')"/> |
| 184 |
<xsl:for-each select="namespace::*"> |
| 185 |
<xsl:if test="contains($copied.ns,concat(' ',local-name(.),' '))"> |
| 186 |
<xsl:copy/> |
| 187 |
</xsl:if> |
| 188 |
</xsl:for-each> |
| 189 |
|
| 190 |
<xsl:attribute name="version">1.0</xsl:attribute> |
| 191 |
|
| 192 |
<xsl:attribute name="exclude-result-prefixes"> |
| 193 |
<xsl:choose> |
| 194 |
<xsl:when test="$db.prefix = 'd:'">exsl d</xsl:when> |
| 195 |
<xsl:otherwise>exsl</xsl:otherwise> |
| 196 |
</xsl:choose> |
| 197 |
</xsl:attribute> |
| 198 |
|
| 199 |
<xsl:text>

</xsl:text> |
| 200 |
<xsl:comment> |
| 201 |
<xsl:text> This stylesheet was created by </xsl:text> |
| 202 |
<xsl:text>template/titlepage.xsl</xsl:text> |
| 203 |
</xsl:comment> |
| 204 |
|
| 205 |
<xsl:if test="@t:base-stylesheet"> |
| 206 |
<xsl:text>

</xsl:text> |
| 207 |
<xsl:element name="xsl:import"> |
| 208 |
<xsl:attribute name="href"> |
| 209 |
<xsl:value-of select="@t:base-stylesheet"/> |
| 210 |
</xsl:attribute> |
| 211 |
</xsl:element> |
| 212 |
</xsl:if> |
| 213 |
|
| 214 |
<xsl:apply-templates/> |
| 215 |
|
| 216 |
<xsl:text>

</xsl:text> |
| 217 |
</xsl:element> |
| 218 |
</xsl:template> |
| 219 |
|
| 220 |
<!-- ==================================================================== --> |
| 221 |
|
| 222 |
<doc:template match="xsl:*" xmlns="" id="star"> |
| 223 |
<refpurpose>Copy xsl: elements straight through</refpurpose> |
| 224 |
|
| 225 |
<refdescription> |
| 226 |
<para>This template simply copies the xsl: elements |
| 227 |
straight through into the result tree.</para> |
| 228 |
</refdescription> |
| 229 |
</doc:template> |
| 230 |
|
| 231 |
<xsl:template match="xsl:*"> |
| 232 |
<xsl:apply-templates select="." mode="copy"/> |
| 233 |
</xsl:template> |
| 234 |
|
| 235 |
<!-- ==================================================================== --> |
| 236 |
|
| 237 |
<doc:template match="t:titlepage" xmlns="" id="titlepage"> |
| 238 |
<refpurpose>Create the templates necessary to construct a title page</refpurpose> |
| 239 |
|
| 240 |
<refdescription> |
| 241 |
<para>The <literal>t:titlepage</literal> element creates a set of |
| 242 |
templates for processing the titlepage for an element. The |
| 243 |
<quote>root</quote> of this template set is the template named |
| 244 |
<quote><literal>wrapper.titlepage</literal></quote>. That is the |
| 245 |
template that should be called to generate the title page. |
| 246 |
</para> |
| 247 |
|
| 248 |
<para>The <literal>t:titlepage</literal> element has three attributes: |
| 249 |
|
| 250 |
<variablelist> |
| 251 |
<varlistentry><term>element</term> |
| 252 |
<listitem><para>The name of the source document element for which |
| 253 |
these templates apply. In other words, to make a title page for the |
| 254 |
<tag>article</tag> element, set the |
| 255 |
<tag class="attribute">element</tag> attribute to |
| 256 |
<quote><literal>article</literal></quote>. This attribute is required. |
| 257 |
</para></listitem> |
| 258 |
</varlistentry> |
| 259 |
<varlistentry><term>wrapper</term> |
| 260 |
<listitem><para>The entire title page can be wrapped with an element. |
| 261 |
This attribute identifies that element. |
| 262 |
</para></listitem> |
| 263 |
</varlistentry> |
| 264 |
<varlistentry><term>class</term> |
| 265 |
<listitem><para>If the <tag class="attribute">class</tag> attribute |
| 266 |
is set, a <tag class="attribute">class</tag> attribute with this |
| 267 |
value will be added to the wrapper element that surrounds the entire |
| 268 |
title page. |
| 269 |
</para></listitem> |
| 270 |
</varlistentry> |
| 271 |
</variablelist> |
| 272 |
</para> |
| 273 |
|
| 274 |
<para>Any other attributes are copied through literally to the |
| 275 |
wrapper element.</para> |
| 276 |
|
| 277 |
<para>The content of a <literal>t:titlepage</literal> is one or |
| 278 |
more <literal>t:titlepage-content</literal>, |
| 279 |
<literal>t:titlepage-separator</literal>, and |
| 280 |
<literal>t:titlepage-before</literal> elements.</para> |
| 281 |
|
| 282 |
<para>Each of these elements may be provided for the <quote>recto</quote> |
| 283 |
and <quote>verso</quote> sides of the title page.</para> |
| 284 |
|
| 285 |
</refdescription> |
| 286 |
</doc:template> |
| 287 |
|
| 288 |
<xsl:template match="t:titlepage"> |
| 289 |
<!-- process the children to make the templates for the content, |
| 290 |
separator, and before elements --> |
| 291 |
<xsl:apply-templates/> |
| 292 |
|
| 293 |
<!-- output the title page template --> |
| 294 |
<xsl:text>

</xsl:text> |
| 295 |
<xsl:element name="xsl:template"> |
| 296 |
<xsl:attribute name="name"> |
| 297 |
<xsl:value-of select="@t:element"/> |
| 298 |
<xsl:text>.titlepage</xsl:text> |
| 299 |
</xsl:attribute> |
| 300 |
<xsl:text>
 </xsl:text> |
| 301 |
<xsl:call-template name="output.wrapper"> |
| 302 |
<xsl:with-param name="content"> |
| 303 |
<xsl:text>
 </xsl:text> |
| 304 |
<xsl:element name="xsl:variable"> |
| 305 |
<xsl:attribute name="name">recto.content</xsl:attribute> |
| 306 |
<xsl:text>
 </xsl:text> |
| 307 |
<xsl:element name="xsl:call-template"> |
| 308 |
<xsl:attribute name="name"> |
| 309 |
<xsl:value-of select="@t:element"/> |
| 310 |
<xsl:text>.titlepage.before.recto</xsl:text> |
| 311 |
</xsl:attribute> |
| 312 |
</xsl:element> |
| 313 |
<xsl:text>
 </xsl:text> |
| 314 |
<xsl:element name="xsl:call-template"> |
| 315 |
<xsl:attribute name="name"> |
| 316 |
<xsl:value-of select="@t:element"/> |
| 317 |
<xsl:text>.titlepage.recto</xsl:text> |
| 318 |
</xsl:attribute> |
| 319 |
</xsl:element> |
| 320 |
<xsl:text>
 </xsl:text> |
| 321 |
</xsl:element> |
| 322 |
<xsl:text>
 </xsl:text> |
| 323 |
<xsl:element name="xsl:variable"> |
| 324 |
<xsl:attribute name="name">recto.elements.count</xsl:attribute> |
| 325 |
<xsl:text>
 </xsl:text> |
| 326 |
<xsl:element name="xsl:choose"> |
| 327 |
<xsl:text>
 </xsl:text> |
| 328 |
<xsl:element name="xsl:when"> |
| 329 |
<xsl:attribute name="test">function-available('exsl:node-set')</xsl:attribute> |
| 330 |
<xsl:element name="xsl:value-of"> |
| 331 |
<xsl:attribute name="select">count(exsl:node-set($recto.content)/*)</xsl:attribute> |
| 332 |
</xsl:element> |
| 333 |
</xsl:element> |
| 334 |
<xsl:text>
 </xsl:text> |
| 335 |
<xsl:element name="xsl:when"> |
| 336 |
<xsl:attribute name="test">contains(system-property('xsl:vendor'), 'Apache Software Foundation')</xsl:attribute> |
| 337 |
<xsl:text>
 </xsl:text> |
| 338 |
<xsl:comment>Xalan quirk</xsl:comment> |
| 339 |
<xsl:element name="xsl:value-of"> |
| 340 |
<xsl:attribute name="select">count(exsl:node-set($recto.content)/*)</xsl:attribute> |
| 341 |
</xsl:element> |
| 342 |
</xsl:element> |
| 343 |
<xsl:text>
 </xsl:text> |
| 344 |
<xsl:element name="xsl:otherwise"> |
| 345 |
<xsl:text>1</xsl:text> |
| 346 |
</xsl:element> |
| 347 |
<xsl:text>
 </xsl:text> |
| 348 |
</xsl:element> |
| 349 |
<xsl:text>
 </xsl:text> |
| 350 |
</xsl:element> |
| 351 |
<xsl:text>
 </xsl:text> |
| 352 |
<xsl:element name="xsl:if"> |
| 353 |
<xsl:attribute name="test">(normalize-space($recto.content) != '') or ($recto.elements.count > 0)</xsl:attribute> |
| 354 |
<xsl:text>
 </xsl:text> |
| 355 |
<xsl:call-template name="output.wrapper"> |
| 356 |
<xsl:with-param name="attr.copy.from" select="t:titlepage-content[@t:side='recto']"/> |
| 357 |
<xsl:with-param name="content"> |
| 358 |
<xsl:element name="xsl:copy-of"> |
| 359 |
<xsl:attribute name="select">$recto.content</xsl:attribute> |
| 360 |
</xsl:element> |
| 361 |
</xsl:with-param> |
| 362 |
</xsl:call-template> |
| 363 |
<xsl:text>
 </xsl:text> |
| 364 |
</xsl:element> |
| 365 |
<xsl:text>
 </xsl:text> |
| 366 |
<xsl:element name="xsl:variable"> |
| 367 |
<xsl:attribute name="name">verso.content</xsl:attribute> |
| 368 |
<xsl:text>
 </xsl:text> |
| 369 |
<xsl:element name="xsl:call-template"> |
| 370 |
<xsl:attribute name="name"> |
| 371 |
<xsl:value-of select="@t:element"/> |
| 372 |
<xsl:text>.titlepage.before.verso</xsl:text> |
| 373 |
</xsl:attribute> |
| 374 |
</xsl:element> |
| 375 |
<xsl:text>
 </xsl:text> |
| 376 |
<xsl:element name="xsl:call-template"> |
| 377 |
<xsl:attribute name="name"> |
| 378 |
<xsl:value-of select="@t:element"/> |
| 379 |
<xsl:text>.titlepage.verso</xsl:text> |
| 380 |
</xsl:attribute> |
| 381 |
</xsl:element> |
| 382 |
<xsl:text>
 </xsl:text> |
| 383 |
</xsl:element> |
| 384 |
<xsl:text>
 </xsl:text> |
| 385 |
<xsl:element name="xsl:variable"> |
| 386 |
<xsl:attribute name="name">verso.elements.count</xsl:attribute> |
| 387 |
<xsl:text>
 </xsl:text> |
| 388 |
<xsl:element name="xsl:choose"> |
| 389 |
<xsl:text>
 </xsl:text> |
| 390 |
<xsl:element name="xsl:when"> |
| 391 |
<xsl:attribute name="test">function-available('exsl:node-set')</xsl:attribute> |
| 392 |
<xsl:element name="xsl:value-of"> |
| 393 |
<xsl:attribute name="select">count(exsl:node-set($verso.content)/*)</xsl:attribute> |
| 394 |
</xsl:element> |
| 395 |
</xsl:element> |
| 396 |
<xsl:text>
 </xsl:text> |
| 397 |
<xsl:element name="xsl:when"> |
| 398 |
<xsl:attribute name="test">contains(system-property('xsl:vendor'), 'Apache Software Foundation')</xsl:attribute> |
| 399 |
<xsl:text>
 </xsl:text> |
| 400 |
<xsl:comment>Xalan quirk</xsl:comment> |
| 401 |
<xsl:element name="xsl:value-of"> |
| 402 |
<xsl:attribute name="select">count(exsl:node-set($verso.content)/*)</xsl:attribute> |
| 403 |
</xsl:element> |
| 404 |
</xsl:element> |
| 405 |
<xsl:text>
 </xsl:text> |
| 406 |
<xsl:element name="xsl:otherwise"> |
| 407 |
<xsl:text>1</xsl:text> |
| 408 |
</xsl:element> |
| 409 |
<xsl:text>
 </xsl:text> |
| 410 |
</xsl:element> |
| 411 |
<xsl:text>
 </xsl:text> |
| 412 |
</xsl:element> |
| 413 |
<xsl:text>
 </xsl:text> |
| 414 |
<xsl:element name="xsl:if"> |
| 415 |
<xsl:attribute name="test">(normalize-space($verso.content) != '') or ($verso.elements.count > 0)</xsl:attribute> |
| 416 |
<xsl:text>
 </xsl:text> |
| 417 |
<xsl:call-template name="output.wrapper"> |
| 418 |
<xsl:with-param name="attr.copy.from" select="t:titlepage-content[@t:side='verso']"/> |
| 419 |
<xsl:with-param name="content"> |
| 420 |
<xsl:element name="xsl:copy-of"> |
| 421 |
<xsl:attribute name="select">$verso.content</xsl:attribute> |
| 422 |
</xsl:element> |
| 423 |
</xsl:with-param> |
| 424 |
</xsl:call-template> |
| 425 |
<xsl:text>
 </xsl:text> |
| 426 |
</xsl:element> |
| 427 |
<xsl:text>
 </xsl:text> |
| 428 |
<xsl:element name="xsl:call-template"> |
| 429 |
<xsl:attribute name="name"> |
| 430 |
<xsl:value-of select="@t:element"/> |
| 431 |
<xsl:text>.titlepage.separator</xsl:text> |
| 432 |
</xsl:attribute> |
| 433 |
</xsl:element> |
| 434 |
<xsl:text>
 </xsl:text> |
| 435 |
</xsl:with-param> |
| 436 |
</xsl:call-template> |
| 437 |
<xsl:text>
</xsl:text> |
| 438 |
</xsl:element> |
| 439 |
|
| 440 |
<!-- If we're not importing a base stylesheet, output a default rule |
| 441 |
for the recto- and verso-mode elements. (If we are importing a |
| 442 |
base stylesheet, don't do this since the *-rules in the stylesheet |
| 443 |
will totally override the rules that would otherwise be imported.) |
| 444 |
--> |
| 445 |
|
| 446 |
<xsl:if test="not(../@t:base-stylesheet)"> |
| 447 |
<!-- output a default rule for the recto-modes elements --> |
| 448 |
<xsl:text>

</xsl:text> |
| 449 |
<xsl:element name="xsl:template"> |
| 450 |
<xsl:attribute name="match">*</xsl:attribute> |
| 451 |
<xsl:attribute name="mode"> |
| 452 |
<xsl:value-of select="@t:element"/> |
| 453 |
<xsl:text>.titlepage.recto.mode</xsl:text> |
| 454 |
</xsl:attribute> |
| 455 |
<xsl:text>
 </xsl:text> |
| 456 |
<xsl:comment> if an element isn't found in this mode, </xsl:comment> |
| 457 |
<xsl:text>
 </xsl:text> |
| 458 |
<xsl:comment> try the generic titlepage.mode </xsl:comment> |
| 459 |
<xsl:text>
 </xsl:text> |
| 460 |
<xsl:element name="xsl:apply-templates"> |
| 461 |
<xsl:attribute name="select">.</xsl:attribute> |
| 462 |
<xsl:attribute name="mode">titlepage.mode</xsl:attribute> |
| 463 |
</xsl:element> |
| 464 |
<xsl:text>
</xsl:text> |
| 465 |
</xsl:element> |
| 466 |
|
| 467 |
<!-- output a default rule for the verso-modes elements --> |
| 468 |
<xsl:text>

</xsl:text> |
| 469 |
<xsl:element name="xsl:template"> |
| 470 |
<xsl:attribute name="match">*</xsl:attribute> |
| 471 |
<xsl:attribute name="mode"> |
| 472 |
<xsl:value-of select="@t:element"/> |
| 473 |
<xsl:text>.titlepage.verso.mode</xsl:text> |
| 474 |
</xsl:attribute> |
| 475 |
<xsl:text>
 </xsl:text> |
| 476 |
<xsl:comment> if an element isn't found in this mode, </xsl:comment> |
| 477 |
<xsl:text>
 </xsl:text> |
| 478 |
<xsl:comment> try the generic titlepage.mode </xsl:comment> |
| 479 |
<xsl:text>
 </xsl:text> |
| 480 |
<xsl:element name="xsl:apply-templates"> |
| 481 |
<xsl:attribute name="select">.</xsl:attribute> |
| 482 |
<xsl:attribute name="mode">titlepage.mode</xsl:attribute> |
| 483 |
</xsl:element> |
| 484 |
<xsl:text>
</xsl:text> |
| 485 |
</xsl:element> |
| 486 |
</xsl:if> |
| 487 |
|
| 488 |
<!-- output default templates for each of the elements listed in --> |
| 489 |
<!-- the titlepage-content. If a template is suppressed or forced --> |
| 490 |
<!-- to be off, or has already been output, don't output it. --> |
| 491 |
<xsl:for-each select="t:titlepage-content/*"> |
| 492 |
<xsl:variable name="thisnode" select="."/> |
| 493 |
<xsl:if test="(not(@t:suppress-template) or @t:suppress-template='0') |
| 494 |
and (not(@t:force) or @t:force='0') |
| 495 |
and (not(preceding-sibling::*[name(.)=name($thisnode)]))"> |
| 496 |
<xsl:text>

</xsl:text> |
| 497 |
<xsl:element name="xsl:template"> |
| 498 |
<xsl:attribute name="match"> |
| 499 |
<xsl:value-of select="$db.prefix"/> |
| 500 |
<xsl:value-of select="name(.)"/> |
| 501 |
</xsl:attribute> |
| 502 |
<xsl:attribute name="mode"> |
| 503 |
<xsl:value-of select="../../@t:element"/> |
| 504 |
<xsl:text>.titlepage.</xsl:text> |
| 505 |
<xsl:value-of select="../@t:side"/> |
| 506 |
<xsl:text>.auto.mode</xsl:text> |
| 507 |
</xsl:attribute> |
| 508 |
<xsl:text>
</xsl:text> |
| 509 |
<xsl:call-template name="output.wrapper"> |
| 510 |
<xsl:with-param name="attr.sets"> |
| 511 |
<xsl:value-of select="../../@t:element"/> |
| 512 |
<xsl:text>.titlepage.</xsl:text> |
| 513 |
<xsl:value-of select="../@t:side"/> |
| 514 |
<xsl:text>.style</xsl:text> |
| 515 |
</xsl:with-param> |
| 516 |
<xsl:with-param name="content"> |
| 517 |
<xsl:text>
</xsl:text> |
| 518 |
|
| 519 |
<xsl:choose> |
| 520 |
<xsl:when test="@t:named-template"> |
| 521 |
<xsl:element name="xsl:call-template"> |
| 522 |
<xsl:attribute name="name"> |
| 523 |
<xsl:value-of select="@t:named-template"/> |
| 524 |
</xsl:attribute> |
| 525 |
<xsl:for-each select="@*"> |
| 526 |
<xsl:if test="namespace-uri(.)='http://nwalsh.com/docbook/xsl/template/1.0/param'"> |
| 527 |
<xsl:text>
</xsl:text> |
| 528 |
<xsl:element name="xsl:with-param"> |
| 529 |
<xsl:attribute name="name"> |
| 530 |
<xsl:value-of select="local-name(.)"/> |
| 531 |
</xsl:attribute> |
| 532 |
<xsl:attribute name="select"> |
| 533 |
<xsl:call-template name="param.node"/> |
| 534 |
</xsl:attribute> |
| 535 |
</xsl:element> |
| 536 |
</xsl:if> |
| 537 |
</xsl:for-each> |
| 538 |
<xsl:text>
</xsl:text> |
| 539 |
</xsl:element> |
| 540 |
</xsl:when> |
| 541 |
<xsl:otherwise> |
| 542 |
<xsl:element name="xsl:apply-templates"> |
| 543 |
<xsl:attribute name="select">.</xsl:attribute> |
| 544 |
<xsl:attribute name="mode"> |
| 545 |
<xsl:value-of select="../../@t:element"/> |
| 546 |
<xsl:text>.titlepage.</xsl:text> |
| 547 |
<xsl:value-of select="../@t:side"/> |
| 548 |
<xsl:text>.mode</xsl:text> |
| 549 |
</xsl:attribute> |
| 550 |
</xsl:element> |
| 551 |
</xsl:otherwise> |
| 552 |
</xsl:choose> |
| 553 |
|
| 554 |
<xsl:text>
</xsl:text> |
| 555 |
</xsl:with-param> |
| 556 |
</xsl:call-template> |
| 557 |
<xsl:text>
</xsl:text> |
| 558 |
</xsl:element> |
| 559 |
</xsl:if> |
| 560 |
</xsl:for-each> |
| 561 |
</xsl:template> |
| 562 |
|
| 563 |
<!-- ==================================================================== --> |
| 564 |
|
| 565 |
<doc:template match="t:titlepage-content" id="titlepage-content"> |
| 566 |
<refpurpose>Create templates for the content of one side of a title page</refpurpose> |
| 567 |
|
| 568 |
<refdescription> |
| 569 |
<para>The title page content, that is, the elements from the source |
| 570 |
document that are rendered on the title page, can be controlled independently |
| 571 |
for the recto and verso sides of the title page.</para> |
| 572 |
|
| 573 |
<para>The <literal>t:titlepage-content</literal> element has two attributes: |
| 574 |
|
| 575 |
<variablelist> |
| 576 |
<varlistentry><term>side</term> |
| 577 |
<listitem><para>Identifies the side of the page to which this title |
| 578 |
page content applies. The |
| 579 |
<tag class="attribute">side</tag> attribute is required and |
| 580 |
must be set to either |
| 581 |
<quote><literal>recto</literal></quote> or |
| 582 |
<quote><literal>verso</literal></quote>. In addition, you must specify |
| 583 |
exactly one <literal>t:titlepage-content</literal> for each side |
| 584 |
within each <literal>t:titlepage</literal>.</para> |
| 585 |
</listitem> |
| 586 |
</varlistentry> |
| 587 |
<varlistentry><term>order</term> |
| 588 |
<listitem><para>Indicates how the order of the elements presented on |
| 589 |
the title page is determined. If the |
| 590 |
<tag class="attribute">order</tag> is |
| 591 |
<quote><literal>document</literal></quote>, the elements are presented |
| 592 |
in document order. Otherwise (if the |
| 593 |
<tag class="attribute">order</tag> is |
| 594 |
<quote><literal>stylesheet</literal></quote>), the elements are presented |
| 595 |
in the order that they appear in the template (and consequently in |
| 596 |
the stylesheet).</para> |
| 597 |
</listitem> |
| 598 |
</varlistentry> |
| 599 |
</variablelist> |
| 600 |
</para> |
| 601 |
|
| 602 |
<para>The content of a <literal>t:titlepage-content</literal> element is |
| 603 |
a list of element names. These names should be unqualified. They identify |
| 604 |
the elements in the source document that should appear on the title page. |
| 605 |
</para> |
| 606 |
|
| 607 |
<para>Each element may have a single attribute: |
| 608 |
<tag class="attribute">predicate</tag>. The value of this |
| 609 |
attribute is used as a predicate for the expression that matches |
| 610 |
the element on which it occurs.</para> |
| 611 |
|
| 612 |
<para>In other words, to put only the first three authors on the |
| 613 |
recto-side of a title |
| 614 |
page, you could specify: |
| 615 |
|
| 616 |
<screen><![CDATA[ |
| 617 |
<t:titlepage-contents side="recto"> |
| 618 |
<!-- other titlepage elements --> |
| 619 |
<author predicate="[count(previous-sibling::author)<2]"/> |
| 620 |
<!-- other titlepage elements --> |
| 621 |
</t:titlepage-contents> |
| 622 |
]]></screen> |
| 623 |
</para> |
| 624 |
|
| 625 |
<para>Usually, the elements so named are empty. But it is possible to |
| 626 |
make one level of selection within them. Suppose that you want to |
| 627 |
process <literal>authorgroup</literal> elements on the title page, but |
| 628 |
you want to select only proper authors, editors, or corporate authors, |
| 629 |
not collaborators or other credited authors.</para> |
| 630 |
|
| 631 |
<para>In that case, you can put a <literal>t:or</literal> group inside |
| 632 |
the <literal>authorgroup</literal> element: |
| 633 |
|
| 634 |
<screen><![CDATA[ |
| 635 |
<t:titlepage-contents side="recto"> |
| 636 |
<!-- other titlepage elements --> |
| 637 |
<authorgroup> |
| 638 |
<t:or> |
| 639 |
<author/> |
| 640 |
<editor/> |
| 641 |
<corpauthor/> |
| 642 |
</t:or> |
| 643 |
</authorgroup> |
| 644 |
<!-- other titlepage elements --> |
| 645 |
</t:titlepage-contents> |
| 646 |
]]></screen> |
| 647 |
</para> |
| 648 |
|
| 649 |
<para>This will have the effect of automatically generating a template |
| 650 |
for processing <literal>authorgroup</literal>s in the title page mode, |
| 651 |
selecting only the specified children. If you need more complex processing, |
| 652 |
you'll have to construct the templates by hand.</para> |
| 653 |
|
| 654 |
</refdescription> |
| 655 |
</doc:template> |
| 656 |
|
| 657 |
<xsl:template match="t:titlepage-content"> |
| 658 |
<xsl:variable name="side"> |
| 659 |
<xsl:choose> |
| 660 |
<xsl:when test="@t:side='recto' or @t:side='verso'"> |
| 661 |
<xsl:value-of select="@t:side"/> |
| 662 |
</xsl:when> |
| 663 |
<xsl:when test="@t:side"> |
| 664 |
<xsl:message terminate="yes"> |
| 665 |
<xsl:text>Illegal value specified for @t:side </xsl:text> |
| 666 |
<xsl:text>on t:titlepage-content: </xsl:text> |
| 667 |
<xsl:value-of select="@t:side"/> |
| 668 |
</xsl:message> |
| 669 |
</xsl:when> |
| 670 |
<xsl:otherwise> |
| 671 |
<xsl:message terminate="yes"> |
| 672 |
<xsl:text>The @t:side attribute is required on </xsl:text> |
| 673 |
<xsl:text>t:titlepage-content.</xsl:text> |
| 674 |
</xsl:message> |
| 675 |
</xsl:otherwise> |
| 676 |
</xsl:choose> |
| 677 |
</xsl:variable> |
| 678 |
|
| 679 |
<xsl:variable name="mode"> |
| 680 |
<xsl:value-of select="../@t:element"/> |
| 681 |
<xsl:text>.titlepage.</xsl:text> |
| 682 |
<xsl:value-of select="$side"/> |
| 683 |
<xsl:text>.auto.mode</xsl:text> |
| 684 |
</xsl:variable> |
| 685 |
|
| 686 |
<xsl:text>

</xsl:text> |
| 687 |
<xsl:element name="xsl:template"> |
| 688 |
<xsl:attribute name="name"> |
| 689 |
<xsl:value-of select="../@t:element"/> |
| 690 |
<xsl:text>.titlepage.</xsl:text> |
| 691 |
<xsl:value-of select="$side"/> |
| 692 |
</xsl:attribute> |
| 693 |
|
| 694 |
<xsl:choose> |
| 695 |
<!-- if document order is selected, make a huge select statement |
| 696 |
on a single xsl:apply-templates to pick out the right elements |
| 697 |
for the title page. --> |
| 698 |
<xsl:when test="@t:order='document'"> |
| 699 |
<xsl:if test="count(child::*)>0"> |
| 700 |
<xsl:element name="xsl:apply-templates"> |
| 701 |
<xsl:attribute name="mode"> |
| 702 |
<xsl:value-of select="$mode"/> |
| 703 |
</xsl:attribute> |
| 704 |
<xsl:attribute name="select"> |
| 705 |
<xsl:apply-templates mode="document.order"/> |
| 706 |
</xsl:attribute> |
| 707 |
</xsl:element> |
| 708 |
</xsl:if> |
| 709 |
</xsl:when> |
| 710 |
|
| 711 |
<!-- otherwise, select each of the elements in the specified order --> |
| 712 |
<xsl:otherwise> |
| 713 |
<xsl:apply-templates mode="stylesheet.order"/> |
| 714 |
</xsl:otherwise> |
| 715 |
</xsl:choose> |
| 716 |
<xsl:text>
</xsl:text> |
| 717 |
</xsl:element> |
| 718 |
<xsl:apply-templates mode="titlepage.specialrules"/> |
| 719 |
</xsl:template> |
| 720 |
|
| 721 |
<!-- ==================================================================== --> |
| 722 |
|
| 723 |
<doc:template match="t:titlepage-separator" id="titlepage-separator"> |
| 724 |
<refpurpose>Create templates for the separator</refpurpose> |
| 725 |
|
| 726 |
<refdescription> |
| 727 |
<para>The title page is separated from the content which follows it by |
| 728 |
the markup specified in the <literal>t:titlepage-separator</literal> |
| 729 |
element.</para> |
| 730 |
</refdescription> |
| 731 |
</doc:template> |
| 732 |
|
| 733 |
<xsl:template match="t:titlepage-separator"> |
| 734 |
<xsl:text>

</xsl:text> |
| 735 |
<xsl:element name="xsl:template"> |
| 736 |
<xsl:attribute name="name"> |
| 737 |
<xsl:value-of select="../@t:element"/> |
| 738 |
<xsl:text>.titlepage.separator</xsl:text> |
| 739 |
</xsl:attribute> |
| 740 |
|
| 741 |
<xsl:apply-templates mode="copy"/> |
| 742 |
<xsl:text>
</xsl:text> |
| 743 |
</xsl:element> |
| 744 |
</xsl:template> |
| 745 |
|
| 746 |
<!-- ==================================================================== --> |
| 747 |
|
| 748 |
<doc:template match="t:titlepage-before" id="titlepage-before"> |
| 749 |
<refpurpose>Create templates for what precedes a title page</refpurpose> |
| 750 |
|
| 751 |
<refdescription> |
| 752 |
<para>Each side of the title page is preceded by the markup specified |
| 753 |
in the <literal>t:titlepage-before</literal> element for that |
| 754 |
side.</para> |
| 755 |
</refdescription> |
| 756 |
</doc:template> |
| 757 |
|
| 758 |
<xsl:template match="t:titlepage-before"> |
| 759 |
<xsl:text>

</xsl:text> |
| 760 |
<xsl:element name="xsl:template"> |
| 761 |
<xsl:attribute name="name"> |
| 762 |
<xsl:value-of select="../@t:element"/> |
| 763 |
<xsl:text>.titlepage.before.</xsl:text> |
| 764 |
<xsl:value-of select="@t:side"/> |
| 765 |
</xsl:attribute> |
| 766 |
|
| 767 |
<xsl:apply-templates mode="copy"/> |
| 768 |
<xsl:text>
</xsl:text> |
| 769 |
</xsl:element> |
| 770 |
</xsl:template> |
| 771 |
|
| 772 |
<!-- ==================================================================== --> |
| 773 |
|
| 774 |
<doc:template match="*" mode="copy" xmlns="" id="star_in_copy"> |
| 775 |
<refpurpose>Copy elements</refpurpose> |
| 776 |
|
| 777 |
<refdescription> |
| 778 |
<para>This template simply copies the elements that it applies to |
| 779 |
straight through into the result tree.</para> |
| 780 |
</refdescription> |
| 781 |
</doc:template> |
| 782 |
|
| 783 |
<xsl:template match="*" mode="copy"> |
| 784 |
<xsl:choose> |
| 785 |
<xsl:when test="(name(.) = local-name(.)) and namespace-uri(.) != ''"> |
| 786 |
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}"> |
| 787 |
<xsl:apply-templates select="@*" mode="copy"/> |
| 788 |
<xsl:apply-templates mode="copy"/> |
| 789 |
</xsl:element> |
| 790 |
</xsl:when> |
| 791 |
<xsl:otherwise> |
| 792 |
<xsl:element name="{name(.)}"> |
| 793 |
<xsl:apply-templates select="@*" mode="copy"/> |
| 794 |
<xsl:apply-templates mode="copy"/> |
| 795 |
</xsl:element> |
| 796 |
</xsl:otherwise> |
| 797 |
</xsl:choose> |
| 798 |
</xsl:template> |
| 799 |
|
| 800 |
<!-- ==================================================================== --> |
| 801 |
|
| 802 |
<doc:template match="@*" mode="copy" xmlns="" id="attr_star_in_copy"> |
| 803 |
<refpurpose>Copy attributes</refpurpose> |
| 804 |
|
| 805 |
<refdescription> |
| 806 |
<para>This template simply copies the attributes that it applies to |
| 807 |
straight through into the result tree.</para> |
| 808 |
</refdescription> |
| 809 |
</doc:template> |
| 810 |
|
| 811 |
<xsl:template match="@*" mode="copy"> |
| 812 |
<xsl:choose> |
| 813 |
<xsl:when test="(name(.) = local-name(.)) and namespace-uri(.) != ''"> |
| 814 |
<xsl:attribute name="{name(.)}" namespace="{namespace-uri(.)}"> |
| 815 |
<xsl:value-of select="."/> |
| 816 |
</xsl:attribute> |
| 817 |
</xsl:when> |
| 818 |
<xsl:otherwise> |
| 819 |
<xsl:attribute name="{name(.)}"> |
| 820 |
<xsl:value-of select="."/> |
| 821 |
</xsl:attribute> |
| 822 |
</xsl:otherwise> |
| 823 |
</xsl:choose> |
| 824 |
</xsl:template> |
| 825 |
|
| 826 |
<!-- ==================================================================== --> |
| 827 |
|
| 828 |
<doc:template match="*" mode="document.order" xmlns="" id="attr_star_in_document.order"> |
| 829 |
<refpurpose>Create rules to process titlepage elements in document order</refpurpose> |
| 830 |
|
| 831 |
<refdescription> |
| 832 |
<para>This template is called to process all of the children of the |
| 833 |
<literal>t:titlepage-content</literal> element. It creates the hairy |
| 834 |
select expression necessary to process each of those elements in |
| 835 |
the title page.</para> |
| 836 |
|
| 837 |
<para>Note that this template automatically handles the case where |
| 838 |
some DocBook elements, like title and subtitle, can occur both inside |
| 839 |
the *info elements where metadata is usually stored and outside. |
| 840 |
</para> |
| 841 |
|
| 842 |
<para>It also automatically calculates the name for the *info container |
| 843 |
and handles elements that have historically had containers with different |
| 844 |
names.</para> |
| 845 |
|
| 846 |
</refdescription> |
| 847 |
</doc:template> |
| 848 |
|
| 849 |
<xsl:template match="*" mode="document.order"> |
| 850 |
<xsl:variable name="docinfo"> |
| 851 |
<xsl:value-of select="ancestor::t:titlepage/@t:element"/> |
| 852 |
<xsl:text>info</xsl:text> |
| 853 |
</xsl:variable> |
| 854 |
|
| 855 |
<xsl:variable name="altinfo"> |
| 856 |
<xsl:choose> |
| 857 |
<xsl:when test="ancestor::t:titlepage/@t:element='article'"> |
| 858 |
<xsl:text>artheader</xsl:text> |
| 859 |
</xsl:when> |
| 860 |
<xsl:when test="ancestor::t:titlepage/@t:element='qandaset'"> |
| 861 |
<xsl:text>blockinfo</xsl:text> |
| 862 |
</xsl:when> |
| 863 |
<xsl:when test="ancestor::t:titlepage/@t:element='section'"></xsl:when> |
| 864 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect1'"></xsl:when> |
| 865 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect2'"></xsl:when> |
| 866 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect3'"></xsl:when> |
| 867 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect4'"></xsl:when> |
| 868 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect5'"></xsl:when> |
| 869 |
<xsl:when test="ancestor::t:titlepage/@t:element='book'"></xsl:when> |
| 870 |
<xsl:when test="ancestor::t:titlepage/@t:element='set'"></xsl:when> |
| 871 |
<xsl:when test="ancestor::t:titlepage/@t:element='topic'"></xsl:when> |
| 872 |
<xsl:otherwise>docinfo</xsl:otherwise> |
| 873 |
</xsl:choose> |
| 874 |
</xsl:variable> |
| 875 |
|
| 876 |
<xsl:variable name="side"> |
| 877 |
<xsl:choose> |
| 878 |
<xsl:when test="ancestor::t:titlepage-content/@t:side"> |
| 879 |
<xsl:value-of select="ancestor::t:titlepage-content/@t:side"/> |
| 880 |
</xsl:when> |
| 881 |
<xsl:otherwise> |
| 882 |
<xsl:text>recto</xsl:text> |
| 883 |
</xsl:otherwise> |
| 884 |
</xsl:choose> |
| 885 |
</xsl:variable> |
| 886 |
|
| 887 |
<xsl:variable name="mode"> |
| 888 |
<xsl:value-of select="ancestor::t:titlepage/@t:element"/> |
| 889 |
<xsl:text>.titlepage.</xsl:text> |
| 890 |
<xsl:value-of select="$side"/> |
| 891 |
<xsl:text>.auto.mode</xsl:text> |
| 892 |
</xsl:variable> |
| 893 |
|
| 894 |
<xsl:if test="preceding-sibling::*"> |
| 895 |
<xsl:text>|</xsl:text> |
| 896 |
</xsl:if> |
| 897 |
|
| 898 |
<xsl:value-of select="$db.prefix"/> |
| 899 |
<xsl:value-of select="$docinfo"/> |
| 900 |
<xsl:text>/</xsl:text> |
| 901 |
<xsl:value-of select="$db.prefix"/> |
| 902 |
<xsl:value-of select="name(.)"/> |
| 903 |
<xsl:if test="@t:predicate"> |
| 904 |
<xsl:value-of select="@t:predicate"/> |
| 905 |
</xsl:if> |
| 906 |
|
| 907 |
<xsl:if test="$altinfo != ''"> |
| 908 |
<xsl:text>|</xsl:text> |
| 909 |
<xsl:value-of select="$db.prefix"/> |
| 910 |
<xsl:value-of select="$altinfo"/> |
| 911 |
<xsl:text>/</xsl:text> |
| 912 |
<xsl:value-of select="$db.prefix"/> |
| 913 |
<xsl:value-of select="name(.)"/> |
| 914 |
<xsl:if test="@t:predicate"> |
| 915 |
<xsl:value-of select="@t:predicate"/> |
| 916 |
</xsl:if> |
| 917 |
</xsl:if> |
| 918 |
|
| 919 |
<!-- info --> |
| 920 |
<xsl:text>|</xsl:text> |
| 921 |
<xsl:value-of select="$db.prefix"/> |
| 922 |
<xsl:text>info</xsl:text> |
| 923 |
<xsl:text>/</xsl:text> |
| 924 |
<xsl:value-of select="$db.prefix"/> |
| 925 |
<xsl:value-of select="name(.)"/> |
| 926 |
<xsl:if test="@t:predicate"> |
| 927 |
<xsl:value-of select="@t:predicate"/> |
| 928 |
</xsl:if> |
| 929 |
|
| 930 |
<xsl:if test="local-name(.) = 'title' |
| 931 |
or local-name(.) = 'subtitle' |
| 932 |
or local-name(.) = 'titleabbrev'"> |
| 933 |
<xsl:text>|</xsl:text> |
| 934 |
<xsl:value-of select="$db.prefix"/> |
| 935 |
<xsl:value-of select="name(.)"/> |
| 936 |
<xsl:if test="@t:predicate"> |
| 937 |
<xsl:value-of select="@t:predicate"/> |
| 938 |
</xsl:if> |
| 939 |
</xsl:if> |
| 940 |
</xsl:template> |
| 941 |
|
| 942 |
<!-- ==================================================================== --> |
| 943 |
|
| 944 |
<doc:template match="*" mode="document.order" xmlns="" id="star_in_document.order"> |
| 945 |
<refpurpose>Create rules to process titlepage elements in stylesheet order</refpurpose> |
| 946 |
|
| 947 |
<refdescription> |
| 948 |
<para>This template is called to process all of the children of the |
| 949 |
<literal>t:titlepage-content</literal> element. It creates the set |
| 950 |
of <literal>xsl:apply-templates</literal> elements necessary |
| 951 |
process each of those elements in the title page.</para> |
| 952 |
|
| 953 |
<para>Note that this template automatically handles the case where |
| 954 |
some DocBook elements, like title and subtitle, can occur both inside |
| 955 |
the *info elements where metadata is usually stored and outside. |
| 956 |
</para> |
| 957 |
|
| 958 |
<para>It also automatically calculates the name for the *info container |
| 959 |
and handles elements that have historically had containers with different |
| 960 |
names.</para> |
| 961 |
|
| 962 |
</refdescription> |
| 963 |
</doc:template> |
| 964 |
|
| 965 |
<xsl:template match="*" mode="stylesheet.order"> |
| 966 |
<xsl:variable name="docinfo"> |
| 967 |
<xsl:value-of select="ancestor::t:titlepage/@t:element"/> |
| 968 |
<xsl:text>info</xsl:text> |
| 969 |
</xsl:variable> |
| 970 |
|
| 971 |
<xsl:variable name="altinfo"> |
| 972 |
<xsl:choose> |
| 973 |
<xsl:when test="ancestor::t:titlepage/@t:element='article'"> |
| 974 |
<xsl:text>artheader</xsl:text> |
| 975 |
</xsl:when> |
| 976 |
<xsl:when test="ancestor::t:titlepage/@t:element='qandaset'"> |
| 977 |
<xsl:text>blockinfo</xsl:text> |
| 978 |
</xsl:when> |
| 979 |
<xsl:when test="ancestor::t:titlepage/@t:element='section'"></xsl:when> |
| 980 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect1'"></xsl:when> |
| 981 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect2'"></xsl:when> |
| 982 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect3'"></xsl:when> |
| 983 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect4'"></xsl:when> |
| 984 |
<xsl:when test="ancestor::t:titlepage/@t:element='sect5'"></xsl:when> |
| 985 |
<xsl:when test="ancestor::t:titlepage/@t:element='book'"></xsl:when> |
| 986 |
<xsl:when test="ancestor::t:titlepage/@t:element='set'"></xsl:when> |
| 987 |
<xsl:when test="ancestor::t:titlepage/@t:element='topic'"></xsl:when> |
| 988 |
<xsl:otherwise>docinfo</xsl:otherwise> |
| 989 |
</xsl:choose> |
| 990 |
</xsl:variable> |
| 991 |
|
| 992 |
<xsl:variable name="side"> |
| 993 |
<xsl:choose> |
| 994 |
<xsl:when test="ancestor::t:titlepage-content/@t:side"> |
| 995 |
<xsl:value-of select="ancestor::t:titlepage-content/@t:side"/> |
| 996 |
</xsl:when> |
| 997 |
<xsl:otherwise>recto</xsl:otherwise> |
| 998 |
</xsl:choose> |
| 999 |
</xsl:variable> |
| 1000 |
|
| 1001 |
<xsl:variable name="mode"> |
| 1002 |
<xsl:value-of select="ancestor::t:titlepage/@t:element"/> |
| 1003 |
<xsl:text>.titlepage.</xsl:text> |
| 1004 |
<xsl:value-of select="$side"/> |
| 1005 |
<xsl:text>.auto.mode</xsl:text> |
| 1006 |
</xsl:variable> |
| 1007 |
|
| 1008 |
<xsl:text>
 </xsl:text> |
| 1009 |
|
| 1010 |
<xsl:choose> |
| 1011 |
<xsl:when test="@t:force and @t:force != '0'"> |
| 1012 |
<xsl:choose> |
| 1013 |
<xsl:when test="@t:named-template"> |
| 1014 |
<xsl:call-template name="output.wrapper"> |
| 1015 |
<xsl:with-param name="attr.sets"> |
| 1016 |
<xsl:value-of select="../../@t:element"/> |
| 1017 |
<xsl:text>.titlepage.</xsl:text> |
| 1018 |
<xsl:value-of select="../@t:side"/> |
| 1019 |
<xsl:text>.style</xsl:text> |
| 1020 |
</xsl:with-param> |
| 1021 |
<xsl:with-param name="content"> |
| 1022 |
<xsl:text>
</xsl:text> |
| 1023 |
<xsl:element name="xsl:call-template"> |
| 1024 |
<xsl:attribute name="name"> |
| 1025 |
<xsl:value-of select="@t:named-template"/> |
| 1026 |
</xsl:attribute> |
| 1027 |
<xsl:for-each select="@*"> |
| 1028 |
<xsl:if test="namespace-uri(.)='http://nwalsh.com/docbook/xsl/template/1.0/param'"> |
| 1029 |
<xsl:text>
</xsl:text> |
| 1030 |
<xsl:element name="xsl:with-param"> |
| 1031 |
<xsl:attribute name="name"> |
| 1032 |
<xsl:value-of select="local-name(.)"/> |
| 1033 |
</xsl:attribute> |
| 1034 |
<xsl:attribute name="select"> |
| 1035 |
<xsl:call-template name="param.node"/> |
| 1036 |
</xsl:attribute> |
| 1037 |
</xsl:element> |
| 1038 |
</xsl:if> |
| 1039 |
</xsl:for-each> |
| 1040 |
<xsl:text>
</xsl:text> |
| 1041 |
</xsl:element> |
| 1042 |
</xsl:with-param> |
| 1043 |
</xsl:call-template> |
| 1044 |
</xsl:when> |
| 1045 |
<xsl:otherwise> |
| 1046 |
<xsl:message terminate="yes"> |
| 1047 |
<xsl:text>Force can only be used with named-templates.</xsl:text> |
| 1048 |
</xsl:message> |
| 1049 |
</xsl:otherwise> |
| 1050 |
</xsl:choose> |
| 1051 |
</xsl:when> |
| 1052 |
<xsl:otherwise> |
| 1053 |
|
| 1054 |
<xsl:choose> |
| 1055 |
<xsl:when test="local-name(.) = 'title' |
| 1056 |
or local-name(.) = 'subtitle' |
| 1057 |
or local-name(.) = 'titleabbrev'"> |
| 1058 |
<!-- the title, subtitle, and titleabbrev elements are special --> |
| 1059 |
<xsl:element name="xsl:choose"> |
| 1060 |
<xsl:text>
 </xsl:text> |
| 1061 |
<xsl:element name="xsl:when"> |
| 1062 |
<xsl:attribute name="test"> |
| 1063 |
<xsl:value-of select="$db.prefix"/> |
| 1064 |
<xsl:value-of select="$docinfo"/> |
| 1065 |
<xsl:text>/</xsl:text> |
| 1066 |
<xsl:value-of select="$db.prefix"/> |
| 1067 |
<xsl:value-of select="name(.)"/> |
| 1068 |
</xsl:attribute> |
| 1069 |
<xsl:text>
 </xsl:text> |
| 1070 |
<xsl:element name="xsl:apply-templates"> |
| 1071 |
<xsl:attribute name="mode"> |
| 1072 |
<xsl:value-of select="$mode"/> |
| 1073 |
</xsl:attribute> |
| 1074 |
<xsl:attribute name="select"> |
| 1075 |
<xsl:value-of select="$db.prefix"/> |
| 1076 |
<xsl:value-of select="$docinfo"/> |
| 1077 |
<xsl:text>/</xsl:text> |
| 1078 |
<xsl:value-of select="$db.prefix"/> |
| 1079 |
<xsl:value-of select="name(.)"/> |
| 1080 |
<xsl:if test="@t:predicate"> |
| 1081 |
<xsl:value-of select="@t:predicate"/> |
| 1082 |
</xsl:if> |
| 1083 |
</xsl:attribute> |
| 1084 |
</xsl:element> |
| 1085 |
<xsl:text>
 </xsl:text> |
| 1086 |
</xsl:element> |
| 1087 |
|
| 1088 |
<xsl:if test="$altinfo != ''"> |
| 1089 |
<xsl:text>
 </xsl:text> |
| 1090 |
<xsl:element name="xsl:when"> |
| 1091 |
<xsl:attribute name="test"> |
| 1092 |
<xsl:value-of select="$db.prefix"/> |
| 1093 |
<xsl:value-of select="$altinfo"/> |
| 1094 |
<xsl:text>/</xsl:text> |
| 1095 |
<xsl:value-of select="$db.prefix"/> |
| 1096 |
<xsl:value-of select="name(.)"/> |
| 1097 |
</xsl:attribute> |
| 1098 |
<xsl:text>
 </xsl:text> |
| 1099 |
<xsl:element name="xsl:apply-templates"> |
| 1100 |
<xsl:attribute name="mode"> |
| 1101 |
<xsl:value-of select="$mode"/> |
| 1102 |
</xsl:attribute> |
| 1103 |
<xsl:attribute name="select"> |
| 1104 |
<xsl:value-of select="$db.prefix"/> |
| 1105 |
<xsl:value-of select="$altinfo"/> |
| 1106 |
<xsl:text>/</xsl:text> |
| 1107 |
<xsl:value-of select="$db.prefix"/> |
| 1108 |
<xsl:value-of select="name(.)"/> |
| 1109 |
<xsl:if test="@t:predicate"> |
| 1110 |
<xsl:value-of select="@t:predicate"/> |
| 1111 |
</xsl:if> |
| 1112 |
</xsl:attribute> |
| 1113 |
</xsl:element> |
| 1114 |
<xsl:text>
 </xsl:text> |
| 1115 |
</xsl:element> |
| 1116 |
</xsl:if> |
| 1117 |
|
| 1118 |
<!-- info --> |
| 1119 |
<xsl:text>
 </xsl:text> |
| 1120 |
<xsl:element name="xsl:when"> |
| 1121 |
<xsl:attribute name="test"> |
| 1122 |
<xsl:value-of select="$db.prefix"/> |
| 1123 |
<xsl:value-of select="'info'"/> |
| 1124 |
<xsl:text>/</xsl:text> |
| 1125 |
<xsl:value-of select="$db.prefix"/> |
| 1126 |
<xsl:value-of select="name(.)"/> |
| 1127 |
</xsl:attribute> |
| 1128 |
<xsl:text>
 </xsl:text> |
| 1129 |
<xsl:element name="xsl:apply-templates"> |
| 1130 |
<xsl:attribute name="mode"> |
| 1131 |
<xsl:value-of select="$mode"/> |
| 1132 |
</xsl:attribute> |
| 1133 |
<xsl:attribute name="select"> |
| 1134 |
<xsl:value-of select="$db.prefix"/> |
| 1135 |
<xsl:value-of select="'info'"/> |
| 1136 |
<xsl:text>/</xsl:text> |
| 1137 |
<xsl:value-of select="$db.prefix"/> |
| 1138 |
<xsl:value-of select="name(.)"/> |
| 1139 |
<xsl:if test="@t:predicate"> |
| 1140 |
<xsl:value-of select="@t:predicate"/> |
| 1141 |
</xsl:if> |
| 1142 |
</xsl:attribute> |
| 1143 |
</xsl:element> |
| 1144 |
<xsl:text>
 </xsl:text> |
| 1145 |
</xsl:element> |
| 1146 |
|
| 1147 |
<xsl:text>
 </xsl:text> |
| 1148 |
<xsl:element name="xsl:when"> |
| 1149 |
<xsl:attribute name="test"> |
| 1150 |
<xsl:value-of select="$db.prefix"/> |
| 1151 |
<xsl:value-of select="name(.)"/> |
| 1152 |
</xsl:attribute> |
| 1153 |
<xsl:text>
 </xsl:text> |
| 1154 |
<xsl:element name="xsl:apply-templates"> |
| 1155 |
<xsl:attribute name="mode"> |
| 1156 |
<xsl:value-of select="$mode"/> |
| 1157 |
</xsl:attribute> |
| 1158 |
<xsl:attribute name="select"> |
| 1159 |
<xsl:value-of select="$db.prefix"/> |
| 1160 |
<xsl:value-of select="name(.)"/> |
| 1161 |
<xsl:if test="@t:predicate"> |
| 1162 |
<xsl:value-of select="@t:predicate"/> |
| 1163 |
</xsl:if> |
| 1164 |
</xsl:attribute> |
| 1165 |
</xsl:element> |
| 1166 |
<xsl:text>
 </xsl:text> |
| 1167 |
</xsl:element> |
| 1168 |
<xsl:text>
 </xsl:text> |
| 1169 |
</xsl:element> |
| 1170 |
<xsl:text>
</xsl:text> |
| 1171 |
</xsl:when> |
| 1172 |
<xsl:otherwise> |
| 1173 |
|
| 1174 |
<!-- first take care of the $docinfo version --> |
| 1175 |
<xsl:element name="xsl:apply-templates"> |
| 1176 |
<xsl:attribute name="mode"> |
| 1177 |
<xsl:value-of select="$mode"/> |
| 1178 |
</xsl:attribute> |
| 1179 |
<xsl:attribute name="select"> |
| 1180 |
<xsl:value-of select="$db.prefix"/> |
| 1181 |
<xsl:value-of select="$docinfo"/> |
| 1182 |
<xsl:text>/</xsl:text> |
| 1183 |
<xsl:value-of select="$db.prefix"/> |
| 1184 |
<xsl:value-of select="name(.)"/> |
| 1185 |
<xsl:if test="@t:predicate"> |
| 1186 |
<xsl:value-of select="@t:predicate"/> |
| 1187 |
</xsl:if> |
| 1188 |
</xsl:attribute> |
| 1189 |
</xsl:element> |
| 1190 |
|
| 1191 |
<!-- then take care of the $altinfo version --> |
| 1192 |
<xsl:if test="$altinfo != ''"> |
| 1193 |
<xsl:text>
 </xsl:text> |
| 1194 |
<xsl:element name="xsl:apply-templates"> |
| 1195 |
<xsl:attribute name="mode"> |
| 1196 |
<xsl:value-of select="$mode"/> |
| 1197 |
</xsl:attribute> |
| 1198 |
<xsl:attribute name="select"> |
| 1199 |
<xsl:value-of select="$db.prefix"/> |
| 1200 |
<xsl:value-of select="$altinfo"/> |
| 1201 |
<xsl:text>/</xsl:text> |
| 1202 |
<xsl:value-of select="$db.prefix"/> |
| 1203 |
<xsl:value-of select="name(.)"/> |
| 1204 |
<xsl:if test="@t:predicate"> |
| 1205 |
<xsl:value-of select="@t:predicate"/> |
| 1206 |
</xsl:if> |
| 1207 |
</xsl:attribute> |
| 1208 |
</xsl:element> |
| 1209 |
</xsl:if> |
| 1210 |
|
| 1211 |
<!-- info --> |
| 1212 |
<xsl:text>
 </xsl:text> |
| 1213 |
<xsl:element name="xsl:apply-templates"> |
| 1214 |
<xsl:attribute name="mode"> |
| 1215 |
<xsl:value-of select="$mode"/> |
| 1216 |
</xsl:attribute> |
| 1217 |
<xsl:attribute name="select"> |
| 1218 |
<xsl:value-of select="$db.prefix"/> |
| 1219 |
<xsl:value-of select="'info'"/> |
| 1220 |
<xsl:text>/</xsl:text> |
| 1221 |
<xsl:value-of select="$db.prefix"/> |
| 1222 |
<xsl:value-of select="name(.)"/> |
| 1223 |
<xsl:if test="@t:predicate"> |
| 1224 |
<xsl:value-of select="@t:predicate"/> |
| 1225 |
</xsl:if> |
| 1226 |
</xsl:attribute> |
| 1227 |
</xsl:element> |
| 1228 |
</xsl:otherwise> |
| 1229 |
</xsl:choose> |
| 1230 |
</xsl:otherwise> |
| 1231 |
</xsl:choose> |
| 1232 |
</xsl:template> |
| 1233 |
|
| 1234 |
<!-- ==================================================================== --> |
| 1235 |
|
| 1236 |
<doc:template match="*" mode="titlepage.specialrules" xmlns="" |
| 1237 |
id="star_in_titlepage.specialrules"> |
| 1238 |
<refpurpose>Create templates for special rules</refpurpose> |
| 1239 |
|
| 1240 |
<refdescription> |
| 1241 |
<para>This template is called to process all of the descendants of the |
| 1242 |
<literal>t:titlepage-content</literal> element that require special |
| 1243 |
processing. At present, that's just <literal>t:or</literal> elements. |
| 1244 |
</para> |
| 1245 |
</refdescription> |
| 1246 |
</doc:template> |
| 1247 |
|
| 1248 |
<xsl:template match="*" mode="titlepage.specialrules"> |
| 1249 |
<xsl:variable name="side"> |
| 1250 |
<xsl:choose> |
| 1251 |
<xsl:when test="ancestor::t:titlepage-content/@t:side"> |
| 1252 |
<xsl:value-of select="ancestor::t:titlepage-content/@t:side"/> |
| 1253 |
</xsl:when> |
| 1254 |
<xsl:otherwise>recto</xsl:otherwise> |
| 1255 |
</xsl:choose> |
| 1256 |
</xsl:variable> |
| 1257 |
|
| 1258 |
<xsl:variable name="mode"> |
| 1259 |
<xsl:value-of select="ancestor::t:titlepage/@t:element"/> |
| 1260 |
<xsl:text>.titlepage.</xsl:text> |
| 1261 |
<xsl:value-of select="$side"/> |
| 1262 |
<xsl:text>.auto.mode</xsl:text> |
| 1263 |
</xsl:variable> |
| 1264 |
|
| 1265 |
<xsl:choose> |
| 1266 |
<xsl:when test="name(.)='t:or'"> |
| 1267 |
<xsl:apply-templates select="*" mode="titlepage.specialrules"/> |
| 1268 |
</xsl:when> |
| 1269 |
<xsl:otherwise> |
| 1270 |
<xsl:if test="*"><!-- does this element have children? --> |
| 1271 |
<xsl:text>

</xsl:text> |
| 1272 |
<xsl:element name="xsl:template"> |
| 1273 |
<xsl:attribute name="match"> |
| 1274 |
<xsl:value-of select="name(.)"/> |
| 1275 |
</xsl:attribute> |
| 1276 |
<xsl:attribute name="mode"> |
| 1277 |
<xsl:value-of select="$mode"/> |
| 1278 |
</xsl:attribute> |
| 1279 |
<xsl:apply-templates select="*" mode="titlepage.subrules"/> |
| 1280 |
<xsl:text>
</xsl:text> |
| 1281 |
</xsl:element> |
| 1282 |
</xsl:if> |
| 1283 |
</xsl:otherwise> |
| 1284 |
</xsl:choose> |
| 1285 |
</xsl:template> |
| 1286 |
|
| 1287 |
<!-- ==================================================================== --> |
| 1288 |
|
| 1289 |
<doc:template match="*" mode="titlepage.subrules" xmlns="" |
| 1290 |
id="star_in_titlepage.subrules"> |
| 1291 |
<refpurpose>Create template for individual special rules</refpurpose> |
| 1292 |
|
| 1293 |
<refdescription> |
| 1294 |
<para>This template is called to process the children of special |
| 1295 |
template elements. |
| 1296 |
</para> |
| 1297 |
</refdescription> |
| 1298 |
</doc:template> |
| 1299 |
|
| 1300 |
<xsl:template match="*" mode="titlepage.subrules"> |
| 1301 |
<xsl:variable name="side"> |
| 1302 |
<xsl:choose> |
| 1303 |
<xsl:when test="ancestor::t:titlepage-content/@t:side"> |
| 1304 |
<xsl:value-of select="ancestor::t:titlepage-content/@t:side"/> |
| 1305 |
</xsl:when> |
| 1306 |
<xsl:otherwise>recto</xsl:otherwise> |
| 1307 |
</xsl:choose> |
| 1308 |
</xsl:variable> |
| 1309 |
|
| 1310 |
<xsl:variable name="mode"> |
| 1311 |
<xsl:value-of select="ancestor::t:titlepage/@t:element"/> |
| 1312 |
<xsl:text>.titlepage.</xsl:text> |
| 1313 |
<xsl:value-of select="$side"/> |
| 1314 |
<xsl:text>.auto.mode</xsl:text> |
| 1315 |
</xsl:variable> |
| 1316 |
|
| 1317 |
<xsl:element name="xsl:apply-templates"> |
| 1318 |
<xsl:attribute name="select"> |
| 1319 |
<xsl:value-of select="name(.)"/> |
| 1320 |
</xsl:attribute> |
| 1321 |
<xsl:attribute name="mode"> |
| 1322 |
<xsl:value-of select="$mode"/> |
| 1323 |
</xsl:attribute> |
| 1324 |
</xsl:element> |
| 1325 |
</xsl:template> |
| 1326 |
|
| 1327 |
<!-- ==================================================================== --> |
| 1328 |
|
| 1329 |
<doc:template match="t:or" xmlns="" id="or"> |
| 1330 |
<refpurpose>Process the t:or special rule</refpurpose> |
| 1331 |
|
| 1332 |
<refdescription> |
| 1333 |
<para>This template processes t:or.</para> |
| 1334 |
</refdescription> |
| 1335 |
</doc:template> |
| 1336 |
|
| 1337 |
<xsl:template match="t:or"> |
| 1338 |
<xsl:variable name="side"> |
| 1339 |
<xsl:choose> |
| 1340 |
<xsl:when test="ancestor::t:titlepage-content/@t:side"> |
| 1341 |
<xsl:value-of select="ancestor::t:titlepage-content/@t:side"/> |
| 1342 |
</xsl:when> |
| 1343 |
<xsl:otherwise>recto</xsl:otherwise> |
| 1344 |
</xsl:choose> |
| 1345 |
</xsl:variable> |
| 1346 |
|
| 1347 |
<xsl:variable name="mode"> |
| 1348 |
<xsl:value-of select="ancestor::t:titlepage/@t:element"/> |
| 1349 |
<xsl:text>.titlepage.</xsl:text> |
| 1350 |
<xsl:value-of select="$side"/> |
| 1351 |
<xsl:text>.auto.mode</xsl:text> |
| 1352 |
</xsl:variable> |
| 1353 |
|
| 1354 |
<xsl:text>
 </xsl:text> |
| 1355 |
<xsl:element name="xsl:apply-templates"> |
| 1356 |
<xsl:attribute name="select"> |
| 1357 |
<xsl:call-template name="element-or-list"/> |
| 1358 |
</xsl:attribute> |
| 1359 |
<xsl:attribute name="mode"> |
| 1360 |
<xsl:value-of select="$mode"/> |
| 1361 |
</xsl:attribute> |
| 1362 |
</xsl:element> |
| 1363 |
</xsl:template> |
| 1364 |
|
| 1365 |
<!-- ==================================================================== --> |
| 1366 |
|
| 1367 |
<doc:template match="t:or" mode="titlepage.subrules" xmlns="" |
| 1368 |
id="or_in_titlepage.subrules"> |
| 1369 |
<refpurpose>Process the t:or special rule in |
| 1370 |
titlepage.subrules mode</refpurpose> |
| 1371 |
|
| 1372 |
<refdescription> |
| 1373 |
<para>The titlepage.subrules mode doesn't apply to t:or, so just |
| 1374 |
reprocess this node in the normal mode.</para> |
| 1375 |
</refdescription> |
| 1376 |
</doc:template> |
| 1377 |
|
| 1378 |
<xsl:template match="t:or" mode="titlepage.subrules"> |
| 1379 |
<xsl:apply-templates select="."/><!-- use normal mode --> |
| 1380 |
</xsl:template> |
| 1381 |
|
| 1382 |
<!-- ==================================================================== --> |
| 1383 |
|
| 1384 |
<doc:template name="element-or-list" xmlns=""> |
| 1385 |
<refpurpose>Construct the "or-list" used in the select attribute for |
| 1386 |
special rules.</refpurpose> |
| 1387 |
|
| 1388 |
<refdescription> |
| 1389 |
<para>Walk through each of the children of t:or, producing the |
| 1390 |
text of the select attribute.</para> |
| 1391 |
</refdescription> |
| 1392 |
</doc:template> |
| 1393 |
|
| 1394 |
<xsl:template name="element-or-list"> |
| 1395 |
<xsl:param name="elements" select="*"/> |
| 1396 |
<xsl:param name="element.count" select="count($elements)"/> |
| 1397 |
<xsl:param name="count" select="1"/> |
| 1398 |
<xsl:param name="orlist"></xsl:param> |
| 1399 |
|
| 1400 |
<xsl:choose> |
| 1401 |
<xsl:when test="$count>$element.count"> |
| 1402 |
<xsl:value-of select="$orlist"/> |
| 1403 |
</xsl:when> |
| 1404 |
<xsl:otherwise> |
| 1405 |
<xsl:call-template name="element-or-list"> |
| 1406 |
<xsl:with-param name="elements" select="$elements"/> |
| 1407 |
<xsl:with-param name="element.count" select="$element.count"/> |
| 1408 |
<xsl:with-param name="count" select="$count+1"/> |
| 1409 |
<xsl:with-param name="orlist"> |
| 1410 |
<xsl:value-of select="$orlist"/> |
| 1411 |
<xsl:if test="not($orlist='')">|</xsl:if> |
| 1412 |
<xsl:value-of select="name($elements[position()=$count])"/> |
| 1413 |
</xsl:with-param> |
| 1414 |
</xsl:call-template> |
| 1415 |
</xsl:otherwise> |
| 1416 |
</xsl:choose> |
| 1417 |
</xsl:template> |
| 1418 |
|
| 1419 |
<!-- ==================================================================== --> |
| 1420 |
|
| 1421 |
<xsl:template name="param.node"> |
| 1422 |
<xsl:param name="value" select="string(.)"/> |
| 1423 |
|
| 1424 |
<xsl:choose> |
| 1425 |
<xsl:when test="local-name(.) = 'title'"> |
| 1426 |
<xsl:choose> |
| 1427 |
<xsl:when test="$value = 'title'"> |
| 1428 |
<xsl:text>title</xsl:text> |
| 1429 |
</xsl:when> |
| 1430 |
<xsl:otherwise> |
| 1431 |
<xsl:value-of select="$value"/> |
| 1432 |
</xsl:otherwise> |
| 1433 |
</xsl:choose> |
| 1434 |
</xsl:when> |
| 1435 |
<xsl:when test="local-name(.) = 'node'"> |
| 1436 |
<xsl:choose> |
| 1437 |
<xsl:when test="starts-with($value, 'ancestor-or-self::')"> |
| 1438 |
<xsl:variable name="new"> |
| 1439 |
<xsl:text>ancestor-or-self::</xsl:text> |
| 1440 |
<xsl:value-of select="$db.prefix"/> |
| 1441 |
<xsl:value-of select="substring-after($value, 'ancestor-or-self::')"/> |
| 1442 |
</xsl:variable> |
| 1443 |
<xsl:value-of select="$new"/> |
| 1444 |
</xsl:when> |
| 1445 |
<xsl:otherwise> |
| 1446 |
<xsl:value-of select="$value"/> |
| 1447 |
</xsl:otherwise> |
| 1448 |
</xsl:choose> |
| 1449 |
</xsl:when> |
| 1450 |
<xsl:otherwise> |
| 1451 |
<xsl:value-of select="$value"/> |
| 1452 |
</xsl:otherwise> |
| 1453 |
</xsl:choose> |
| 1454 |
</xsl:template> |
| 1455 |
|
| 1456 |
</xsl:stylesheet> |