2 <!DOCTYPE xsl:stylesheet [
3 <!ENTITY % common.entities SYSTEM "../common/entities.ent">
6 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:xlink='http://www.w3.org/1999/xlink'
8 xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
9 exclude-result-prefixes="xlink suwl"
12 <!-- ********************************************************************
13 $Id: inline.xsl 8811 2010-08-09 20:24:45Z mzjn $
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 <xsl:key name="glossentries" match="glossentry" use="normalize-space(glossterm)"/>
23 <xsl:key name="glossentries" match="glossentry" use="normalize-space(glossterm/@baseform)"/>
25 <xsl:template name="simple.xlink">
26 <xsl:param name="node" select="."/>
27 <xsl:param name="content">
28 <xsl:apply-templates/>
30 <xsl:param name="linkend" select="$node/@linkend"/>
31 <xsl:param name="xhref" select="$node/@xlink:href"/>
33 <!-- Support for @xlink:show -->
34 <xsl:variable name="target.show">
36 <xsl:when test="$node/@xlink:show = 'new'">_blank</xsl:when>
37 <xsl:when test="$node/@xlink:show = 'replace'">_top</xsl:when>
38 <xsl:otherwise></xsl:otherwise>
42 <xsl:variable name="link">
44 <xsl:when test="$xhref and
45 (not($node/@xlink:type) or
46 $node/@xlink:type='simple')">
48 <!-- Is it a local idref or a uri? -->
49 <xsl:variable name="is.idref">
51 <!-- if the href starts with # and does not contain an "(" -->
52 <!-- or if the href starts with #xpointer(id(, it's just an ID -->
53 <xsl:when test="starts-with($xhref,'#')
54 and (not(contains($xhref,'('))
55 or starts-with($xhref,
56 '#xpointer(id('))">1</xsl:when>
57 <xsl:otherwise>0</xsl:otherwise>
61 <!-- Is it an olink ? -->
62 <xsl:variable name="is.olink">
64 <!-- If xlink:role="http://docbook.org/xlink/role/olink" -->
65 <!-- and if the href contains # -->
66 <xsl:when test="contains($xhref,'#') and
67 @xlink:role = $xolink.role">1</xsl:when>
68 <xsl:otherwise>0</xsl:otherwise>
73 <xsl:when test="$is.olink = 1">
74 <xsl:call-template name="olink">
75 <xsl:with-param name="content" select="$content"/>
79 <xsl:when test="$is.idref = 1">
81 <xsl:variable name="idref">
82 <xsl:call-template name="xpointer.idref">
83 <xsl:with-param name="xpointer" select="$xhref"/>
87 <xsl:variable name="targets" select="key('id',$idref)"/>
88 <xsl:variable name="target" select="$targets[1]"/>
90 <xsl:call-template name="check.id.unique">
91 <xsl:with-param name="linkend" select="$idref"/>
95 <xsl:when test="count($target) = 0">
97 <xsl:text>XLink to nonexistent id: </xsl:text>
98 <xsl:value-of select="$idref"/>
100 <xsl:copy-of select="$content"/>
105 <xsl:apply-templates select="." mode="common.html.attributes"/>
107 <xsl:attribute name="href">
108 <xsl:call-template name="href.target">
109 <xsl:with-param name="object" select="$target"/>
114 <xsl:when test="$node/@xlink:title">
115 <xsl:attribute name="title">
116 <xsl:value-of select="$node/@xlink:title"/>
120 <xsl:apply-templates select="$target"
121 mode="html.title.attribute"/>
125 <xsl:if test="$target.show !=''">
126 <xsl:attribute name="target">
127 <xsl:value-of select="$target.show"/>
131 <xsl:copy-of select="$content"/>
138 <!-- otherwise it's a URI -->
141 <xsl:apply-templates select="." mode="common.html.attributes"/>
142 <xsl:attribute name="href">
143 <xsl:value-of select="$xhref"/>
145 <xsl:if test="$node/@xlink:title">
146 <xsl:attribute name="title">
147 <xsl:value-of select="$node/@xlink:title"/>
151 <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target -->
153 <xsl:when test="$target.show !=''">
154 <xsl:attribute name="target">
155 <xsl:value-of select="$target.show"/>
158 <xsl:when test="$ulink.target !=''">
159 <xsl:attribute name="target">
160 <xsl:value-of select="$ulink.target"/>
165 <xsl:copy-of select="$content"/>
171 <xsl:when test="$linkend">
172 <xsl:variable name="targets" select="key('id',$linkend)"/>
173 <xsl:variable name="target" select="$targets[1]"/>
175 <xsl:call-template name="check.id.unique">
176 <xsl:with-param name="linkend" select="$linkend"/>
180 <xsl:apply-templates select="." mode="common.html.attributes"/>
181 <xsl:attribute name="href">
182 <xsl:call-template name="href.target">
183 <xsl:with-param name="object" select="$target"/>
187 <xsl:apply-templates select="$target" mode="html.title.attribute"/>
189 <xsl:copy-of select="$content"/>
194 <xsl:copy-of select="$content"/>
200 <xsl:when test="function-available('suwl:unwrapLinks')">
201 <xsl:copy-of select="suwl:unwrapLinks($link)"/>
204 <xsl:copy-of select="$link"/>
209 <xsl:template name="inline.charseq">
210 <xsl:param name="content">
211 <xsl:call-template name="anchor"/>
212 <xsl:call-template name="simple.xlink">
213 <xsl:with-param name="content">
214 <xsl:apply-templates/>
218 <!-- * if you want output from the inline.charseq template wrapped in -->
219 <!-- * something other than a Span, call the template with some value -->
220 <!-- * for the 'wrapper-name' param -->
221 <xsl:param name="wrapper-name">span</xsl:param>
222 <xsl:element name="{$wrapper-name}">
223 <xsl:attribute name="class">
224 <xsl:value-of select="local-name(.)"/>
226 <xsl:call-template name="dir"/>
227 <xsl:call-template name="generate.html.title"/>
228 <xsl:copy-of select="$content"/>
229 <xsl:call-template name="apply-annotations"/>
233 <xsl:template name="inline.monoseq">
234 <xsl:param name="content">
235 <xsl:call-template name="anchor"/>
236 <xsl:call-template name="simple.xlink">
237 <xsl:with-param name="content">
238 <xsl:apply-templates/>
243 <xsl:apply-templates select="." mode="common.html.attributes"/>
244 <xsl:copy-of select="$content"/>
245 <xsl:call-template name="apply-annotations"/>
249 <xsl:template name="inline.boldseq">
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/>
260 <xsl:apply-templates select="." mode="common.html.attributes"/>
262 <!-- don't put <strong> inside figure, example, or table titles -->
264 <xsl:when test="local-name(..) = 'title'
265 and (local-name(../..) = 'figure'
266 or local-name(../..) = 'example'
267 or local-name(../..) = 'table')">
268 <xsl:copy-of select="$content"/>
272 <xsl:copy-of select="$content"/>
276 <xsl:call-template name="apply-annotations"/>
280 <xsl:template name="inline.italicseq">
281 <xsl:param name="content">
282 <xsl:call-template name="anchor"/>
283 <xsl:call-template name="simple.xlink">
284 <xsl:with-param name="content">
285 <xsl:apply-templates/>
290 <xsl:call-template name="common.html.attributes"/>
291 <xsl:copy-of select="$content"/>
292 <xsl:call-template name="apply-annotations"/>
296 <xsl:template name="inline.boldmonoseq">
297 <xsl:param name="content">
298 <xsl:call-template name="anchor"/>
299 <xsl:call-template name="simple.xlink">
300 <xsl:with-param name="content">
301 <xsl:apply-templates/>
305 <!-- don't put <strong> inside figure, example, or table titles -->
306 <!-- or other titles that may already be represented with <strong>'s. -->
308 <xsl:when test="local-name(..) = 'title'
309 and (local-name(../..) = 'figure'
310 or local-name(../..) = 'example'
311 or local-name(../..) = 'table'
312 or local-name(../..) = 'formalpara')">
314 <xsl:call-template name="common.html.attributes"/>
315 <xsl:copy-of select="$content"/>
316 <xsl:call-template name="apply-annotations"/>
321 <xsl:call-template name="common.html.attributes"/>
323 <xsl:call-template name="generate.html.title"/>
324 <xsl:call-template name="dir"/>
325 <xsl:copy-of select="$content"/>
327 <xsl:call-template name="apply-annotations"/>
333 <xsl:template name="inline.italicmonoseq">
334 <xsl:param name="content">
335 <xsl:call-template name="anchor"/>
336 <xsl:call-template name="simple.xlink">
337 <xsl:with-param name="content">
338 <xsl:apply-templates/>
343 <xsl:call-template name="common.html.attributes"/>
345 <xsl:call-template name="generate.html.title"/>
346 <xsl:call-template name="dir"/>
347 <xsl:copy-of select="$content"/>
348 <xsl:call-template name="apply-annotations"/>
353 <xsl:template name="inline.superscriptseq">
354 <xsl:param name="content">
355 <xsl:call-template name="anchor"/>
356 <xsl:call-template name="simple.xlink">
357 <xsl:with-param name="content">
358 <xsl:apply-templates/>
363 <xsl:call-template name="generate.html.title"/>
364 <xsl:call-template name="dir"/>
365 <xsl:copy-of select="$content"/>
366 <xsl:call-template name="apply-annotations"/>
370 <xsl:template name="inline.subscriptseq">
371 <xsl:param name="content">
372 <xsl:call-template name="anchor"/>
373 <xsl:call-template name="simple.xlink">
374 <xsl:with-param name="content">
375 <xsl:apply-templates/>
380 <xsl:call-template name="generate.html.title"/>
381 <xsl:call-template name="dir"/>
382 <xsl:copy-of select="$content"/>
383 <xsl:call-template name="apply-annotations"/>
387 <!-- ==================================================================== -->
388 <!-- some special cases -->
390 <xsl:template match="author">
391 <xsl:param name="content">
392 <xsl:call-template name="anchor"/>
393 <xsl:call-template name="simple.xlink">
394 <xsl:with-param name="content">
395 <xsl:call-template name="person.name"/>
398 <xsl:call-template name="apply-annotations"/>
402 <xsl:call-template name="common.html.attributes"/>
403 <xsl:copy-of select="$content"/>
407 <xsl:template match="editor">
408 <xsl:param name="content">
409 <xsl:call-template name="anchor"/>
410 <xsl:call-template name="simple.xlink">
411 <xsl:with-param name="content">
412 <xsl:call-template name="person.name"/>
415 <xsl:call-template name="apply-annotations"/>
419 <xsl:call-template name="common.html.attributes"/>
420 <xsl:copy-of select="$content"/>
424 <xsl:template match="othercredit">
425 <xsl:param name="content">
426 <xsl:call-template name="anchor"/>
427 <xsl:call-template name="simple.xlink">
428 <xsl:with-param name="content">
429 <xsl:call-template name="person.name"/>
432 <xsl:call-template name="apply-annotations"/>
436 <xsl:call-template name="common.html.attributes"/>
437 <xsl:copy-of select="$content"/>
441 <xsl:template match="authorinitials">
442 <xsl:call-template name="inline.charseq"/>
445 <!-- ==================================================================== -->
447 <xsl:template match="accel">
448 <xsl:call-template name="inline.charseq"/>
451 <xsl:template match="action">
452 <xsl:call-template name="inline.charseq"/>
455 <xsl:template match="application">
456 <xsl:call-template name="inline.charseq"/>
459 <xsl:template match="classname">
460 <xsl:call-template name="inline.monoseq"/>
463 <xsl:template match="exceptionname">
464 <xsl:call-template name="inline.monoseq"/>
467 <xsl:template match="interfacename">
468 <xsl:call-template name="inline.monoseq"/>
471 <xsl:template match="methodname">
472 <xsl:call-template name="inline.monoseq"/>
475 <xsl:template match="command">
476 <xsl:call-template name="inline.boldseq"/>
479 <xsl:template match="computeroutput">
480 <xsl:call-template name="inline.monoseq"/>
483 <xsl:template match="constant">
484 <xsl:call-template name="inline.monoseq"/>
487 <xsl:template match="database">
488 <xsl:call-template name="inline.charseq"/>
491 <xsl:template match="date">
492 <!-- should this support locale-specific formatting? how? -->
493 <xsl:call-template name="inline.charseq"/>
496 <xsl:template match="errorcode">
497 <xsl:call-template name="inline.charseq"/>
500 <xsl:template match="errorname">
501 <xsl:call-template name="inline.charseq"/>
504 <xsl:template match="errortype">
505 <xsl:call-template name="inline.charseq"/>
508 <xsl:template match="errortext">
509 <xsl:call-template name="inline.charseq"/>
512 <xsl:template match="envar">
513 <xsl:call-template name="inline.monoseq"/>
516 <xsl:template match="filename">
517 <xsl:call-template name="inline.monoseq"/>
520 <xsl:template match="function">
522 <xsl:when test="$function.parens != '0'
523 and (parameter or function or replaceable)">
524 <xsl:variable name="nodes" select="text()|*"/>
525 <xsl:call-template name="inline.monoseq">
526 <xsl:with-param name="content">
527 <xsl:call-template name="simple.xlink">
528 <xsl:with-param name="content">
529 <xsl:apply-templates select="$nodes[1]"/>
534 <xsl:text>(</xsl:text>
535 <xsl:apply-templates select="$nodes[position()>1]"/>
536 <xsl:text>)</xsl:text>
539 <xsl:call-template name="inline.monoseq"/>
544 <xsl:template match="function/parameter" priority="2">
545 <xsl:call-template name="inline.italicmonoseq"/>
546 <xsl:if test="following-sibling::*">
547 <xsl:text>, </xsl:text>
551 <xsl:template match="function/replaceable" priority="2">
552 <xsl:call-template name="inline.italicmonoseq"/>
553 <xsl:if test="following-sibling::*">
554 <xsl:text>, </xsl:text>
558 <xsl:template match="guibutton">
559 <xsl:call-template name="inline.charseq"/>
562 <xsl:template match="guiicon">
563 <xsl:call-template name="inline.charseq"/>
566 <xsl:template match="guilabel">
567 <xsl:call-template name="inline.charseq"/>
570 <xsl:template match="guimenu">
571 <xsl:call-template name="inline.charseq"/>
574 <xsl:template match="guimenuitem">
575 <xsl:call-template name="inline.charseq"/>
578 <xsl:template match="guisubmenu">
579 <xsl:call-template name="inline.charseq"/>
582 <xsl:template match="hardware">
583 <xsl:call-template name="inline.charseq"/>
586 <xsl:template match="interface">
587 <xsl:call-template name="inline.charseq"/>
590 <xsl:template match="interfacedefinition">
591 <xsl:call-template name="inline.charseq"/>
594 <xsl:template match="keycap">
595 <xsl:call-template name="inline.boldseq"/>
598 <xsl:template match="keycode">
599 <xsl:call-template name="inline.charseq"/>
602 <xsl:template match="keysym">
603 <xsl:call-template name="inline.charseq"/>
606 <xsl:template match="literal">
607 <xsl:call-template name="inline.monoseq"/>
610 <xsl:template match="code">
611 <xsl:call-template name="inline.monoseq"/>
614 <xsl:template match="medialabel">
615 <xsl:call-template name="inline.italicseq"/>
618 <xsl:template match="shortcut">
619 <xsl:call-template name="inline.boldseq"/>
622 <xsl:template match="mousebutton">
623 <xsl:call-template name="inline.charseq"/>
626 <xsl:template match="option">
627 <xsl:call-template name="inline.monoseq"/>
630 <xsl:template match="package">
631 <xsl:call-template name="inline.charseq"/>
634 <xsl:template match="parameter">
635 <xsl:call-template name="inline.italicmonoseq"/>
638 <xsl:template match="property">
639 <xsl:call-template name="inline.charseq"/>
642 <xsl:template match="prompt">
643 <xsl:call-template name="inline.monoseq"/>
646 <xsl:template match="replaceable" priority="1">
647 <xsl:call-template name="inline.italicmonoseq"/>
650 <xsl:template match="returnvalue">
651 <xsl:call-template name="inline.charseq"/>
654 <xsl:template match="structfield">
655 <xsl:call-template name="inline.italicmonoseq"/>
658 <xsl:template match="structname">
659 <xsl:call-template name="inline.charseq"/>
662 <xsl:template match="symbol">
663 <xsl:call-template name="inline.charseq"/>
666 <xsl:template match="systemitem">
667 <xsl:call-template name="inline.monoseq"/>
670 <xsl:template match="token">
671 <xsl:call-template name="inline.charseq"/>
674 <xsl:template match="type">
675 <xsl:call-template name="inline.charseq"/>
678 <xsl:template match="userinput">
679 <xsl:call-template name="inline.boldmonoseq"/>
682 <xsl:template match="abbrev">
683 <xsl:call-template name="inline.charseq">
684 <xsl:with-param name="wrapper-name">abbr</xsl:with-param>
688 <xsl:template match="acronym">
689 <xsl:call-template name="inline.charseq">
690 <xsl:with-param name="wrapper-name">acronym</xsl:with-param>
694 <xsl:template match="citerefentry">
696 <xsl:when test="$citerefentry.link != '0'">
698 <xsl:apply-templates select="." mode="common.html.attributes"/>
699 <xsl:attribute name="href">
700 <xsl:call-template name="generate.citerefentry.link"/>
702 <xsl:call-template name="inline.charseq"/>
706 <xsl:call-template name="inline.charseq"/>
711 <xsl:template name="generate.citerefentry.link">
715 <xsl:template name="x.generate.citerefentry.link">
716 <xsl:text>http://example.com/cgi-bin/man.cgi?</xsl:text>
717 <xsl:value-of select="refentrytitle"/>
718 <xsl:text>(</xsl:text>
719 <xsl:value-of select="manvolnum"/>
720 <xsl:text>)</xsl:text>
723 <xsl:template match="citetitle">
725 <xsl:when test="@pubwork = 'article'">
726 <xsl:call-template name="gentext.startquote"/>
727 <xsl:call-template name="inline.charseq"/>
728 <xsl:call-template name="gentext.endquote"/>
731 <xsl:call-template name="inline.italicseq"/>
736 <xsl:template match="emphasis">
739 <!-- We don't want empty @class values, so do not propagate empty @roles -->
740 <xsl:when test="@role and
741 normalize-space(@role) != '' and
742 $emphasis.propagates.style != 0">
743 <xsl:apply-templates select="." mode="common.html.attributes">
744 <xsl:with-param name="class" select="@role"/>
745 </xsl:apply-templates>
748 <xsl:apply-templates select="." mode="common.html.attributes"/>
751 <xsl:call-template name="anchor"/>
753 <xsl:call-template name="simple.xlink">
754 <xsl:with-param name="content">
756 <xsl:when test="@role = 'bold' or @role='strong'">
757 <!-- backwards compatibility: make bold into b elements, but -->
758 <!-- don't put bold inside figure, example, or table titles -->
760 <xsl:when test="local-name(..) = 'title'
761 and (local-name(../..) = 'figure'
762 or local-name(../..) = 'example'
763 or local-name(../..) = 'table')">
764 <xsl:apply-templates/>
767 <strong><xsl:apply-templates/></strong>
771 <xsl:when test="@role and $emphasis.propagates.style != 0">
772 <xsl:apply-templates/>
775 <em><xsl:apply-templates/></em>
783 <xsl:template match="foreignphrase">
785 <xsl:apply-templates select="." mode="common.html.attributes"/>
786 <xsl:call-template name="inline.italicseq"/>
790 <xsl:template match="markup">
791 <xsl:call-template name="inline.charseq"/>
794 <xsl:template match="phrase">
796 <xsl:call-template name="locale.html.attributes"/>
797 <!-- We don't want empty @class values, so do not propagate empty @roles -->
798 <xsl:if test="@role and
799 normalize-space(@role) != '' and
800 $phrase.propagates.style != 0">
801 <xsl:apply-templates select="." mode="class.attribute">
802 <xsl:with-param name="class" select="@role"/>
803 </xsl:apply-templates>
805 <xsl:call-template name="dir"/>
806 <xsl:call-template name="anchor"/>
807 <xsl:call-template name="simple.xlink">
808 <xsl:with-param name="content">
809 <xsl:apply-templates/>
812 <xsl:call-template name="apply-annotations"/>
816 <xsl:template match="quote">
817 <xsl:variable name="depth">
818 <xsl:call-template name="dot.count">
819 <xsl:with-param name="string">
820 <xsl:number level="multiple"/>
825 <xsl:apply-templates select="." mode="common.html.attributes"/>
826 <xsl:call-template name="anchor"/>
828 <xsl:when test="$depth mod 2 = 0">
829 <xsl:call-template name="gentext.startquote"/>
830 <xsl:call-template name="inline.charseq"/>
831 <xsl:call-template name="gentext.endquote"/>
834 <xsl:call-template name="gentext.nestedstartquote"/>
835 <xsl:call-template name="inline.charseq"/>
836 <xsl:call-template name="gentext.nestedendquote"/>
842 <xsl:template match="varname">
843 <xsl:call-template name="inline.monoseq"/>
846 <xsl:template match="wordasword">
847 <xsl:call-template name="inline.italicseq"/>
850 <xsl:template match="lineannotation">
852 <xsl:apply-templates select="." mode="common.html.attributes"/>
853 <xsl:call-template name="inline.charseq"/>
857 <xsl:template match="superscript">
858 <xsl:call-template name="inline.superscriptseq"/>
861 <xsl:template match="subscript">
862 <xsl:call-template name="inline.subscriptseq"/>
865 <xsl:template match="trademark">
866 <xsl:call-template name="inline.charseq"/>
868 <xsl:when test="@class = 'copyright'
869 or @class = 'registered'">
870 <xsl:call-template name="dingbat">
871 <xsl:with-param name="dingbat" select="@class"/>
874 <xsl:when test="@class = 'service'">
878 <xsl:call-template name="dingbat">
879 <xsl:with-param name="dingbat" select="'trademark'"/>
885 <xsl:template match="firstterm">
886 <xsl:call-template name="glossterm">
887 <xsl:with-param name="firstterm" select="1"/>
891 <xsl:template match="glossterm" name="glossterm">
892 <xsl:param name="firstterm" select="0"/>
894 <!-- To avoid extra <a name=""> anchor from inline.italicseq -->
895 <xsl:variable name="content">
896 <xsl:apply-templates/>
900 <xsl:when test="($firstterm.only.link = 0 or $firstterm = 1) and @linkend">
901 <xsl:variable name="targets" select="key('id',@linkend)"/>
902 <xsl:variable name="target" select="$targets[1]"/>
904 <xsl:call-template name="check.id.unique">
905 <xsl:with-param name="linkend" select="@linkend"/>
909 <xsl:when test="$target">
911 <xsl:apply-templates select="." mode="common.html.attributes"/>
912 <xsl:if test="@id or @xml:id">
913 <xsl:attribute name="name">
914 <xsl:value-of select="(@id|@xml:id)[1]"/>
918 <xsl:attribute name="href">
919 <xsl:call-template name="href.target">
920 <xsl:with-param name="object" select="$target"/>
924 <xsl:call-template name="inline.italicseq">
925 <xsl:with-param name="content" select="$content"/>
930 <xsl:call-template name="inline.italicseq">
931 <xsl:with-param name="content" select="$content"/>
937 <xsl:when test="not(@linkend)
938 and ($firstterm.only.link = 0 or $firstterm = 1)
939 and ($glossterm.auto.link != 0)
940 and $glossary.collection != ''">
941 <xsl:variable name="term">
943 <xsl:when test="@baseform"><xsl:value-of select="@baseform"/></xsl:when>
944 <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
948 <xsl:variable name="cterm"
949 select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
951 <!-- HACK HACK HACK! But it works... -->
952 <!-- You'd need to do more work if you wanted to chunk on glossdiv, though -->
954 <xsl:variable name="glossary" select="//glossary[@role='auto']"/>
956 <xsl:if test="count($glossary) != 1">
958 <xsl:text>Warning: glossary.collection specified, but there are </xsl:text>
959 <xsl:value-of select="count($glossary)"/>
960 <xsl:text> automatic glossaries</xsl:text>
964 <xsl:variable name="glosschunk">
965 <xsl:call-template name="href.target">
966 <xsl:with-param name="object" select="$glossary"/>
970 <xsl:variable name="chunkbase">
972 <xsl:when test="contains($glosschunk, '#')">
973 <xsl:value-of select="substring-before($glosschunk, '#')"/>
976 <xsl:value-of select="$glosschunk"/>
982 <xsl:when test="not($cterm)">
984 <xsl:text>There's no entry for </xsl:text>
985 <xsl:value-of select="$term"/>
986 <xsl:text> in </xsl:text>
987 <xsl:value-of select="$glossary.collection"/>
989 <xsl:call-template name="inline.italicseq"/>
992 <xsl:variable name="id">
993 <xsl:call-template name="object.id">
994 <xsl:with-param name="object" select="$cterm"/>
997 <a href="{$chunkbase}#{$id}">
998 <xsl:apply-templates select="." mode="common.html.attributes"/>
999 <xsl:call-template name="inline.italicseq">
1000 <xsl:with-param name="content" select="$content"/>
1001 </xsl:call-template>
1007 <xsl:when test="not(@linkend)
1008 and ($firstterm.only.link = 0 or $firstterm = 1)
1009 and $glossterm.auto.link != 0">
1010 <xsl:variable name="term">
1012 <xsl:when test="@baseform">
1013 <xsl:value-of select="normalize-space(@baseform)"/>
1016 <xsl:value-of select="normalize-space(.)"/>
1020 <xsl:variable name="targets"
1021 select="key('glossentries', $term)"/>
1022 <xsl:variable name="target" select="$targets[1]"/>
1025 <xsl:when test="count($targets)=0">
1027 <xsl:text>Error: no glossentry for glossterm: </xsl:text>
1028 <xsl:value-of select="."/>
1029 <xsl:text>.</xsl:text>
1031 <xsl:call-template name="inline.italicseq"/>
1035 <xsl:apply-templates select="." mode="common.html.attributes"/>
1036 <xsl:if test="@id or @xml:id">
1037 <xsl:attribute name="name">
1038 <xsl:value-of select="(@id|@xml:id)[1]"/>
1042 <xsl:attribute name="href">
1043 <xsl:call-template name="href.target">
1044 <xsl:with-param name="object" select="$target"/>
1045 </xsl:call-template>
1048 <xsl:call-template name="inline.italicseq">
1049 <xsl:with-param name="content" select="$content"/>
1050 </xsl:call-template>
1057 <xsl:call-template name="inline.italicseq"/>
1062 <xsl:template match="termdef">
1064 <xsl:apply-templates select="." mode="common.html.attributes"/>
1065 <xsl:call-template name="gentext.template">
1066 <xsl:with-param name="context" select="'termdef'"/>
1067 <xsl:with-param name="name" select="'prefix'"/>
1068 </xsl:call-template>
1069 <xsl:apply-templates/>
1070 <xsl:call-template name="gentext.template">
1071 <xsl:with-param name="context" select="'termdef'"/>
1072 <xsl:with-param name="name" select="'suffix'"/>
1073 </xsl:call-template>
1077 <xsl:template match="sgmltag|tag">
1078 <xsl:call-template name="format.sgmltag"/>
1081 <xsl:template name="format.sgmltag">
1082 <xsl:param name="class">
1084 <xsl:when test="@class">
1085 <xsl:value-of select="@class"/>
1087 <xsl:otherwise>element</xsl:otherwise>
1091 <xsl:variable name="content">
1093 <xsl:when test="$class='attribute'">
1094 <xsl:apply-templates/>
1096 <xsl:when test="$class='attvalue'">
1097 <xsl:apply-templates/>
1099 <xsl:when test="$class='element'">
1100 <xsl:apply-templates/>
1102 <xsl:when test="$class='endtag'">
1103 <xsl:text></</xsl:text>
1104 <xsl:apply-templates/>
1105 <xsl:text>></xsl:text>
1107 <xsl:when test="$class='genentity'">
1108 <xsl:text>&</xsl:text>
1109 <xsl:apply-templates/>
1110 <xsl:text>;</xsl:text>
1112 <xsl:when test="$class='numcharref'">
1113 <xsl:text>&#</xsl:text>
1114 <xsl:apply-templates/>
1115 <xsl:text>;</xsl:text>
1117 <xsl:when test="$class='paramentity'">
1118 <xsl:text>%</xsl:text>
1119 <xsl:apply-templates/>
1120 <xsl:text>;</xsl:text>
1122 <xsl:when test="$class='pi'">
1123 <xsl:text><?</xsl:text>
1124 <xsl:apply-templates/>
1125 <xsl:text>></xsl:text>
1127 <xsl:when test="$class='xmlpi'">
1128 <xsl:text><?</xsl:text>
1129 <xsl:apply-templates/>
1130 <xsl:text>?></xsl:text>
1132 <xsl:when test="$class='starttag'">
1133 <xsl:text><</xsl:text>
1134 <xsl:apply-templates/>
1135 <xsl:text>></xsl:text>
1137 <xsl:when test="$class='emptytag'">
1138 <xsl:text><</xsl:text>
1139 <xsl:apply-templates/>
1140 <xsl:text>/></xsl:text>
1142 <xsl:when test="$class='sgmlcomment' or $class='comment'">
1143 <xsl:text><!--</xsl:text>
1144 <xsl:apply-templates/>
1145 <xsl:text>--></xsl:text>
1148 <xsl:apply-templates/>
1154 <xsl:apply-templates select="." mode="common.html.attributes">
1155 <xsl:with-param name="class" select="concat('sgmltag-', $class)"/>
1156 </xsl:apply-templates>
1157 <xsl:call-template name="simple.xlink">
1158 <xsl:with-param name="content" select="$content"/>
1159 </xsl:call-template>
1163 <xsl:template match="email">
1164 <xsl:call-template name="inline.monoseq">
1165 <xsl:with-param name="content">
1166 <xsl:if test="not($email.delimiters.enabled = 0)">
1167 <xsl:text><</xsl:text>
1170 <xsl:apply-templates select="." mode="common.html.attributes"/>
1171 <xsl:attribute name="href">
1172 <xsl:text>mailto:</xsl:text>
1173 <xsl:value-of select="."/>
1175 <xsl:apply-templates/>
1177 <xsl:if test="not($email.delimiters.enabled = 0)">
1178 <xsl:text>></xsl:text>
1181 </xsl:call-template>
1184 <xsl:template match="keycombo">
1185 <xsl:variable name="action" select="@action"/>
1186 <xsl:variable name="joinchar">
1188 <xsl:when test="$action='seq'"><xsl:text> </xsl:text></xsl:when>
1189 <xsl:when test="$action='simul'">+</xsl:when>
1190 <xsl:when test="$action='press'">-</xsl:when>
1191 <xsl:when test="$action='click'">-</xsl:when>
1192 <xsl:when test="$action='double-click'">-</xsl:when>
1193 <xsl:when test="$action='other'"></xsl:when>
1194 <xsl:otherwise>+</xsl:otherwise>
1197 <xsl:for-each select="*">
1198 <xsl:if test="position()>1"><xsl:value-of select="$joinchar"/></xsl:if>
1199 <xsl:apply-templates select="."/>
1203 <xsl:template match="uri">
1204 <xsl:call-template name="inline.monoseq"/>
1207 <!-- ==================================================================== -->
1209 <xsl:template match="menuchoice">
1210 <xsl:variable name="shortcut" select="./shortcut"/>
1211 <xsl:call-template name="process.menuchoice"/>
1212 <xsl:if test="$shortcut">
1213 <xsl:text> (</xsl:text>
1214 <xsl:apply-templates select="$shortcut"/>
1215 <xsl:text>)</xsl:text>
1219 <xsl:template name="process.menuchoice">
1220 <xsl:param name="nodelist" select="guibutton|guiicon|guilabel|guimenu|guimenuitem|guisubmenu|interface"/><!-- not(shortcut) -->
1221 <xsl:param name="count" select="1"/>
1224 <xsl:when test="$count>count($nodelist)"></xsl:when>
1225 <xsl:when test="$count=1">
1226 <xsl:apply-templates select="$nodelist[$count=position()]"/>
1227 <xsl:call-template name="process.menuchoice">
1228 <xsl:with-param name="nodelist" select="$nodelist"/>
1229 <xsl:with-param name="count" select="$count+1"/>
1230 </xsl:call-template>
1233 <xsl:variable name="node" select="$nodelist[$count=position()]"/>
1235 <xsl:when test="local-name($node)='guimenuitem'
1236 or local-name($node)='guisubmenu'">
1237 <xsl:value-of select="$menuchoice.menu.separator"/>
1240 <xsl:value-of select="$menuchoice.separator"/>
1243 <xsl:apply-templates select="$node"/>
1244 <xsl:call-template name="process.menuchoice">
1245 <xsl:with-param name="nodelist" select="$nodelist"/>
1246 <xsl:with-param name="count" select="$count+1"/>
1247 </xsl:call-template>
1252 <!-- ==================================================================== -->
1254 <xsl:template match="optional">
1255 <xsl:value-of select="$arg.choice.opt.open.str"/>
1256 <xsl:call-template name="inline.charseq"/>
1257 <xsl:value-of select="$arg.choice.opt.close.str"/>
1260 <xsl:template match="citation">
1261 <!-- todo: integrate with bibliography collection -->
1262 <xsl:variable name="targets" select="(//biblioentry | //bibliomixed)[abbrev = string(current())]"/>
1263 <xsl:variable name="target" select="$targets[1]"/>
1266 <!-- try automatic linking based on match to abbrev -->
1267 <xsl:when test="$target and not(xref) and not(link)">
1269 <xsl:text>[</xsl:text>
1271 <xsl:apply-templates select="." mode="common.html.attributes"/>
1272 <xsl:attribute name="href">
1273 <xsl:call-template name="href.target">
1274 <xsl:with-param name="object" select="$target"/>
1275 </xsl:call-template>
1279 <xsl:when test="$bibliography.numbered != 0">
1280 <xsl:apply-templates select="$target" mode="citation"/>
1283 <xsl:call-template name="inline.charseq"/>
1288 <xsl:text>]</xsl:text>
1291 <xsl:text>[</xsl:text>
1292 <xsl:call-template name="inline.charseq"/>
1293 <xsl:text>]</xsl:text>
1298 <xsl:template match="citebiblioid">
1299 <xsl:variable name="targets" select="//*[biblioid = string(current())]"/>
1300 <xsl:variable name="target" select="$targets[1]"/>
1303 <!-- try automatic linking based on match to parent of biblioid -->
1304 <xsl:when test="$target and not(xref) and not(link)">
1306 <xsl:text>[</xsl:text>
1308 <xsl:apply-templates select="." mode="common.html.attributes"/>
1309 <xsl:attribute name="href">
1310 <xsl:call-template name="href.target">
1311 <xsl:with-param name="object" select="$target"/>
1312 </xsl:call-template>
1315 <xsl:call-template name="inline.charseq"/>
1318 <xsl:text>]</xsl:text>
1321 <xsl:text>[</xsl:text>
1322 <xsl:call-template name="inline.charseq"/>
1323 <xsl:text>]</xsl:text>
1328 <xsl:template match="biblioentry|bibliomixed" mode="citation">
1329 <xsl:number from="bibliography" count="biblioentry|bibliomixed"
1330 level="any" format="1"/>
1333 <!-- ==================================================================== -->
1335 <xsl:template match="comment[&comment.block.parents;]|remark[&comment.block.parents;]">
1336 <xsl:if test="$show.comments != 0">
1337 <p class="remark"><em><xsl:call-template name="inline.charseq"/></em></p>
1341 <xsl:template match="comment|remark">
1342 <xsl:if test="$show.comments != 0">
1343 <em><xsl:call-template name="inline.charseq"/></em>
1347 <!-- ==================================================================== -->
1349 <xsl:template match="productname">
1350 <xsl:call-template name="inline.charseq"/>
1351 <xsl:if test="@class">
1352 <xsl:call-template name="dingbat">
1353 <xsl:with-param name="dingbat" select="@class"/>
1354 </xsl:call-template>
1358 <xsl:template match="productnumber">
1359 <xsl:call-template name="inline.charseq"/>
1362 <!-- ==================================================================== -->
1364 <xsl:template match="pob|street|city|state|postcode|country|otheraddr">
1365 <xsl:call-template name="inline.charseq"/>
1368 <xsl:template match="phone|fax">
1369 <xsl:call-template name="inline.charseq"/>
1372 <!-- in Addresses, for example -->
1373 <xsl:template match="honorific|firstname|surname|lineage|othername">
1374 <xsl:call-template name="inline.charseq"/>
1377 <!-- ==================================================================== -->
1379 <xsl:template match="person">
1380 <xsl:param name="content">
1381 <xsl:call-template name="anchor"/>
1382 <xsl:call-template name="simple.xlink">
1383 <xsl:with-param name="content">
1384 <xsl:apply-templates select="personname"/>
1386 </xsl:call-template>
1387 <xsl:call-template name="apply-annotations"/>
1391 <xsl:apply-templates select="." mode="common.html.attributes"/>
1392 <xsl:copy-of select="$content"/>
1396 <xsl:template match="personname">
1397 <xsl:param name="content">
1398 <xsl:call-template name="anchor"/>
1399 <xsl:call-template name="simple.xlink">
1400 <xsl:with-param name="content">
1401 <xsl:call-template name="person.name"/>
1403 </xsl:call-template>
1404 <xsl:call-template name="apply-annotations"/>
1408 <xsl:apply-templates select="." mode="common.html.attributes"/>
1409 <xsl:copy-of select="$content"/>
1413 <!-- ==================================================================== -->
1415 <xsl:template match="org">
1416 <xsl:param name="content">
1417 <xsl:call-template name="anchor"/>
1418 <xsl:call-template name="simple.xlink">
1419 <xsl:with-param name="content">
1420 <xsl:apply-templates/>
1422 </xsl:call-template>
1423 <xsl:call-template name="apply-annotations"/>
1427 <xsl:apply-templates select="." mode="common.html.attributes"/>
1428 <xsl:copy-of select="$content"/>
1432 <xsl:template match="orgname">
1433 <xsl:param name="content">
1434 <xsl:call-template name="anchor"/>
1435 <xsl:call-template name="simple.xlink">
1436 <xsl:with-param name="content">
1437 <xsl:apply-templates/>
1439 </xsl:call-template>
1440 <xsl:call-template name="apply-annotations"/>
1444 <xsl:apply-templates select="." mode="common.html.attributes"/>
1445 <xsl:copy-of select="$content"/>
1449 <xsl:template match="orgdiv">
1450 <xsl:param name="content">
1451 <xsl:call-template name="anchor"/>
1452 <xsl:call-template name="simple.xlink">
1453 <xsl:with-param name="content">
1454 <xsl:apply-templates/>
1456 </xsl:call-template>
1457 <xsl:call-template name="apply-annotations"/>
1461 <xsl:apply-templates select="." mode="common.html.attributes"/>
1462 <xsl:copy-of select="$content"/>
1466 <xsl:template match="affiliation">
1467 <xsl:param name="content">
1468 <xsl:call-template name="anchor"/>
1469 <xsl:call-template name="simple.xlink">
1470 <xsl:with-param name="content">
1471 <xsl:call-template name="person.name"/>
1473 </xsl:call-template>
1474 <xsl:call-template name="apply-annotations"/>
1478 <xsl:apply-templates select="." mode="common.html.attributes"/>
1479 <xsl:copy-of select="$content"/>
1483 <!-- ==================================================================== -->
1485 <xsl:template match="beginpage">
1486 <!-- does nothing; this *is not* markup to force a page break. -->