3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
5 xmlns:date="http://exslt.org/dates-and-times"
6 xmlns:exsl="http://exslt.org/common"
7 xmlns:xlink="http://www.w3.org/1999/xlink"
8 exclude-result-prefixes="doc date exsl"
9 extension-element-prefixes="date exsl"
12 <!-- ********************************************************************
13 $Id: pi.xsl 8349 2009-03-17 06:53:03Z bobstayton $
14 ********************************************************************
16 This file is part of the XSL DocBook Stylesheet distribution.
17 See ../README or http://docbook.sf.net/release/xsl/current/ for
18 copyright and other information.
20 ******************************************************************** -->
22 <doc:reference xmlns=""><info><title>Common Processing Instruction Reference</title>
23 <releaseinfo role="meta">
24 $Id: pi.xsl 8349 2009-03-17 06:53:03Z bobstayton $
27 <partintro id="partintro">
28 <title>Introduction</title>
29 <para>This is generated reference documentation for all
30 user-specifiable processing instructions (PIs) in the
31 “common” part of the DocBook XSL stylesheets.
33 <para>You add these PIs at particular points in a document to
34 cause specific “exceptions” to formatting/output behavior. To
35 make global changes in formatting/output behavior across an
36 entire document, it’s better to do it by setting an
37 appropriate stylesheet parameter (if there is one).</para>
43 <!-- ==================================================================== -->
44 <doc:pi name="dbchoice_choice" xmlns="">
45 <refpurpose>Generates a localized choice separator</refpurpose>
46 <refdescription id="select.choice.separator-desc">
47 <para>Use the <tag class="xmlpi">dbchoice choice</tag> PI to
48 generate an appropriate localized “choice” separator (for
49 example, <literal>and</literal> or <literal>or</literal>)
50 before the final item in an inline <tag>simplelist</tag></para>
52 <para>This PI is a less-than-ideal hack; support for it may
53 disappear in the future (particularly if and when a more
54 appropriate means for marking up "choice" lists becomes
55 available in DocBook).</para>
59 <synopsis><tag class="xmlpi">dbchoice choice="and"|"or"|<replaceable>string</replaceable>"</tag></synopsis>
63 <varlistentry><term>choice="and"</term>
65 <para>generates a localized <literal>and</literal> separator</para>
68 <varlistentry><term>choice="or"</term>
70 <para>generates a localized <literal>or</literal> separator</para>
73 <varlistentry><term>choice="<replaceable>string</replaceable>"</term>
75 <para>generates a literal <replaceable>string</replaceable> separator</para>
81 <xsl:template name="pi.dbchoice_choice">
82 <xsl:param name="node" select="."/>
83 <xsl:call-template name="pi-attribute">
84 <xsl:with-param name="pis" select="$node/processing-instruction('dbchoice')"/>
85 <xsl:with-param name="attribute">choice</xsl:with-param>
89 <doc:pi name="dbtimestamp" xmlns="">
90 <refpurpose>Inserts a date timestamp</refpurpose>
92 <para>Use the <tag class="xmlpi">dbtimestamp</tag> PI at any point in a
93 source document to cause a date timestamp (a formatted
94 string representing the current date and time) to be
95 inserted in output of the document.</para>
98 <synopsis><tag class="xmlpi">dbtimestamp format="<replaceable>formatstring</replaceable>" [padding="0"|"1"]</tag></synopsis>
102 <varlistentry><term>format="<replaceable>formatstring</replaceable>"</term>
104 <para>Specifies format in which the date and time are
107 <para>For details of the content of the format string,
108 see <link role="tcg" xlink:href="Datetime.html"
109 >Date and time</link>.</para>
113 <varlistentry><term>padding="0"|"1"</term>
115 <para>Specifies padding behavior; if non-zero, padding is is added</para>
121 <xsl:template name="pi.dbtimestamp">
122 <xsl:variable name="format">
123 <xsl:variable name="pi-format">
124 <xsl:call-template name="pi-attribute">
125 <xsl:with-param name="pis" select="."/>
126 <xsl:with-param name="attribute">format</xsl:with-param>
130 <xsl:when test="$pi-format != ''">
131 <xsl:value-of select="$pi-format"/>
134 <xsl:call-template name="gentext.template">
135 <xsl:with-param name="context" select="'datetime'"/>
136 <xsl:with-param name="name" select="'format'"/>
141 <xsl:variable name="padding">
142 <xsl:variable name="pi-padding">
143 <xsl:call-template name="pi-attribute">
144 <xsl:with-param name="pis" select="."/>
145 <xsl:with-param name="attribute">padding</xsl:with-param>
149 <xsl:when test="$pi-padding != ''">
150 <xsl:value-of select="$pi-padding"/>
152 <xsl:otherwise>1</xsl:otherwise>
155 <xsl:variable name="date">
157 <xsl:when test="function-available('date:date-time')">
158 <xsl:value-of select="date:date-time()"/>
160 <xsl:when test="function-available('date:dateTime')">
162 <xsl:value-of select="date:dateTime()"/>
167 <xsl:when test="function-available('date:date-time') or
168 function-available('date:dateTime')">
169 <xsl:call-template name="datetime.format">
170 <xsl:with-param name="date" select="$date"/>
171 <xsl:with-param name="format" select="$format"/>
172 <xsl:with-param name="padding" select="$padding"/>
177 Timestamp processing requires XSLT processor with EXSLT date support.
183 <doc:pi name="dbtex_delims" xmlns="">
184 <refpurpose>Generates delimiters around embedded TeX equations
185 in output</refpurpose>
187 <para>Use the <tag class="xmlpi">dbtex delims</tag> PI as a
188 child of a <tag>textobject</tag> containing embedded TeX
189 markup, to cause that markup to be surrounded by
190 <literal>$</literal> delimiter characters in output.</para>
193 <synopsis><tag class="xmlpi">dbtex delims="no"|"yes"</tag></synopsis>
197 <varlistentry><term>dbtex delims="no"|"yes"</term>
199 <para>Specifies whether delimiters are output</para>
204 <refsee role="params">
205 <para><parameter>tex.math.delims</parameter></para>
208 <para><link role="tcg"
209 xlink:href="TexMath.html"
210 >DBTeXMath</link></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.