3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:d="http://docbook.org/ns/docbook"
5 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
6 xmlns:date="http://exslt.org/dates-and-times"
7 xmlns:exsl="http://exslt.org/common"
8 xmlns:xlink="http://www.w3.org/1999/xlink"
9 exclude-result-prefixes="doc date exsl d"
10 extension-element-prefixes="date exsl"
13 <!-- ********************************************************************
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://cdn.docbook.org/release/xsl/current/ for
17 copyright and other information.
19 ******************************************************************** -->
21 <doc:reference xmlns=""><info><title>Common Processing Instruction Reference</title>
22 <releaseinfo role="meta">
25 <partintro id="partintro">
26 <title>Introduction</title>
27 <para>This is generated reference documentation for all
28 user-specifiable processing instructions (PIs) in the
29 “common” part of the DocBook XSL stylesheets.
31 <para>You add these PIs at particular points in a document to
32 cause specific “exceptions” to formatting/output behavior. To
33 make global changes in formatting/output behavior across an
34 entire document, it’s better to do it by setting an
35 appropriate stylesheet parameter (if there is one).</para>
41 <!-- ==================================================================== -->
42 <doc:pi name="dbchoice_choice" xmlns="">
43 <refpurpose>Generates a localized choice separator</refpurpose>
44 <refdescription id="select.choice.separator-desc">
45 <para>Use the <tag class="xmlpi">dbchoice choice</tag> PI to
46 generate an appropriate localized “choice” separator (for
47 example, <literal>and</literal> or <literal>or</literal>)
48 before the final item in an inline <tag>simplelist</tag></para>
50 <para>This PI is a less-than-ideal hack; support for it may
51 disappear in the future (particularly if and when a more
52 appropriate means for marking up "choice" lists becomes
53 available in DocBook).</para>
57 <synopsis><tag class="xmlpi">dbchoice choice="and"|"or"|<replaceable>string</replaceable>"</tag></synopsis>
61 <varlistentry><term>choice="and"</term>
63 <para>generates a localized <literal>and</literal> separator</para>
66 <varlistentry><term>choice="or"</term>
68 <para>generates a localized <literal>or</literal> separator</para>
71 <varlistentry><term>choice="<replaceable>string</replaceable>"</term>
73 <para>generates a literal <replaceable>string</replaceable> separator</para>
79 <xsl:template name="pi.dbchoice_choice">
80 <xsl:param name="node" select="."/>
81 <xsl:call-template name="pi-attribute">
82 <xsl:with-param name="pis" select="$node/processing-instruction('dbchoice')"/>
83 <xsl:with-param name="attribute">choice</xsl:with-param>
87 <doc:pi name="dbtimestamp" xmlns="">
88 <refpurpose>Inserts a date timestamp</refpurpose>
90 <para>Use the <tag class="xmlpi">dbtimestamp</tag> PI at any point in a
91 source document to cause a date timestamp (a formatted
92 string representing the current date and time) to be
93 inserted in output of the document.</para>
96 <synopsis><tag class="xmlpi">dbtimestamp format="<replaceable>formatstring</replaceable>" [padding="0"|"1"]</tag></synopsis>
100 <varlistentry><term>format="<replaceable>formatstring</replaceable>"</term>
102 <para>Specifies format in which the date and time are
105 <para>For details of the content of the format string,
106 see <link role="tcg" xlink:href="Datetime.html"
107 >Date and time</link>.</para>
111 <varlistentry><term>padding="0"|"1"</term>
113 <para>Specifies padding behavior; if non-zero, padding is is added</para>
119 <xsl:template name="pi.dbtimestamp">
120 <xsl:variable name="format">
121 <xsl:variable name="pi-format">
122 <xsl:call-template name="pi-attribute">
123 <xsl:with-param name="pis" select="."/>
124 <xsl:with-param name="attribute">format</xsl:with-param>
128 <xsl:when test="$pi-format != ''">
129 <xsl:value-of select="$pi-format"/>
132 <xsl:call-template name="gentext.template">
133 <xsl:with-param name="context" select="'datetime'"/>
134 <xsl:with-param name="name" select="'format'"/>
139 <xsl:variable name="padding">
140 <xsl:variable name="pi-padding">
141 <xsl:call-template name="pi-attribute">
142 <xsl:with-param name="pis" select="."/>
143 <xsl:with-param name="attribute">padding</xsl:with-param>
147 <xsl:when test="$pi-padding != ''">
148 <xsl:value-of select="$pi-padding"/>
150 <xsl:otherwise>1</xsl:otherwise>
153 <xsl:variable name="date">
155 <xsl:when test="function-available('date:date-time')">
156 <xsl:value-of select="date:date-time()"/>
158 <xsl:when test="function-available('date:dateTime')">
160 <xsl:value-of select="date:dateTime()"/>
165 <xsl:when test="function-available('date:date-time') or
166 function-available('date:dateTime')">
167 <xsl:call-template name="datetime.format">
168 <xsl:with-param name="date" select="$date"/>
169 <xsl:with-param name="format" select="$format"/>
170 <xsl:with-param name="padding" select="$padding"/>
175 Timestamp processing requires XSLT processor with EXSLT date support.
181 <doc:pi name="dbtex_delims" xmlns="">
182 <refpurpose>Generates delimiters around embedded TeX equations
183 in output</refpurpose>
185 <para>Use the <tag class="xmlpi">dbtex delims</tag> PI as a
186 child of a <tag>textobject</tag> containing embedded TeX
187 markup, to cause that markup to be surrounded by
188 <literal>$</literal> delimiter characters in output.</para>
190 <para>This feature is useful for print/PDF output only if you
191 use the obsolete and now unsupported PassiveTeX XSL-FO
196 <synopsis><tag class="xmlpi">dbtex delims="no"|"yes"</tag></synopsis>
200 <varlistentry><term>dbtex delims="no"|"yes"</term>
202 <para>Specifies whether delimiters are output</para>
208 <refsee role="params">
209 <para><parameter>tex.math.delims</parameter></para>
213 <xsl:template name="pi.dbtex_delims">
214 <xsl:param name="node" select="."/>
215 <xsl:call-template name="pi-attribute">
216 <xsl:with-param name="pis" select="$node/processing-instruction('dbtex')"/>
217 <xsl:with-param name="attribute" select="'delims'"/>
221 <!-- ==================================================================== -->
223 <xsl:template match="processing-instruction()" mode="titlepage.mode">
224 <!-- * Als process PIs on title pages -->
225 <xsl:apply-templates select="."/>
228 <xsl:template match="processing-instruction('dbtimestamp')">
229 <xsl:call-template name="pi.dbtimestamp"/>
232 <xsl:template name="datetime.format">
233 <xsl:param name="date"/>
234 <xsl:param name="format"/>
235 <xsl:param name="padding" select="1"/>
236 <xsl:if test="$format != ''">
237 <!-- replace any whitespace in the format string with a non-breaking space -->
238 <xsl:variable name="format-nbsp"
239 select="translate($format,
240 ' 	
',
241 '    ')"/>
242 <xsl:variable name="tokenized-format-string">
243 <xsl:call-template name="str.tokenize.keep.delimiters">
244 <xsl:with-param name="string" select="$format-nbsp"/>
245 <xsl:with-param name="delimiters" select="' ,./-()[]:'"/>
249 <xsl:when test="$exsl.node.set.available != 0">
250 <!-- We must preserve context node in order to get valid language -->
251 <xsl:variable name="context" select="."/>
252 <xsl:for-each select="exsl:node-set($tokenized-format-string)/node()">
253 <xsl:variable name="token">
254 <xsl:value-of select="."/>
256 <!-- Restore context node -->
257 <xsl:for-each select="$context">
259 <xsl:when test="$token = 'a'">
260 <xsl:call-template name="gentext.template">
261 <xsl:with-param name="context" select="'datetime-abbrev'"/>
262 <xsl:with-param name="name" select="date:day-abbreviation($date)"/>
265 <xsl:when test="$token = 'A'">
266 <xsl:call-template name="gentext.template">
267 <xsl:with-param name="context" select="'datetime-full'"/>
268 <xsl:with-param name="name" select="date:day-name($date)"/>
271 <xsl:when test="$token = 'b'">
272 <xsl:call-template name="gentext.template">
273 <xsl:with-param name="context" select="'datetime-abbrev'"/>
274 <xsl:with-param name="name" select="date:month-abbreviation($date)"/>
277 <xsl:when test="$token = 'c'">
278 <xsl:value-of select="date:date($date)"/>
279 <xsl:text> </xsl:text>
280 <xsl:value-of select="date:time($date)"/>
282 <xsl:when test="$token = 'B'">
283 <xsl:call-template name="gentext.template">
284 <xsl:with-param name="context" select="'datetime-full'"/>
285 <xsl:with-param name="name" select="date:month-name($date)"/>
288 <xsl:when test="$token = 'd'">
289 <xsl:if test="$padding = 1 and
290 string-length(date:day-in-month($date)) = 1">0</xsl:if>
291 <xsl:value-of select="date:day-in-month($date)"/>
293 <xsl:when test="$token = 'H'">
294 <xsl:if test="$padding = 1 and string-length(date:hour-in-day($date)) = 1">0</xsl:if>
295 <xsl:value-of select="date:hour-in-day($date)"/>
297 <xsl:when test="$token = 'j'">
298 <xsl:value-of select="date:day-in-year($date)"/>
300 <xsl:when test="$token = 'm'">
301 <xsl:if test="$padding = 1 and string-length(date:month-in-year($date)) = 1">0</xsl:if>
302 <xsl:value-of select="date:month-in-year($date)"/>
304 <xsl:when test="$token = 'M'">
305 <xsl:if test="string-length(date:minute-in-hour($date)) = 1">0</xsl:if>
306 <xsl:value-of select="date:minute-in-hour($date)"/>
308 <xsl:when test="$token = 'S'">
309 <xsl:if test="string-length(date:second-in-minute($date)) = 1">0</xsl:if>
310 <xsl:value-of select="date:second-in-minute($date)"/>
312 <xsl:when test="$token = 'U'">
313 <xsl:value-of select="date:week-in-year($date)"/>
315 <xsl:when test="$token = 'w'">
316 <xsl:value-of select="date:day-in-week($date)"/>
318 <xsl:when test="$token = 'x'">
319 <xsl:value-of select="date:date($date)"/>
321 <xsl:when test="$token = 'X'">
322 <xsl:value-of select="date:time($date)"/>
324 <xsl:when test="$token = 'Y'">
325 <xsl:value-of select="date:year($date)"/>
328 <xsl:value-of select="$token"/>
336 Timestamp processing requires an XSLT processor with support
337 for the EXSLT node-set() function.