2 <!DOCTYPE xsl:stylesheet [
<!ENTITY % xsldoc.ent SYSTEM
"./xsldoc.ent"> %xsldoc.ent; ]
>
3 <!--#############################################################################
4 | $Id: procedure.mod.xsl,v 1.12 2004/01/13 04:35:43 j-devenish Exp $
5 |- #############################################################################
6 | $Author: j-devenish $
7 + ############################################################################## -->
10 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
11 xmlns:
doc=
"http://nwalsh.com/xsl/documentation/1.0"
12 exclude-result-prefixes=
"doc" version='
1.0'
>
14 <doc:reference id=
"procedure" xmlns=
"">
16 <releaseinfo role=
"meta">
17 $Id: procedure.mod.xsl,v
1.12 2004/
01/
13 04:
35:
43 j-devenish Exp $
24 <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
25 <holder>Ramon Casellas
</holder>
28 <doc:revision rcasver=
"1.10">&rev_2003_05;</doc:revision>
31 <title>Procedures
<filename>procedure.mod.xsl
</filename></title>
41 <doc:template xmlns=
"">
42 <refpurpose>Process
<doc:db>procedure
</doc:db> elements
</refpurpose>
46 Format a titled, enumerated list of steps.
52 <listitem><simpara><xref linkend=
"param.formal.title.placement"/></simpara></listitem>
60 Although the
<sgmltag class=
"attribute">mode
</sgmltag>
61 parameter is normally empty, this template recognises a
62 special value of
<quote>custom
</quote>. This influences
63 the type of environment and the method of labelling
64 <doc:db basename=
"step">steps
</doc:db>.
68 <term>environment
</term>
70 This determines the
&LaTeX; environment that will be
71 used for each
<doc:db>step
</doc:db>'s
<function
72 condition=
"latex">item
</function>. When the
73 <literal>mode
</literal> is
<quote>custom
</quote>, this
74 parameter defaults to
<quote>description
</quote>.
75 Otherwise, the default is
<quote>enumerate
</quote>.
83 By default, the
&LaTeX; <function
84 condition=
"env">enumerate
</function> environment is used and any
85 <doc:db>step
</doc:db>'s
<doc:db>title
</doc:db> will be typeset
86 after its automatic step number. However, when the
87 <literal>mode
</literal> variable is equal to
<quote>custom
</quote>,
88 the
<function condition=
"env">description
</function> environment
89 will be used and step titles will be typeset
90 <emphasis>instead
</emphasis> of step numbers.
95 Although the procedure is a formal, titled block, is is not typeset
96 using
<function condition=
"latex">subsection
</function>.
101 <simplelist type='inline'
>
109 <listitem><simpara><xref linkend=
"template.procedure/title"/></simpara></listitem>
113 <xsl:template match=
"procedure" name=
"procedure">
114 <xsl:param name=
"mode" select=
"''"/>
115 <xsl:param name=
"environment">
117 <xsl:when test=
"$mode='custom'">
118 <xsl:text>description
</xsl:text>
121 <xsl:text>enumerate
</xsl:text>
125 <xsl:variable name=
"placement">
126 <xsl:call-template name=
"generate.formal.title.placement">
127 <xsl:with-param name=
"object" select=
"local-name(.)" />
130 <xsl:variable name=
"preamble" select=
"node()[not(self::blockinfo or self::title or self::subtitle or self::titleabbrev or self::step)]"/>
132 <xsl:when test=
"$placement='before' or $placement=''">
133 <xsl:apply-templates select=
"title" mode=
"procedure.title"/>
134 <xsl:apply-templates select=
"$preamble"/>
135 <xsl:text>\begin{
</xsl:text>
136 <xsl:value-of select=
"$environment"/>
137 <xsl:text>}
</xsl:text>
138 <xsl:apply-templates select=
"step">
139 <xsl:with-param name=
"mode" select=
"$mode"/>
140 </xsl:apply-templates>
141 <xsl:text>\end{
</xsl:text>
142 <xsl:value-of select=
"$environment"/>
143 <xsl:text>}
</xsl:text>
146 <xsl:apply-templates select=
"$preamble"/>
147 <xsl:text>\begin{
</xsl:text>
148 <xsl:value-of select=
"$environment"/>
149 <xsl:text>}
</xsl:text>
150 <xsl:apply-templates select=
"step">
151 <xsl:with-param name=
"mode" select=
"$mode"/>
152 </xsl:apply-templates>
153 <xsl:text>\end{
</xsl:text>
154 <xsl:value-of select=
"$environment"/>
155 <xsl:text>}
</xsl:text>
156 <xsl:apply-templates select=
"title" mode=
"procedure.title"/>
161 <doc:template xmlns=
"">
162 <refpurpose>Process a
<doc:db>procedure
</doc:db>'s
<doc:db>title
</doc:db> </refpurpose>
166 Format a special bridgehead.
172 <listitem><simpara><xref linkend=
"param.latex.procedure.title.style"/></simpara></listitem>
173 <listitem><simpara><xref linkend=
"param.latex.apply.title.templates"/></simpara></listitem>
179 The title is typeset as a paragraph.
184 <simplelist type='inline'
>
190 <xsl:template match=
"procedure/title">
191 <xsl:text> {
</xsl:text>
192 <xsl:value-of select=
"$latex.procedure.title.style"/>
193 <xsl:text>{
</xsl:text>
195 <xsl:when test=
"$latex.apply.title.templates=1">
196 <xsl:apply-templates/>
199 <xsl:value-of select=
"."/>
202 <xsl:text>}}
</xsl:text>
205 <doc:template basename=
"step" xmlns=
"">
206 <refpurpose>Process
<doc:db>step
</doc:db> elements
</refpurpose>
210 Format steps and substeps as part of a procedure.
216 <listitem><simpara><xref linkend=
"param.latex.step.title.style"/></simpara></listitem>
225 The
<quote>mode
</quote> from the parent
226 <doc:db>procedure
</doc:db>. This template
227 needs to know when the
<quote>custom
</quote>
228 mode is in use, because it needs to pass the
229 step's title as an optional argument to the
230 &LaTeX; <function condition=
"latex">item
</function>
231 command (see
<xref linkend=
"template.procedure"/>).
232 The mode is normally received from the enclosing
233 <doc:db>procedure
</doc:db> or
<doc:db>substeps
</doc:db>
236 </simpara></listitem>
241 The string (typically empty).
242 See
<xref linkend=
"template.generate.step.title"/>
243 </simpara></listitem>
250 Each step is typeset using the
&LaTeX; <function condition=
"latex">item
</function> command.
254 If there is no
<doc:db>title
</doc:db> element, the
255 step will be numbered automatically by
&LaTeX;.
259 <simplelist type='inline'
>
267 <listitem><simpara><xref linkend=
"template.generate.step.title"/></simpara></listitem>
271 <xsl:template match=
"step" name=
"step">
272 <xsl:param name=
"mode" select=
"''"/>
273 <xsl:param name=
"title">
274 <xsl:call-template name=
"generate.step.title">
275 <xsl:with-param name=
"mode" select=
"$mode"/>
279 <xsl:when test=
"$title!='' and $mode='custom'">
280 <xsl:text> \item[{
</xsl:text>
281 <xsl:value-of select=
"$latex.step.title.style"/> <!-- by default \sc -->
282 <xsl:text>{
</xsl:text>
283 <xsl:value-of select=
"$title"/>
284 <xsl:text>}}]
{
</xsl:text>
286 <xsl:when test=
"$title!=''">
287 <xsl:text> \item{{
</xsl:text>
288 <xsl:value-of select=
"$latex.step.title.style"/> <!-- by default \sc -->
289 <xsl:text>{
</xsl:text>
290 <xsl:value-of select=
"$title"/>
291 <xsl:text>}}
</xsl:text>
294 <xsl:text> \item{
</xsl:text>
297 <xsl:apply-templates select=
"node()[not(self::title)]"/>
298 <xsl:text>}
</xsl:text>
301 <doc:template xmlns=
"">
302 <refpurpose>Generate a
<doc:db>step
</doc:db>'s title
</refpurpose>
306 By default, simply applies templates for
<doc:db>title
</doc:db>
320 See
<xref linkend=
"template.procedure"/>. When the mode
321 is
<quote>custom
</quote>, this template will use the
322 XSL
<literal>number
</literal> element to format a title
323 such as
"1.",
"2.", etc. Otherwise, any
324 <doc:db>title
</doc:db> elements will be used.
326 </simpara></listitem>
333 If this template generates no content, the
334 <doc:db>step
</doc:db> will either be numbered automatically by
335 &LaTeX; or left unlabelled (depending on the
336 <quote>mode
</quote>).
341 <xsl:template name=
"generate.step.title">
342 <xsl:param name=
"mode"/>
344 <xsl:when test=
"title">
345 <xsl:apply-templates select=
"title"/>
347 <xsl:when test=
"$mode='custom'">
348 <xsl:number format=
"1."/>
350 <!-- otherwise, empty -->
354 <doc:template xmlns=
"">
355 <refpurpose>Process
<doc:db>substep
</doc:db> elements
</refpurpose>
359 Format substeps as part of a step.
371 See
<xref linkend=
"template.procedure"/>.
372 </simpara></listitem>
375 <term>environment
</term>
377 See
<xref linkend=
"template.procedure"/>.
378 </simpara></listitem>
385 Substeps are typeset by nesting a
&LaTeX;
386 <function condition=
"env">enumerate
</function> environment.
391 <simplelist type='inline'
>
397 <xsl:template match=
"substeps">
398 <xsl:param name=
"mode" select=
"''"/>
399 <xsl:param name=
"environment">
401 <xsl:when test=
"$mode='custom'">
402 <xsl:text>description
</xsl:text>
405 <xsl:text>enumerate
</xsl:text>
409 <xsl:text>\begin{
</xsl:text>
410 <xsl:value-of select=
"$environment"/>
411 <xsl:text>}
</xsl:text>
412 <xsl:apply-templates select=
"step">
413 <xsl:with-param name=
"mode" select=
"$mode"/>
414 </xsl:apply-templates>
415 <xsl:text>\end{
</xsl:text>
416 <xsl:value-of select=
"$environment"/>
417 <xsl:text>}
</xsl:text>