2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY comment.block.parents
"parent::answer|parent::appendix|parent::article|parent::bibliodiv|
4 parent::bibliography|parent::blockquote|parent::caution|parent::chapter|
5 parent::glossary|parent::glossdiv|parent::important|parent::index|
6 parent::indexdiv|parent::listitem|parent::note|parent::orderedlist|
7 parent::partintro|parent::preface|parent::procedure|parent::qandadiv|
8 parent::qandaset|parent::question|parent::refentry|parent::refnamediv|
9 parent::refsect1|parent::refsect2|parent::refsect3|parent::refsection|
10 parent::refsynopsisdiv|parent::sect1|parent::sect2|parent::sect3|parent::sect4|
11 parent::sect5|parent::section|parent::setindex|parent::sidebar|
12 parent::simplesect|parent::taskprerequisites|parent::taskrelated|
13 parent::tasksummary|parent::warning">
15 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
16 xmlns:xlink='http://www.w3.org/
1999/xlink'
17 xmlns:
suwl=
"http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
18 exclude-result-prefixes=
"xlink suwl"
21 <!-- ********************************************************************
22 $Id: inline.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
23 ********************************************************************
25 This file is part of the XSL DocBook Stylesheet distribution.
26 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
27 and other information.
29 ******************************************************************** -->
30 <xsl:template name=
"simple.xlink">
31 <xsl:param name=
"node" select=
"."/>
32 <xsl:param name=
"content">
33 <xsl:apply-templates/>
35 <xsl:param name=
"a.target"/>
36 <xsl:param name=
"linkend" select=
"$node/@linkend"/>
37 <xsl:param name=
"xhref" select=
"$node/@xlink:href"/>
39 <xsl:variable name=
"link">
41 <xsl:when test=
"$xhref and
42 (not($node/@xlink:type) or
43 $node/@xlink:type='simple')">
45 <!-- Is it a local idref or a uri? -->
46 <xsl:variable name=
"is.idref">
48 <!-- if the href starts with # and does not contain an "(" -->
49 <!-- or if the href starts with #xpointer(id(, it's just an ID -->
50 <xsl:when test=
"starts-with($xhref,'#')
51 and (not(contains($xhref,'('))
52 or starts-with($xhref,
53 '#xpointer(id('))">1</xsl:when>
54 <xsl:otherwise>0</xsl:otherwise>
59 <xsl:when test=
"$is.idref = 1">
61 <xsl:variable name=
"idref">
62 <xsl:call-template name=
"xpointer.idref">
63 <xsl:with-param name=
"xpointer" select=
"$xhref"/>
67 <xsl:variable name=
"targets" select=
"key('id',$idref)"/>
68 <xsl:variable name=
"target" select=
"$targets[1]"/>
70 <xsl:call-template name=
"check.id.unique">
71 <xsl:with-param name=
"linkend" select=
"$idref"/>
75 <xsl:when test=
"count($target) = 0">
77 <xsl:text>XLink to nonexistent id:
</xsl:text>
78 <xsl:value-of select=
"$idref"/>
80 <xsl:copy-of select=
"$content"/>
85 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
87 <xsl:attribute name=
"href">
88 <xsl:call-template name=
"href.target">
89 <xsl:with-param name=
"object" select=
"$target"/>
94 <xsl:when test=
"$node/@xlink.title">
95 <xsl:attribute name=
"title">
96 <xsl:value-of select=
"$node/@xlink:title"/>
100 <xsl:apply-templates select=
"$target"
101 mode=
"html.title.attribute"/>
105 <xsl:if test=
"$a.target">
106 <xsl:attribute name=
"target">
107 <xsl:value-of select=
"$a.target"/>
111 <xsl:copy-of select=
"$content"/>
118 <!-- otherwise it's a URI -->
121 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
122 <xsl:attribute name=
"href">
123 <xsl:value-of select=
"$xhref"/>
125 <xsl:if test=
"$node/@xlink.title">
126 <xsl:attribute name=
"title">
127 <xsl:value-of select=
"$node/@xlink:title"/>
130 <xsl:copy-of select=
"$content"/>
136 <xsl:when test=
"$linkend">
137 <xsl:variable name=
"targets" select=
"key('id',$linkend)"/>
138 <xsl:variable name=
"target" select=
"$targets[1]"/>
140 <xsl:call-template name=
"check.id.unique">
141 <xsl:with-param name=
"linkend" select=
"$linkend"/>
145 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
146 <xsl:attribute name=
"href">
147 <xsl:call-template name=
"href.target">
148 <xsl:with-param name=
"object" select=
"$target"/>
152 <xsl:apply-templates select=
"$target" mode=
"html.title.attribute"/>
154 <xsl:copy-of select=
"$content"/>
159 <xsl:copy-of select=
"$content"/>
165 <xsl:when test=
"function-available('suwl:unwrapLinks')">
166 <xsl:copy-of select=
"suwl:unwrapLinks($link)"/>
169 <xsl:copy-of select=
"$link"/>
174 <xsl:template name=
"inline.charseq">
175 <xsl:param name=
"content">
176 <xsl:call-template name=
"anchor"/>
177 <xsl:call-template name=
"simple.xlink">
178 <xsl:with-param name=
"content">
179 <xsl:apply-templates/>
183 <!-- * if you want output from the inline.charseq template wrapped in -->
184 <!-- * something other than a Span, call the template with some value -->
185 <!-- * for the 'wrapper-name' param -->
186 <xsl:param name=
"wrapper-name">span
</xsl:param>
187 <xsl:element name=
"{$wrapper-name}">
188 <xsl:attribute name=
"class">
189 <xsl:value-of select=
"local-name(.)"/>
191 <xsl:call-template name=
"dir"/>
192 <xsl:call-template name=
"generate.html.title"/>
193 <xsl:copy-of select=
"$content"/>
194 <xsl:call-template name=
"apply-annotations"/>
198 <xsl:template name=
"inline.monoseq">
199 <xsl:param name=
"content">
200 <xsl:call-template name=
"anchor"/>
201 <xsl:call-template name=
"simple.xlink">
202 <xsl:with-param name=
"content">
203 <xsl:apply-templates/>
208 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
209 <xsl:call-template name=
"dir"/>
210 <xsl:call-template name=
"generate.html.title"/>
211 <xsl:copy-of select=
"$content"/>
212 <xsl:call-template name=
"apply-annotations"/>
216 <xsl:template name=
"inline.boldseq">
217 <xsl:param name=
"content">
218 <xsl:call-template name=
"anchor"/>
219 <xsl:call-template name=
"simple.xlink">
220 <xsl:with-param name=
"content">
221 <xsl:apply-templates/>
227 <xsl:call-template name=
"generate.html.title"/>
228 <xsl:call-template name=
"dir"/>
230 <!-- don't put <strong> inside figure, example, or table titles -->
232 <xsl:when test=
"local-name(..) = 'title'
233 and (local-name(../..) = 'figure'
234 or local-name(../..) = 'example'
235 or local-name(../..) = 'table')">
236 <xsl:copy-of select=
"$content"/>
240 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
241 <xsl:copy-of select=
"$content"/>
245 <xsl:call-template name=
"apply-annotations"/>
249 <xsl:template name=
"inline.italicseq">
250 <xsl:param name=
"content">
251 <xsl:call-template name=
"anchor"/>
252 <xsl:call-template name=
"simple.xlink">
253 <xsl:with-param name=
"content">
254 <xsl:apply-templates/>
259 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
260 <xsl:call-template name=
"generate.html.title"/>
261 <xsl:call-template name=
"dir"/>
262 <xsl:copy-of select=
"$content"/>
263 <xsl:call-template name=
"apply-annotations"/>
267 <xsl:template name=
"inline.boldmonoseq">
268 <xsl:param name=
"content">
269 <xsl:call-template name=
"anchor"/>
270 <xsl:call-template name=
"simple.xlink">
271 <xsl:with-param name=
"content">
272 <xsl:apply-templates/>
276 <!-- don't put <strong> inside figure, example, or table titles -->
277 <!-- or other titles that may already be represented with <strong>'s. -->
279 <xsl:when test=
"local-name(..) = 'title'
280 and (local-name(../..) = 'figure'
281 or local-name(../..) = 'example'
282 or local-name(../..) = 'table'
283 or local-name(../..) = 'formalpara')">
285 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
286 <xsl:call-template name=
"generate.html.title"/>
287 <xsl:call-template name=
"dir"/>
288 <xsl:copy-of select=
"$content"/>
289 <xsl:call-template name=
"apply-annotations"/>
294 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
296 <xsl:call-template name=
"generate.html.title"/>
297 <xsl:call-template name=
"dir"/>
298 <xsl:copy-of select=
"$content"/>
300 <xsl:call-template name=
"apply-annotations"/>
306 <xsl:template name=
"inline.italicmonoseq">
307 <xsl:param name=
"content">
308 <xsl:call-template name=
"anchor"/>
309 <xsl:call-template name=
"simple.xlink">
310 <xsl:with-param name=
"content">
311 <xsl:apply-templates/>
316 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
318 <xsl:call-template name=
"generate.html.title"/>
319 <xsl:call-template name=
"dir"/>
320 <xsl:copy-of select=
"$content"/>
321 <xsl:call-template name=
"apply-annotations"/>
326 <xsl:template name=
"inline.superscriptseq">
327 <xsl:param name=
"content">
328 <xsl:call-template name=
"anchor"/>
329 <xsl:call-template name=
"simple.xlink">
330 <xsl:with-param name=
"content">
331 <xsl:apply-templates/>
336 <xsl:call-template name=
"generate.html.title"/>
337 <xsl:call-template name=
"dir"/>
338 <xsl:copy-of select=
"$content"/>
339 <xsl:call-template name=
"apply-annotations"/>
343 <xsl:template name=
"inline.subscriptseq">
344 <xsl:param name=
"content">
345 <xsl:call-template name=
"anchor"/>
346 <xsl:call-template name=
"simple.xlink">
347 <xsl:with-param name=
"content">
348 <xsl:apply-templates/>
353 <xsl:call-template name=
"generate.html.title"/>
354 <xsl:call-template name=
"dir"/>
355 <xsl:copy-of select=
"$content"/>
356 <xsl:call-template name=
"apply-annotations"/>
360 <!-- ==================================================================== -->
361 <!-- some special cases -->
363 <xsl:template match=
"author">
364 <xsl:param name=
"content">
365 <xsl:call-template name=
"anchor"/>
366 <xsl:call-template name=
"simple.xlink">
367 <xsl:with-param name=
"content">
368 <xsl:call-template name=
"person.name"/>
371 <xsl:call-template name=
"apply-annotations"/>
375 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
376 <xsl:copy-of select=
"$content"/>
380 <xsl:template match=
"editor">
381 <xsl:param name=
"content">
382 <xsl:call-template name=
"anchor"/>
383 <xsl:call-template name=
"simple.xlink">
384 <xsl:with-param name=
"content">
385 <xsl:call-template name=
"person.name"/>
388 <xsl:call-template name=
"apply-annotations"/>
392 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
393 <xsl:copy-of select=
"$content"/>
397 <xsl:template match=
"othercredit">
398 <xsl:param name=
"content">
399 <xsl:call-template name=
"anchor"/>
400 <xsl:call-template name=
"simple.xlink">
401 <xsl:with-param name=
"content">
402 <xsl:call-template name=
"person.name"/>
405 <xsl:call-template name=
"apply-annotations"/>
409 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
410 <xsl:copy-of select=
"$content"/>
414 <xsl:template match=
"authorinitials">
415 <xsl:call-template name=
"inline.charseq"/>
418 <!-- ==================================================================== -->
420 <xsl:template match=
"accel">
421 <xsl:call-template name=
"inline.charseq"/>
424 <xsl:template match=
"action">
425 <xsl:call-template name=
"inline.charseq"/>
428 <xsl:template match=
"application">
429 <xsl:call-template name=
"inline.charseq"/>
432 <xsl:template match=
"classname">
433 <xsl:call-template name=
"inline.monoseq"/>
436 <xsl:template match=
"exceptionname">
437 <xsl:call-template name=
"inline.monoseq"/>
440 <xsl:template match=
"interfacename">
441 <xsl:call-template name=
"inline.monoseq"/>
444 <xsl:template match=
"methodname">
445 <xsl:call-template name=
"inline.monoseq"/>
448 <xsl:template match=
"command">
449 <xsl:call-template name=
"inline.boldseq"/>
452 <xsl:template match=
"computeroutput">
453 <xsl:call-template name=
"inline.monoseq"/>
456 <xsl:template match=
"constant">
457 <xsl:call-template name=
"inline.monoseq"/>
460 <xsl:template match=
"database">
461 <xsl:call-template name=
"inline.charseq"/>
464 <xsl:template match=
"date">
465 <!-- should this support locale-specific formatting? how? -->
466 <xsl:call-template name=
"inline.charseq"/>
469 <xsl:template match=
"errorcode">
470 <xsl:call-template name=
"inline.charseq"/>
473 <xsl:template match=
"errorname">
474 <xsl:call-template name=
"inline.charseq"/>
477 <xsl:template match=
"errortype">
478 <xsl:call-template name=
"inline.charseq"/>
481 <xsl:template match=
"errortext">
482 <xsl:call-template name=
"inline.charseq"/>
485 <xsl:template match=
"envar">
486 <xsl:call-template name=
"inline.monoseq"/>
489 <xsl:template match=
"filename">
490 <xsl:call-template name=
"inline.monoseq"/>
493 <xsl:template match=
"function">
495 <xsl:when test=
"$function.parens != '0'
496 and (parameter or function or replaceable)">
497 <xsl:variable name=
"nodes" select=
"text()|*"/>
498 <xsl:call-template name=
"inline.monoseq">
499 <xsl:with-param name=
"content">
500 <xsl:call-template name=
"simple.xlink">
501 <xsl:with-param name=
"content">
502 <xsl:apply-templates select=
"$nodes[1]"/>
507 <xsl:text>(
</xsl:text>
508 <xsl:apply-templates select=
"$nodes[position()>1]"/>
509 <xsl:text>)
</xsl:text>
512 <xsl:call-template name=
"inline.monoseq"/>
517 <xsl:template match=
"function/parameter" priority=
"2">
518 <xsl:call-template name=
"inline.italicmonoseq"/>
519 <xsl:if test=
"following-sibling::*">
520 <xsl:text>,
</xsl:text>
524 <xsl:template match=
"function/replaceable" priority=
"2">
525 <xsl:call-template name=
"inline.italicmonoseq"/>
526 <xsl:if test=
"following-sibling::*">
527 <xsl:text>,
</xsl:text>
531 <xsl:template match=
"guibutton">
532 <xsl:call-template name=
"inline.charseq"/>
535 <xsl:template match=
"guiicon">
536 <xsl:call-template name=
"inline.charseq"/>
539 <xsl:template match=
"guilabel">
540 <xsl:call-template name=
"inline.charseq"/>
543 <xsl:template match=
"guimenu">
544 <xsl:call-template name=
"inline.charseq"/>
547 <xsl:template match=
"guimenuitem">
548 <xsl:call-template name=
"inline.charseq"/>
551 <xsl:template match=
"guisubmenu">
552 <xsl:call-template name=
"inline.charseq"/>
555 <xsl:template match=
"hardware">
556 <xsl:call-template name=
"inline.charseq"/>
559 <xsl:template match=
"interface">
560 <xsl:call-template name=
"inline.charseq"/>
563 <xsl:template match=
"interfacedefinition">
564 <xsl:call-template name=
"inline.charseq"/>
567 <xsl:template match=
"keycap">
568 <xsl:call-template name=
"inline.boldseq"/>
571 <xsl:template match=
"keycode">
572 <xsl:call-template name=
"inline.charseq"/>
575 <xsl:template match=
"keysym">
576 <xsl:call-template name=
"inline.charseq"/>
579 <xsl:template match=
"literal">
580 <xsl:call-template name=
"inline.monoseq"/>
583 <xsl:template match=
"code">
584 <xsl:call-template name=
"inline.monoseq"/>
587 <xsl:template match=
"medialabel">
588 <xsl:call-template name=
"inline.italicseq"/>
591 <xsl:template match=
"shortcut">
592 <xsl:call-template name=
"inline.boldseq"/>
595 <xsl:template match=
"mousebutton">
596 <xsl:call-template name=
"inline.charseq"/>
599 <xsl:template match=
"option">
600 <xsl:call-template name=
"inline.monoseq"/>
603 <xsl:template match=
"package">
604 <xsl:call-template name=
"inline.charseq"/>
607 <xsl:template match=
"parameter">
608 <xsl:call-template name=
"inline.italicmonoseq"/>
611 <xsl:template match=
"property">
612 <xsl:call-template name=
"inline.charseq"/>
615 <xsl:template match=
"prompt">
616 <xsl:call-template name=
"inline.monoseq"/>
619 <xsl:template match=
"replaceable" priority=
"1">
620 <xsl:call-template name=
"inline.italicmonoseq"/>
623 <xsl:template match=
"returnvalue">
624 <xsl:call-template name=
"inline.charseq"/>
627 <xsl:template match=
"structfield">
628 <xsl:call-template name=
"inline.italicmonoseq"/>
631 <xsl:template match=
"structname">
632 <xsl:call-template name=
"inline.charseq"/>
635 <xsl:template match=
"symbol">
636 <xsl:call-template name=
"inline.charseq"/>
639 <xsl:template match=
"systemitem">
640 <xsl:call-template name=
"inline.monoseq"/>
643 <xsl:template match=
"token">
644 <xsl:call-template name=
"inline.charseq"/>
647 <xsl:template match=
"type">
648 <xsl:call-template name=
"inline.charseq"/>
651 <xsl:template match=
"userinput">
652 <xsl:call-template name=
"inline.boldmonoseq"/>
655 <xsl:template match=
"abbrev">
656 <xsl:call-template name=
"inline.charseq">
657 <xsl:with-param name=
"wrapper-name">abbr
</xsl:with-param>
661 <xsl:template match=
"acronym">
662 <xsl:call-template name=
"inline.charseq">
663 <xsl:with-param name=
"wrapper-name">acronym
</xsl:with-param>
667 <xsl:template match=
"citerefentry">
669 <xsl:when test=
"$citerefentry.link != '0'">
671 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
672 <xsl:attribute name=
"href">
673 <xsl:call-template name=
"generate.citerefentry.link"/>
675 <xsl:call-template name=
"inline.charseq"/>
679 <xsl:call-template name=
"inline.charseq"/>
684 <xsl:template name=
"generate.citerefentry.link">
688 <xsl:template name=
"x.generate.citerefentry.link">
689 <xsl:text>http://example.com/cgi-bin/man.cgi?
</xsl:text>
690 <xsl:value-of select=
"refentrytitle"/>
691 <xsl:text>(
</xsl:text>
692 <xsl:value-of select=
"manvolnum"/>
693 <xsl:text>)
</xsl:text>
696 <xsl:template match=
"citetitle">
698 <xsl:when test=
"@pubwork = 'article'">
699 <xsl:call-template name=
"gentext.startquote"/>
700 <xsl:call-template name=
"inline.charseq"/>
701 <xsl:call-template name=
"gentext.endquote"/>
704 <xsl:call-template name=
"inline.italicseq"/>
709 <xsl:template match=
"emphasis">
712 <xsl:when test=
"@role and $emphasis.propagates.style != 0">
713 <xsl:apply-templates select=
"." mode=
"class.attribute">
714 <xsl:with-param name=
"class" select=
"@role"/>
715 </xsl:apply-templates>
718 <xsl:attribute name=
"class">
719 <xsl:text>emphasis
</xsl:text>
723 <xsl:call-template name=
"anchor"/>
725 <xsl:call-template name=
"simple.xlink">
726 <xsl:with-param name=
"content">
728 <xsl:when test=
"@role = 'bold' or @role='strong'">
729 <!-- backwards compatibility: make bold into b elements, but -->
730 <!-- don't put bold inside figure, example, or table titles -->
732 <xsl:when test=
"local-name(..) = 'title'
733 and (local-name(../..) = 'figure'
734 or local-name(../..) = 'example'
735 or local-name(../..) = 'table')">
736 <xsl:apply-templates/>
739 <strong><xsl:apply-templates/></strong>
743 <xsl:when test=
"@role and $emphasis.propagates.style != 0">
744 <xsl:apply-templates/>
747 <em><xsl:apply-templates/></em>
755 <xsl:template match=
"foreignphrase">
757 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
758 <xsl:if test=
"@lang or @xml:lang">
759 <xsl:call-template name=
"language.attribute"/>
761 <xsl:call-template name=
"inline.italicseq"/>
765 <xsl:template match=
"markup">
766 <xsl:call-template name=
"inline.charseq"/>
769 <xsl:template match=
"phrase">
771 <xsl:call-template name=
"generate.html.title"/>
772 <xsl:if test=
"@lang or @xml:lang">
773 <xsl:call-template name=
"language.attribute"/>
775 <xsl:if test=
"@role and $phrase.propagates.style != 0">
776 <xsl:apply-templates select=
"." mode=
"class.attribute">
777 <xsl:with-param name=
"class" select=
"@role"/>
778 </xsl:apply-templates>
780 <xsl:call-template name=
"dir"/>
781 <xsl:call-template name=
"anchor"/>
782 <xsl:call-template name=
"simple.xlink">
783 <xsl:with-param name=
"content">
784 <xsl:apply-templates/>
787 <xsl:call-template name=
"apply-annotations"/>
791 <xsl:template match=
"quote">
792 <xsl:variable name=
"depth">
793 <xsl:call-template name=
"dot.count">
794 <xsl:with-param name=
"string">
795 <xsl:number level=
"multiple"/>
800 <xsl:when test=
"$depth mod 2 = 0">
801 <xsl:call-template name=
"gentext.startquote"/>
802 <xsl:call-template name=
"inline.charseq"/>
803 <xsl:call-template name=
"gentext.endquote"/>
806 <xsl:call-template name=
"gentext.nestedstartquote"/>
807 <xsl:call-template name=
"inline.charseq"/>
808 <xsl:call-template name=
"gentext.nestedendquote"/>
813 <xsl:template match=
"varname">
814 <xsl:call-template name=
"inline.monoseq"/>
817 <xsl:template match=
"wordasword">
818 <xsl:call-template name=
"inline.italicseq"/>
821 <xsl:template match=
"lineannotation">
823 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
824 <xsl:call-template name=
"inline.charseq"/>
828 <xsl:template match=
"superscript">
829 <xsl:call-template name=
"inline.superscriptseq"/>
832 <xsl:template match=
"subscript">
833 <xsl:call-template name=
"inline.subscriptseq"/>
836 <xsl:template match=
"trademark">
837 <xsl:call-template name=
"inline.charseq"/>
839 <xsl:when test=
"@class = 'copyright'
840 or @class = 'registered'">
841 <xsl:call-template name=
"dingbat">
842 <xsl:with-param name=
"dingbat" select=
"@class"/>
845 <xsl:when test=
"@class = 'service'">
849 <xsl:call-template name=
"dingbat">
850 <xsl:with-param name=
"dingbat" select=
"'trademark'"/>
856 <xsl:template match=
"firstterm">
857 <xsl:call-template name=
"glossterm">
858 <xsl:with-param name=
"firstterm" select=
"1"/>
862 <xsl:template match=
"glossterm" name=
"glossterm">
863 <xsl:param name=
"firstterm" select=
"0"/>
865 <!-- To avoid extra <a name=""> anchor from inline.italicseq -->
866 <xsl:variable name=
"content">
867 <xsl:apply-templates/>
871 <xsl:when test=
"($firstterm.only.link = 0 or $firstterm = 1) and @linkend">
872 <xsl:variable name=
"targets" select=
"key('id',@linkend)"/>
873 <xsl:variable name=
"target" select=
"$targets[1]"/>
875 <xsl:call-template name=
"check.id.unique">
876 <xsl:with-param name=
"linkend" select=
"@linkend"/>
880 <xsl:when test=
"$target">
882 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
883 <xsl:if test=
"@id or @xml:id">
884 <xsl:attribute name=
"name">
885 <xsl:value-of select=
"(@id|@xml:id)[1]"/>
889 <xsl:attribute name=
"href">
890 <xsl:call-template name=
"href.target">
891 <xsl:with-param name=
"object" select=
"$target"/>
895 <xsl:call-template name=
"inline.italicseq">
896 <xsl:with-param name=
"content" select=
"$content"/>
901 <xsl:call-template name=
"inline.italicseq">
902 <xsl:with-param name=
"content" select=
"$content"/>
908 <xsl:when test=
"not(@linkend)
909 and ($firstterm.only.link = 0 or $firstterm = 1)
910 and ($glossterm.auto.link != 0)
911 and $glossary.collection != ''">
912 <xsl:variable name=
"term">
914 <xsl:when test=
"@baseform"><xsl:value-of select=
"@baseform"/></xsl:when>
915 <xsl:otherwise><xsl:value-of select=
"."/></xsl:otherwise>
919 <xsl:variable name=
"cterm"
920 select=
"(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
922 <!-- HACK HACK HACK! But it works... -->
923 <!-- You'd need to do more work if you wanted to chunk on glossdiv, though -->
925 <xsl:variable name=
"glossary" select=
"//glossary[@role='auto']"/>
927 <xsl:if test=
"count($glossary) != 1">
929 <xsl:text>Warning: glossary.collection specified, but there are
</xsl:text>
930 <xsl:value-of select=
"count($glossary)"/>
931 <xsl:text> automatic glossaries
</xsl:text>
935 <xsl:variable name=
"glosschunk">
936 <xsl:call-template name=
"href.target">
937 <xsl:with-param name=
"object" select=
"$glossary"/>
941 <xsl:variable name=
"chunkbase">
943 <xsl:when test=
"contains($glosschunk, '#')">
944 <xsl:value-of select=
"substring-before($glosschunk, '#')"/>
947 <xsl:value-of select=
"$glosschunk"/>
953 <xsl:when test=
"not($cterm)">
955 <xsl:text>There's no entry for
</xsl:text>
956 <xsl:value-of select=
"$term"/>
957 <xsl:text> in
</xsl:text>
958 <xsl:value-of select=
"$glossary.collection"/>
960 <xsl:call-template name=
"inline.italicseq"/>
963 <xsl:variable name=
"id">
964 <xsl:call-template name=
"object.id">
965 <xsl:with-param name=
"object" select=
"$cterm"/>
968 <a href=
"{$chunkbase}#{$id}">
969 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
970 <xsl:call-template name=
"inline.italicseq">
971 <xsl:with-param name=
"content" select=
"$content"/>
978 <xsl:when test=
"not(@linkend)
979 and ($firstterm.only.link = 0 or $firstterm = 1)
980 and $glossterm.auto.link != 0">
981 <xsl:variable name=
"term">
983 <xsl:when test=
"@baseform">
984 <xsl:value-of select=
"normalize-space(@baseform)"/>
987 <xsl:value-of select=
"normalize-space(.)"/>
991 <xsl:variable name=
"targets"
992 select=
"//glossentry[normalize-space(glossterm)=$term
993 or normalize-space(glossterm/@baseform)=$term]"/>
994 <xsl:variable name=
"target" select=
"$targets[1]"/>
997 <xsl:when test=
"count($targets)=0">
999 <xsl:text>Error: no glossentry for glossterm:
</xsl:text>
1000 <xsl:value-of select=
"."/>
1001 <xsl:text>.
</xsl:text>
1003 <xsl:call-template name=
"inline.italicseq"/>
1007 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1008 <xsl:if test=
"@id or @xml:id">
1009 <xsl:attribute name=
"name">
1010 <xsl:value-of select=
"(@id|@xml:id)[1]"/>
1014 <xsl:attribute name=
"href">
1015 <xsl:call-template name=
"href.target">
1016 <xsl:with-param name=
"object" select=
"$target"/>
1017 </xsl:call-template>
1020 <xsl:call-template name=
"inline.italicseq">
1021 <xsl:with-param name=
"content" select=
"$content"/>
1022 </xsl:call-template>
1029 <xsl:call-template name=
"inline.italicseq"/>
1034 <xsl:template match=
"termdef">
1036 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1037 <xsl:call-template name=
"generate.html.title"/>
1038 <xsl:call-template name=
"gentext.template">
1039 <xsl:with-param name=
"context" select=
"'termdef'"/>
1040 <xsl:with-param name=
"name" select=
"'prefix'"/>
1041 </xsl:call-template>
1042 <xsl:apply-templates/>
1043 <xsl:call-template name=
"gentext.template">
1044 <xsl:with-param name=
"context" select=
"'termdef'"/>
1045 <xsl:with-param name=
"name" select=
"'suffix'"/>
1046 </xsl:call-template>
1050 <xsl:template match=
"sgmltag|tag">
1051 <xsl:call-template name=
"format.sgmltag"/>
1054 <xsl:template name=
"format.sgmltag">
1055 <xsl:param name=
"class">
1057 <xsl:when test=
"@class">
1058 <xsl:value-of select=
"@class"/>
1060 <xsl:otherwise>element
</xsl:otherwise>
1064 <xsl:variable name=
"content">
1066 <xsl:when test=
"$class='attribute'">
1067 <xsl:apply-templates/>
1069 <xsl:when test=
"$class='attvalue'">
1070 <xsl:apply-templates/>
1072 <xsl:when test=
"$class='element'">
1073 <xsl:apply-templates/>
1075 <xsl:when test=
"$class='endtag'">
1076 <xsl:text></
</xsl:text>
1077 <xsl:apply-templates/>
1078 <xsl:text>></xsl:text>
1080 <xsl:when test=
"$class='genentity'">
1081 <xsl:text>&</xsl:text>
1082 <xsl:apply-templates/>
1083 <xsl:text>;
</xsl:text>
1085 <xsl:when test=
"$class='numcharref'">
1086 <xsl:text>&#
</xsl:text>
1087 <xsl:apply-templates/>
1088 <xsl:text>;
</xsl:text>
1090 <xsl:when test=
"$class='paramentity'">
1091 <xsl:text>%
</xsl:text>
1092 <xsl:apply-templates/>
1093 <xsl:text>;
</xsl:text>
1095 <xsl:when test=
"$class='pi'">
1096 <xsl:text><?
</xsl:text>
1097 <xsl:apply-templates/>
1098 <xsl:text>></xsl:text>
1100 <xsl:when test=
"$class='xmlpi'">
1101 <xsl:text><?
</xsl:text>
1102 <xsl:apply-templates/>
1103 <xsl:text>?
></xsl:text>
1105 <xsl:when test=
"$class='starttag'">
1106 <xsl:text><</xsl:text>
1107 <xsl:apply-templates/>
1108 <xsl:text>></xsl:text>
1110 <xsl:when test=
"$class='emptytag'">
1111 <xsl:text><</xsl:text>
1112 <xsl:apply-templates/>
1113 <xsl:text>/
></xsl:text>
1115 <xsl:when test=
"$class='sgmlcomment' or $class='comment'">
1116 <xsl:text><!--
</xsl:text>
1117 <xsl:apply-templates/>
1118 <xsl:text>--
></xsl:text>
1121 <xsl:apply-templates/>
1127 <xsl:apply-templates select=
"." mode=
"class.attribute">
1128 <xsl:with-param name=
"class" select=
"concat('sgmltag-', $class)"/>
1129 </xsl:apply-templates>
1130 <xsl:call-template name=
"generate.html.title"/>
1131 <xsl:call-template name=
"simple.xlink">
1132 <xsl:with-param name=
"content" select=
"$content"/>
1133 </xsl:call-template>
1137 <xsl:template match=
"email">
1138 <xsl:call-template name=
"inline.monoseq">
1139 <xsl:with-param name=
"content">
1140 <xsl:if test=
"not($email.delimiters.enabled = 0)">
1141 <xsl:text><</xsl:text>
1144 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1145 <xsl:attribute name=
"href">
1146 <xsl:text>mailto:
</xsl:text>
1147 <xsl:value-of select=
"."/>
1149 <xsl:apply-templates/>
1151 <xsl:if test=
"not($email.delimiters.enabled = 0)">
1152 <xsl:text>></xsl:text>
1155 </xsl:call-template>
1158 <xsl:template match=
"keycombo">
1159 <xsl:variable name=
"action" select=
"@action"/>
1160 <xsl:variable name=
"joinchar">
1162 <xsl:when test=
"$action='seq'"><xsl:text> </xsl:text></xsl:when>
1163 <xsl:when test=
"$action='simul'">+
</xsl:when>
1164 <xsl:when test=
"$action='press'">-
</xsl:when>
1165 <xsl:when test=
"$action='click'">-
</xsl:when>
1166 <xsl:when test=
"$action='double-click'">-
</xsl:when>
1167 <xsl:when test=
"$action='other'"></xsl:when>
1168 <xsl:otherwise>-
</xsl:otherwise>
1171 <xsl:for-each select=
"*">
1172 <xsl:if test=
"position()>1"><xsl:value-of select=
"$joinchar"/></xsl:if>
1173 <xsl:apply-templates select=
"."/>
1177 <xsl:template match=
"uri">
1178 <xsl:call-template name=
"inline.monoseq"/>
1181 <!-- ==================================================================== -->
1183 <xsl:template match=
"menuchoice">
1184 <xsl:variable name=
"shortcut" select=
"./shortcut"/>
1185 <xsl:call-template name=
"process.menuchoice"/>
1186 <xsl:if test=
"$shortcut">
1187 <xsl:text> (
</xsl:text>
1188 <xsl:apply-templates select=
"$shortcut"/>
1189 <xsl:text>)
</xsl:text>
1193 <xsl:template name=
"process.menuchoice">
1194 <xsl:param name=
"nodelist" select=
"guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) -->
1195 <xsl:param name=
"count" select=
"1"/>
1198 <xsl:when test=
"$count>count($nodelist)"></xsl:when>
1199 <xsl:when test=
"$count=1">
1200 <xsl:apply-templates select=
"$nodelist[$count=position()]"/>
1201 <xsl:call-template name=
"process.menuchoice">
1202 <xsl:with-param name=
"nodelist" select=
"$nodelist"/>
1203 <xsl:with-param name=
"count" select=
"$count+1"/>
1204 </xsl:call-template>
1207 <xsl:variable name=
"node" select=
"$nodelist[$count=position()]"/>
1209 <xsl:when test=
"local-name($node)='guimenuitem'
1210 or local-name($node)='guisubmenu'">
1211 <xsl:value-of select=
"$menuchoice.menu.separator"/>
1214 <xsl:value-of select=
"$menuchoice.separator"/>
1217 <xsl:apply-templates select=
"$node"/>
1218 <xsl:call-template name=
"process.menuchoice">
1219 <xsl:with-param name=
"nodelist" select=
"$nodelist"/>
1220 <xsl:with-param name=
"count" select=
"$count+1"/>
1221 </xsl:call-template>
1226 <!-- ==================================================================== -->
1228 <xsl:template match=
"optional">
1229 <xsl:value-of select=
"$arg.choice.opt.open.str"/>
1230 <xsl:call-template name=
"inline.charseq"/>
1231 <xsl:value-of select=
"$arg.choice.opt.close.str"/>
1234 <xsl:template match=
"citation">
1235 <!-- todo: integrate with bibliography collection -->
1236 <xsl:variable name=
"targets" select=
"(//biblioentry | //bibliomixed)[abbrev = string(current())]"/>
1237 <xsl:variable name=
"target" select=
"$targets[1]"/>
1240 <!-- try automatic linking based on match to abbrev -->
1241 <xsl:when test=
"$target and not(xref) and not(link)">
1243 <xsl:text>[
</xsl:text>
1245 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1246 <xsl:attribute name=
"href">
1247 <xsl:call-template name=
"href.target">
1248 <xsl:with-param name=
"object" select=
"$target"/>
1249 </xsl:call-template>
1252 <xsl:call-template name=
"inline.charseq"/>
1254 <xsl:text>]
</xsl:text>
1257 <xsl:text>[
</xsl:text>
1258 <xsl:call-template name=
"inline.charseq"/>
1259 <xsl:text>]
</xsl:text>
1264 <!-- ==================================================================== -->
1266 <xsl:template match=
"comment[&comment.block.parents;]|remark[&comment.block.parents;]">
1267 <xsl:if test=
"$show.comments != 0">
1268 <p class=
"remark"><i><xsl:call-template name=
"inline.charseq"/></i></p>
1272 <xsl:template match=
"comment|remark">
1273 <xsl:if test=
"$show.comments != 0">
1274 <em><xsl:call-template name=
"inline.charseq"/></em>
1278 <!-- ==================================================================== -->
1280 <xsl:template match=
"productname">
1281 <xsl:call-template name=
"inline.charseq"/>
1282 <xsl:if test=
"@class">
1283 <xsl:call-template name=
"dingbat">
1284 <xsl:with-param name=
"dingbat" select=
"@class"/>
1285 </xsl:call-template>
1289 <xsl:template match=
"productnumber">
1290 <xsl:call-template name=
"inline.charseq"/>
1293 <!-- ==================================================================== -->
1295 <xsl:template match=
"pob|street|city|state|postcode|country|otheraddr">
1296 <xsl:call-template name=
"inline.charseq"/>
1299 <xsl:template match=
"phone|fax">
1300 <xsl:call-template name=
"inline.charseq"/>
1303 <!-- in Addresses, for example -->
1304 <xsl:template match=
"honorific|firstname|surname|lineage|othername">
1305 <xsl:call-template name=
"inline.charseq"/>
1308 <!-- ==================================================================== -->
1310 <xsl:template match=
"person">
1311 <xsl:param name=
"content">
1312 <xsl:call-template name=
"anchor"/>
1313 <xsl:call-template name=
"simple.xlink">
1314 <xsl:with-param name=
"content">
1315 <xsl:apply-templates select=
"personname"/>
1317 </xsl:call-template>
1318 <xsl:call-template name=
"apply-annotations"/>
1322 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1323 <xsl:copy-of select=
"$content"/>
1327 <xsl:template match=
"personname">
1328 <xsl:param name=
"content">
1329 <xsl:call-template name=
"anchor"/>
1330 <xsl:call-template name=
"simple.xlink">
1331 <xsl:with-param name=
"content">
1332 <xsl:call-template name=
"person.name"/>
1334 </xsl:call-template>
1335 <xsl:call-template name=
"apply-annotations"/>
1339 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1340 <xsl:copy-of select=
"$content"/>
1344 <!-- ==================================================================== -->
1346 <xsl:template match=
"org">
1347 <xsl:param name=
"content">
1348 <xsl:call-template name=
"anchor"/>
1349 <xsl:call-template name=
"simple.xlink">
1350 <xsl:with-param name=
"content">
1351 <xsl:apply-templates/>
1353 </xsl:call-template>
1354 <xsl:call-template name=
"apply-annotations"/>
1358 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1359 <xsl:copy-of select=
"$content"/>
1363 <xsl:template match=
"orgname">
1364 <xsl:param name=
"content">
1365 <xsl:call-template name=
"anchor"/>
1366 <xsl:call-template name=
"simple.xlink">
1367 <xsl:with-param name=
"content">
1368 <xsl:apply-templates/>
1370 </xsl:call-template>
1371 <xsl:call-template name=
"apply-annotations"/>
1375 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1376 <xsl:copy-of select=
"$content"/>
1380 <xsl:template match=
"orgdiv">
1381 <xsl:param name=
"content">
1382 <xsl:call-template name=
"anchor"/>
1383 <xsl:call-template name=
"simple.xlink">
1384 <xsl:with-param name=
"content">
1385 <xsl:apply-templates/>
1387 </xsl:call-template>
1388 <xsl:call-template name=
"apply-annotations"/>
1392 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1393 <xsl:copy-of select=
"$content"/>
1397 <xsl:template match=
"affiliation">
1398 <xsl:param name=
"content">
1399 <xsl:call-template name=
"anchor"/>
1400 <xsl:call-template name=
"simple.xlink">
1401 <xsl:with-param name=
"content">
1402 <xsl:call-template name=
"person.name"/>
1404 </xsl:call-template>
1405 <xsl:call-template name=
"apply-annotations"/>
1409 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
1410 <xsl:copy-of select=
"$content"/>
1414 <!-- ==================================================================== -->
1416 <xsl:template match=
"beginpage">
1417 <!-- does nothing; this *is not* markup to force a page break. -->