Debian Codegraph @

xsl/xslodt/dita2odt-links.xsl

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- This file is part of the DITA Open Toolkit project hosted on
3 Sourceforge.net. See the accompanying license.txt file for
4 applicable licenses.-->
5 <!-- (c) Copyright IBM Corp. 2005, 2006 All Rights Reserved. -->
6 <xsl:stylesheet
7 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8 xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
9 xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
10 xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
11 xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
12 xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
13 xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
14 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/"
15 xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
16 xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
17 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
18 xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
19 xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
20 xmlns:math="http://www.w3.org/1998/Math/MathML"
21 xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
22 xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
23 xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"
24 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
25 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26 xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
27 xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
28 xmlns:prodtools="http://www.ibm.com/xmlns/prodtools"
29 xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
30 xmlns:opentopic-mapmerge="http://www.idiominc.com/opentopic/mapmerge"
31 xmlns:exsl="http://exslt.org/common"
32 xmlns:exslf="http://exslt.org/functions"
33 xmlns:opentopic-func="http://www.idiominc.com/opentopic/exsl/function"
34 exclude-result-prefixes="opentopic-mapmerge opentopic-func exslf exsl dita-ot"
35 version="1.1">
36
37 <!-- added by William on 2009-10-26 for bug:1880097 start -->
38 <xsl:import href="../../xsl/common/output-message.xsl"/>
39 <xsl:variable name="msgprefix">DOTX</xsl:variable>
40 <!-- added by William on 2009-10-26 for bug:1880097 end -->
41 <!--
42 <xsl:include href="../../cfg/fo/attrs/links-attr.xsl"/>
43 -->
44
45 <xsl:param name="chapterLayout" select="''"/>
46 <xsl:key name="key_anchor" match="*[@id][not(contains(@class,' map/topicref '))]" use="@id"/>
47 <!--[not(contains(@class,' map/topicref '))]-->
48 <xsl:template name="insertLinkShortDesc">
49 <xsl:param name="destination"/>
50 <xsl:param name="element"/>
51 <xsl:param name="linkScope"/>
52 <xsl:choose>
53 <!-- User specified description (from map or topic): use that. -->
54 <xsl:when test="*[contains(@class,' topic/desc ')] and
55 processing-instruction()[name()='ditaot'][.='usershortdesc']">
56 <xsl:element name="text:p">
57 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
58 <xsl:apply-templates select="*[contains(@class, ' topic/desc ')]"/>
59 </xsl:element>
60 </xsl:when>
61 <!-- External: do not attempt to retrieve. -->
62 <xsl:when test="$linkScope='external'">
63 </xsl:when>
64 <!-- When the target has a short description and no local override, use the target -->
65 <xsl:when test="$element/*[contains(@class, ' topic/shortdesc ')]">
66 <xsl:element name="text:line-break"/>
67 <xsl:element name="text:tab"/>
68 <xsl:apply-templates select="$element/*[contains(@class, ' topic/shortdesc ')]" mode="dita-ot:text-only"/>
69 </xsl:when>
70 </xsl:choose>
71 </xsl:template>
72
73 <xsl:template name="insertLinkDesc">
74
75 <text:line-break>
76 <text:tab>
77 <xsl:apply-templates select="*[contains(@class,' topic/desc ')]" mode="insert-description"/>
78 </text:tab>
79 </text:line-break>
80
81 </xsl:template>
82
83 <xsl:template match="*[contains(@class,' topic/xref ') or contains(@class, ' topic/link ')]/*[contains(@class,' topic/desc ')]" priority="1"/>
84 <xsl:template match="*[contains(@class,' topic/desc ')]" mode="insert-description">
85 <xsl:apply-templates/>
86 </xsl:template>
87
88
89 <!-- The insertReferenceTitle template is called from <xref> and <link> and is
90 used to build link contents (using full FO syntax, not just the text). -->
91 <xsl:template name="insertReferenceTitle">
92 <xsl:param name="href"/>
93 <xsl:param name="titlePrefix"/>
94 <xsl:param name="destination"/>
95 <xsl:param name="element"/>
96 <xsl:apply-templates select="." mode="insertReferenceTitle">
97 <xsl:with-param name="href" select="$href"/>
98 <xsl:with-param name="titlePrefix" select="$titlePrefix"/>
99 <xsl:with-param name="destination" select="$destination"/>
100 <xsl:with-param name="element" select="$element"/>
101 </xsl:apply-templates>
102 </xsl:template>
103
104 <!-- Process any cross reference or link with author-specified text.
105 The specified text is used as the link text. Added by RDA for
106 SourceForge bug 1880097. -->
107 <xsl:template match="*[processing-instruction()[name()='ditaot'][.='usertext']]" mode="insertReferenceTitle">
108 <xsl:apply-templates select="*[not(contains(@class,' topic/desc '))]|text()"/>
109 </xsl:template>
110
111 <!-- Process any cross reference or link with no content, or with content
112 generated by the DITA-OT preprocess. The title will be retrieved from
113 the target element, and combined with generated text such as Figure N. -->
114 <xsl:template match="*" mode="insertReferenceTitle">
115 <xsl:param name="href"/>
116 <xsl:param name="titlePrefix"/>
117 <xsl:param name="destination"/>
118 <xsl:param name="element"/>
119
120 <xsl:variable name="referenceContent">
121 <xsl:choose>
122 <xsl:when test="not($element) or ($destination = '')">
123 <xsl:text>#none#</xsl:text>
124 </xsl:when>
125 <xsl:when test="contains($element/@class,' topic/li ') and
126 contains($element/parent::*/@class,' topic/ol ')">
127 <!-- SF Bug 1839827: This causes preprocessor text to be used for links to OL/LI -->
128 <xsl:text>#none#</xsl:text>
129 </xsl:when>
130 <xsl:otherwise>
131 <xsl:apply-templates select="$element" mode="retrieveReferenceTitle"/>
132 </xsl:otherwise>
133 </xsl:choose>
134 </xsl:variable>
135
136
137 <xsl:if test="not($titlePrefix = '')">
138 <!--
139 <xsl:call-template name="insertVariable">
140 <xsl:with-param name="theVariableID" select="$titlePrefix"/>
141 </xsl:call-template>
142 -->
143 </xsl:if>
144
145 <xsl:choose>
146 <xsl:when test="not($element) or ($destination = '') or $referenceContent='#none#'">
147 <xsl:choose>
148 <xsl:when test="*[not(contains(@class,' topic/desc '))] | text()">
149 <xsl:apply-templates select="*[not(contains(@class,' topic/desc '))] | text()"/>
150 </xsl:when>
151 <xsl:otherwise>
152 <xsl:value-of select="$href"/>
153 </xsl:otherwise>
154 </xsl:choose>
155 </xsl:when>
156
157 <xsl:otherwise>
158 <xsl:copy-of select="$referenceContent"/>
159 </xsl:otherwise>
160 </xsl:choose>
161
162 </xsl:template>
163
164 <xsl:template match="*[contains(@class, ' topic/fig ')][*[contains(@class, ' topic/title ')]]" mode="retrieveReferenceTitle">
165
166 <!--
167 <xsl:call-template name="insertVariable">
168 <xsl:with-param name="theVariableID" select="'Figure'"/>
169 <xsl:with-param name="theParameters">
170 <text:span>
171 <xsl:value-of select="count(preceding::*[contains(@class, ' topic/fig ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
172 </text:span>
173 <text:h>
174 <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
175 </text:h>
176 </xsl:with-param>
177 </xsl:call-template>
178 -->
179
180 <text:span>
181 <xsl:value-of select="count(preceding::*[contains(@class, ' topic/fig ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
182 </text:span>
183 <text:h>
184 <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
185 </text:h>
186 </xsl:template>
187
188 <xsl:template match="*[contains(@class, ' topic/section ')][*[contains(@class, ' topic/title ')]]" mode="retrieveReferenceTitle">
189 <xsl:variable name="title">
190 <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
191 </xsl:variable>
192 <xsl:value-of select="normalize-space($title)"/>
193 </xsl:template>
194
195 <xsl:template match="*[contains(@class, ' topic/table ')][*[contains(@class, ' topic/title ')]]" mode="retrieveReferenceTitle">
196 <!--
197 <xsl:call-template name="insertVariable">
198 <xsl:with-param name="theVariableID" select="'Table'"/>
199 <xsl:with-param name="theParameters">
200 <text:span>
201 <xsl:value-of select="count(preceding::*[contains(@class, ' topic/table ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
202 </text:span>
203 <text:h>
204 <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
205 </text:h>
206 </xsl:with-param>
207 </xsl:call-template>
208 -->
209 <text:span>
210 <xsl:value-of select="count(preceding::*[contains(@class, ' topic/table ')][child::*[contains(@class, ' topic/title ')]]) + 1"/>
211 </text:span>
212 <text:h>
213 <xsl:apply-templates select="*[contains(@class, ' topic/title ')]" mode="insert-text"/>
214 </text:h>
215 </xsl:template>
216
217 <xsl:template match="*[contains(@class, ' topic/li ')]" mode="retrieveReferenceTitle">
218 <!--
219 <xsl:call-template name="insertVariable">
220 <xsl:with-param name="theVariableID" select="'List item'"/>
221 </xsl:call-template>
222 -->
223 <xsl:element name="text:p">
224 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
225 <xsl:element name="text:span">
226 <xsl:attribute name="text:style-name">bold</xsl:attribute>
227 <xsl:call-template name="getStringODT">
228 <xsl:with-param name="stringName" select="'List item'"/>
229 </xsl:call-template>
230 </xsl:element>
231 </xsl:element>
232
233
234 </xsl:template>
235
236 <xsl:template match="*[contains(@class, ' topic/fn ')]" mode="retrieveReferenceTitle">
237 <!--
238 <xsl:call-template name="insertVariable">
239 <xsl:with-param name="theVariableID" select="'Foot note'"/>
240 </xsl:call-template>
241 -->
242 <xsl:element name="text:p">
243 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
244 <xsl:element name="text:span">
245 <xsl:attribute name="text:style-name">bold</xsl:attribute>
246 <xsl:call-template name="getStringODT">
247 <xsl:with-param name="stringName" select="'Foot note'"/>
248 </xsl:call-template>
249 </xsl:element>
250 </xsl:element>
251 </xsl:template>
252
253 <!-- Default rule: if element has a title, use that, otherwise return '#none#' -->
254 <xsl:template match="*" mode="retrieveReferenceTitle" >
255 <xsl:choose>
256 <xsl:when test="*[contains(@class,' topic/title ')]">
257 <xsl:value-of select="string(*[contains(@class, ' topic/title ')])"/>
258 </xsl:when>
259 <xsl:otherwise>
260 <xsl:text>#none#</xsl:text>
261 </xsl:otherwise>
262 </xsl:choose>
263 </xsl:template>
264
265 <xsl:template match="*[contains(@class,' topic/xref ')]">
266
267 <xsl:variable name="destination" select="opentopic-func:getDestinationId(@href)"/>
268 <xsl:variable name="element" select="key('key_anchor',$destination)[1]"/>
269
270 <xsl:variable name="referenceTitle">
271 <xsl:call-template name="insertReferenceTitle">
272 <xsl:with-param name="href" select="@href"/>
273 <xsl:with-param name="titlePrefix" select="''"/>
274 <xsl:with-param name="destination" select="$destination"/>
275 <xsl:with-param name="element" select="$element"/>
276 </xsl:call-template>
277 </xsl:variable>
278
279 <xsl:if test="parent::*[contains(@class,' topic/li ')]">
280 <xsl:text disable-output-escaping="yes">&lt;text:p&gt;</xsl:text>
281 </xsl:if>
282
283 <text:a>
284 <xsl:call-template name="buildBasicLinkDestination">
285 <xsl:with-param name="scope" select="@scope"/>
286 <xsl:with-param name="href" select="@href"/>
287 </xsl:call-template>
288
289 <xsl:choose>
290 <xsl:when test="not(@scope = 'external') and not($referenceTitle = '')">
291 <xsl:copy-of select="$referenceTitle"/>
292 </xsl:when>
293 <xsl:when test="not(@scope = 'external')">
294 <xsl:call-template name="insertPageNumberCitation">
295 <xsl:with-param name="isTitleEmpty" select="'yes'"/>
296 <xsl:with-param name="destination" select="$destination"/>
297 <xsl:with-param name="element" select="$element"/>
298 </xsl:call-template>
299 </xsl:when>
300 <xsl:otherwise>
301 <xsl:choose>
302 <xsl:when test="*[not(contains(@class,' topic/desc '))] | text()">
303 <xsl:apply-templates select="*[not(contains(@class,' topic/desc '))] | text()" />
304 </xsl:when>
305 <xsl:otherwise>
306 <xsl:value-of select="@href"/>
307 </xsl:otherwise>
308 </xsl:choose>
309 </xsl:otherwise>
310 </xsl:choose>
311 </text:a>
312
313 <!--
314 Disable because of the CQ#8102 bug
315 <xsl:if test="*[contains(@class,' topic/desc ')]">
316 <xsl:call-template name="insertLinkDesc"/>
317 </xsl:if>
318 -->
319
320 <xsl:if test="not(@scope = 'external') and not($referenceTitle = '') and not($element[contains(@class, ' topic/fn ')])">
321 <!-- SourceForge bug 1880097: should not include page number when xref includes author specified text -->
322 <xsl:if test="not(processing-instruction()[name()='ditaot'][.='usertext'])">
323 <xsl:call-template name="insertPageNumberCitation">
324 <xsl:with-param name="destination" select="$destination"/>
325 <xsl:with-param name="element" select="$element"/>
326 </xsl:call-template>
327 </xsl:if>
328 </xsl:if>
329
330 <xsl:if test="parent::*[contains(@class,' topic/li ')]">
331 <xsl:text disable-output-escaping="yes">&lt;/text:p&gt;</xsl:text>
332 </xsl:if>
333
334 </xsl:template>
335
336 <!-- xref to footnote makes a callout. -->
337 <xsl:template match="*[contains(@class,' topic/xref ')][@type='fn']" priority="2">
338 <xsl:variable name="href-fragment" select="substring-after(@href, '#')"/>
339 <xsl:variable name="footnote-target" select="//*[contains(@class, ' topic/fn ')][@id = substring-after($href-fragment, '/')][ancestor::*[contains(@class, ' topic/topic ')][1]/@id = substring-before($href-fragment, '/')]"/>
340 <xsl:apply-templates select="$footnote-target" mode="footnote-callout"/>
341 </xsl:template>
342
343 <xsl:template match="*[contains(@class, ' topic/fn ')]" mode="footnote-callout">
344 <text:tab/>
345
346 <xsl:choose>
347 <xsl:when test="@callout">
348 <xsl:value-of select="@callout"/>
349 </xsl:when>
350 <xsl:otherwise>
351 <xsl:number level="any" count="*[contains(@class,' topic/fn ') and not(@callout)]"/>
352 </xsl:otherwise>
353 </xsl:choose>
354
355 </xsl:template>
356
357 <xsl:template match="*[contains(@class,' topic/related-links ')]">
358 <xsl:if test="not($disableRelatedLinks = 'none')">
359 <xsl:variable name="topicType">
360 <xsl:for-each select="parent::*">
361 <xsl:call-template name="determineTopicType"/>
362 </xsl:for-each>
363 </xsl:variable>
364
365 <xsl:variable name="collectedLinks">
366 <xsl:apply-templates mode="processLink">
367 <xsl:with-param name="topicType" select="$topicType"/>
368 </xsl:apply-templates>
369 </xsl:variable>
370
371 <xsl:variable name="linkTextContent">
372 <xsl:value-of select="$collectedLinks"/>
373 </xsl:variable>
374
375 <xsl:if test="normalize-space($linkTextContent)!=''">
376 <xsl:element name="text:p">
377 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
378 <!--
379 <xsl:call-template name="insertVariable">
380 <xsl:with-param name="theVariableID" select="'Related Links'"/>
381 </xsl:call-template>
382 -->
383 <xsl:element name="text:span">
384 <xsl:attribute name="text:style-name">bold</xsl:attribute>
385 <xsl:call-template name="getStringODT">
386 <xsl:with-param name="stringName" select="'Related Links'"/>
387 </xsl:call-template>
388 </xsl:element>
389 <!--
390 <text:line-break/>
391 <text:tab/>
392 -->
393 <!--
394 <xsl:copy-of select="$collectedLinks"/>
395 -->
396 <!--
397 <xsl:value-of select="$collectedLinks" disable-output-escaping="yes"/>
398 -->
399 <xsl:apply-templates mode="processLink">
400 <xsl:with-param name="topicType" select="$topicType"/>
401 </xsl:apply-templates>
402 </xsl:element>
403 </xsl:if>
404
405 </xsl:if>
406 </xsl:template>
407
408 <xsl:template name="getLinkScope">
409 <xsl:choose>
410 <xsl:when test="@scope">
411 <xsl:value-of select="@scope"/>
412 </xsl:when>
413 <xsl:when test="contains(@class, ' topic/related-links ')">
414 <xsl:value-of select="'local'"/>
415 </xsl:when>
416 <xsl:otherwise>
417 <xsl:for-each select="..">
418 <xsl:call-template name="getLinkScope"/>
419 </xsl:for-each>
420 </xsl:otherwise>
421 </xsl:choose>
422 </xsl:template>
423
424 <!-- 20100323: Update to be aware of new includeRelatedLinks parameter.
425 Move main processing of link into a mode template; this allows customized
426 code to easily match links without the need to copy processing logic. -->
427 <xsl:template match="*[contains(@class,' topic/link ')]" mode="processLink">
428 <xsl:param name="topicType">
429 <xsl:for-each select="ancestor::*[contains(@class,' topic/topic ')][1]">
430 <xsl:call-template name="determineTopicType"/>
431 </xsl:for-each>
432 </xsl:param>
433 <xsl:choose>
434 <xsl:when test="$disableRelatedLinks = 'nofamily' and
435 (@role='parent' or @role='child' or @role='ancestor' or @role='descendant' or
436 @role='next' or @role='previous' or @role='sibling' or @role='cousin')">
437 <!-- Skip link; family links are ignored for 'nofamily' -->
438 </xsl:when>
439 <xsl:when test="@role='child' and $chapterLayout='MINITOC' and
440 ($topicType='topicChapter' or $topicType='topicAppendix' or $topicType='topicPart')">
441 <!-- When a minitoc already links to children, do not add them here -->
442 </xsl:when>
443 <xsl:otherwise>
444 <xsl:apply-templates select="." mode="processLinks"/>
445 </xsl:otherwise>
446 </xsl:choose>
447 </xsl:template>
448
449 <xsl:template match="*[contains(@class,' topic/link ')]" mode="processLinks">
450 <xsl:variable name="destination" select="opentopic-func:getDestinationId(@href)"/>
451 <xsl:variable name="element" select="key('key_anchor',$destination)[1]"/>
452
453 <xsl:variable name="referenceTitle">
454 <xsl:call-template name="insertReferenceTitle">
455 <xsl:with-param name="href" select="@href"/>
456 <xsl:with-param name="titlePrefix" select="''"/>
457 <xsl:with-param name="destination" select="$destination"/>
458 <xsl:with-param name="element" select="$element"/>
459 </xsl:call-template>
460 </xsl:variable>
461 <xsl:variable name="linkScope">
462 <xsl:call-template name="getLinkScope"/>
463 </xsl:variable>
464
465 <!--<xsl:text>&#x2022; </xsl:text>-->
466 <xsl:element name="text:line-break"/>
467 <xsl:element name="text:tab"/>
468 <text:a>
469 <xsl:call-template name="buildBasicLinkDestination">
470 <xsl:with-param name="scope" select="$linkScope"/>
471 <xsl:with-param name="href" select="@href"/>
472 </xsl:call-template>
473 <xsl:choose>
474 <xsl:when test="not($linkScope = 'external') and not($referenceTitle = '')">
475 <xsl:copy-of select="$referenceTitle"/>
476 </xsl:when>
477 <xsl:when test="not($linkScope = 'external')">
478 <xsl:call-template name="insertPageNumberCitation">
479 <xsl:with-param name="isTitleEmpty" select="'yes'"/>
480 <xsl:with-param name="destination" select="$destination"/>
481 <xsl:with-param name="element" select="$element"/>
482 </xsl:call-template>
483 </xsl:when>
484 <xsl:otherwise>
485 <xsl:apply-templates/>
486 </xsl:otherwise>
487 </xsl:choose>
488 </text:a>
489
490 <xsl:if test="not($linkScope = 'external') and not($referenceTitle = '')">
491 <xsl:call-template name="insertPageNumberCitation">
492 <xsl:with-param name="destination" select="$destination"/>
493 <xsl:with-param name="element" select="$element"/>
494 </xsl:call-template>
495 </xsl:if>
496 <!--
497 Disable because of the CQ#8102 bug
498 <xsl:if test="*[contains(@class, ' topic/desc ')]">
499 <xsl:call-template name="insertLinkDesc"/>
500 </xsl:if>
501 -->
502 <!-- Previously: skip if linkSope = external. New processing: pass
503 linkscope to the template, let the template decide. -->
504 <!--<xsl:if test="not($linkScope = 'external')">-->
505 <xsl:call-template name="insertLinkShortDesc">
506 <xsl:with-param name="destination" select="$destination"/>
507 <xsl:with-param name="element" select="$element"/>
508 <xsl:with-param name="linkScope" select="$linkScope"/>
509 </xsl:call-template>
510 <!--</xsl:if>-->
511 </xsl:template>
512
513 <xsl:template name="buildBasicLinkDestination">
514 <xsl:param name="scope"/>
515 <xsl:param name="href"/>
516 <xsl:choose>
517 <xsl:when test="(contains(@href, '://') and not(starts-with(@href, 'file://')))
518 or starts-with(@href, '/') or $scope = 'external'">
519 <xsl:attribute name="xlink:href">
520 <xsl:value-of select="$href"/>
521 </xsl:attribute>
522 </xsl:when>
523 <!-- added by William on 2009-09-09 for xref pdf bug:2854546 start-->
524 <xsl:when test="$scope = 'peer'">
525 <xsl:attribute name="xlink:href">
526 <xsl:value-of select="$href"/>
527 </xsl:attribute>
528 </xsl:when>
529 <!-- added by William on 2009-09-09 for xref pdf bug:2854546 end-->
530 <xsl:when test="contains($href, '#')">
531 <xsl:attribute name="xlink:href">
532 <xsl:value-of select="$href"/>
533 </xsl:attribute>
534 </xsl:when>
535 <xsl:otherwise>
536 <xsl:attribute name="xlink:href">
537 <xsl:value-of select="$href"/>
538 </xsl:attribute>
539 <xsl:call-template name="brokenLinks">
540 <xsl:with-param name="href" select="$href"/>
541 </xsl:call-template>
542 </xsl:otherwise>
543 <!--xsl:otherwise>
544 <xsl:attribute name="internal-destination">
545 <xsl:value-of select="opentopic-func:getDestinationId($href)"/>
546 </xsl:attribute>
547 </xsl:otherwise-->
548 </xsl:choose>
549 </xsl:template>
550
551 <xsl:template name="insertPageNumberCitation">
552 <xsl:param name="isTitleEmpty"/>
553 <xsl:param name="destination"/>
554 <xsl:param name="element"/>
555
556 <xsl:choose>
557 <xsl:when test="not($element) or ($destination = '')"/>
558 <xsl:when test="$isTitleEmpty">
559 <!--
560 <xsl:call-template name="insertVariable">
561 <xsl:with-param name="theVariableID" select="'Page'"/>
562 <xsl:with-param name="theParameters">
563 <pagenum>
564 <fo:inline>
565 <fo:page-number-citation ref-id="{$destination}"/>
566 </fo:inline>
567 </pagenum>
568 </xsl:with-param>
569 </xsl:call-template>
570 -->
571 <text:s/>
572 <xsl:call-template name="getStringODT">
573 <xsl:with-param name="stringName" select="'Page'"/>
574 </xsl:call-template>
575 <text:s/>
576 <xsl:element name="text:bookmark-ref">
577 <xsl:attribute name="text:reference-format">page</xsl:attribute>
578 <xsl:attribute name="text:ref-name"><xsl:value-of select="$destination"/></xsl:attribute>
579 </xsl:element>
580 </xsl:when>
581 <xsl:otherwise>
582 <!--
583 <xsl:call-template name="insertVariable">
584 <xsl:with-param name="theVariableID" select="'On the page'"/>
585 <xsl:with-param name="theParameters">
586 <xsl:element name="text:bookmark-ref">
587 <xsl:attribute name="text:reference-format">page</xsl:attribute>
588 <xsl:attribute name="text:ref-name"><xsl:value-of select="$destination"/></xsl:attribute>
589 </xsl:element>
590 </xsl:with-param>
591 </xsl:call-template>
592 -->
593 <text:s/>
594 <xsl:call-template name="getStringODT">
595 <xsl:with-param name="stringName" select="'On the page'"/>
596 </xsl:call-template>
597 <text:s/>
598 <xsl:element name="text:bookmark-ref">
599 <xsl:attribute name="text:reference-format">page</xsl:attribute>
600 <xsl:attribute name="text:ref-name"><xsl:value-of select="$destination"/></xsl:attribute>
601 </xsl:element>
602 </xsl:otherwise>
603 </xsl:choose>
604 </xsl:template>
605
606 <xsl:template match="*[contains(@class,' topic/linktext ')]" mode="processLink">
607 <xsl:call-template name="get-ascii">
608 <xsl:with-param name="txt">
609 <xsl:value-of select="*[contains(@class,' topic/linktext ')]"/>
610 </xsl:with-param>
611 </xsl:call-template>
612 </xsl:template>
613
614 <xsl:template match="*[contains(@class, ' topic/linklist ')]" mode="processLink">
615 <text:line-break/>
616 <xsl:apply-templates mode="processLink"/>
617 </xsl:template>
618
619 <xsl:template match="*[contains(@class,' topic/linkinfo ')]" mode="processLink">
620 <text:line-break/>
621 <xsl:apply-templates/>
622 </xsl:template>
623
624 <xsl:template match="*[contains(@class,' topic/linkpool ')]" mode="processLink">
625 <xsl:param name="topicType"/>
626 <xsl:apply-templates mode="processLink">
627 <xsl:with-param name="topicType" select="$topicType"/>
628 </xsl:apply-templates>
629 </xsl:template>
630
631 <exslf:function name="opentopic-func:getDestinationId">
632 <xsl:param name="href"/>
633 <xsl:variable name="destination">
634 <xsl:call-template name="getDestinationIdImpl">
635 <xsl:with-param name="href" select="$href"/>
636 </xsl:call-template>
637 </xsl:variable>
638 <exslf:result select="$destination"/>
639 </exslf:function>
640
641 <xsl:function version="2.0" name="opentopic-func:getDestinationId">
642 <xsl:param name="href"/>
643 <xsl:call-template name="getDestinationIdImpl">
644 <xsl:with-param name="href" select="$href"/>
645 </xsl:call-template>
646 </xsl:function>
647
648 <xsl:template name="getDestinationIdImpl">
649 <xsl:param name="href"/>
650
651 <xsl:variable name="topic-id">
652 <xsl:value-of select="substring-after($href, '#')"/>
653 </xsl:variable>
654
655 <xsl:variable name="element-id">
656 <xsl:value-of select="substring-after($topic-id, '/')"/>
657 </xsl:variable>
658
659 <xsl:choose>
660 <xsl:when test="$element-id = ''">
661 <xsl:value-of select="$topic-id"/>
662 </xsl:when>
663 <xsl:otherwise>
664 <xsl:value-of select="$element-id"/>
665 </xsl:otherwise>
666 </xsl:choose>
667 </xsl:template>
668
669 <!--Related links-->
670
671 <xsl:template name="buildRelationships">
672 <xsl:apply-templates select="." mode="buildRelationships"/>
673 </xsl:template>
674 <xsl:template match="*" mode="buildRelationships">
675 <!--
676 <xsl:param name="context" select="."/>
677 <xsl:for-each select=".">
678
679 </xsl:for-each>
680 -->
681 <xsl:if test="not($disableRelatedLinks = 'none')">
682 <xsl:variable name="parentCollectionType">
683 <xsl:call-template name="getCollectionType">
684 <xsl:with-param name="nodeType" select="'parent'"/>
685 </xsl:call-template>
686 </xsl:variable>
687 <xsl:variable name="selfCollectionType">
688 <xsl:call-template name="getCollectionType">
689 <xsl:with-param name="nodeType" select="'self'"/>
690 </xsl:call-template>
691 </xsl:variable>
692
693 <xsl:variable name="relatedConceptsTitle">
694 <!--
695 <xsl:call-template name="insertVariable">
696 <xsl:with-param name="theVariableID" select="'Related concepts'"/>
697 </xsl:call-template>
698 -->
699 <xsl:element name="text:p">
700 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
701 <xsl:element name="text:span">
702 <xsl:attribute name="text:style-name">bold</xsl:attribute>
703 <xsl:call-template name="getStringODT">
704 <xsl:with-param name="stringName" select="'Related concepts'"/>
705 </xsl:call-template>
706 </xsl:element>
707 </xsl:element>
708 </xsl:variable>
709 <xsl:variable name="relatedTasksTitle">
710 <!--
711 <xsl:call-template name="insertVariable">
712 <xsl:with-param name="theVariableID" select="'Related tasks'"/>
713 </xsl:call-template>
714 -->
715 <xsl:element name="text:p">
716 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
717 <xsl:element name="text:span">
718 <xsl:attribute name="text:style-name">bold</xsl:attribute>
719 <xsl:call-template name="getStringODT">
720 <xsl:with-param name="stringName" select="'Related tasks'"/>
721 </xsl:call-template>
722 </xsl:element>
723 </xsl:element>
724 </xsl:variable>
725 <xsl:variable name="relatedReferencesTitle">
726 <!--
727 <xsl:call-template name="insertVariable">
728 <xsl:with-param name="theVariableID" select="'Related references'"/>
729 </xsl:call-template>
730 -->
731 <xsl:element name="text:p">
732 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
733 <xsl:element name="text:span">
734 <xsl:attribute name="text:style-name">bold</xsl:attribute>
735 <xsl:call-template name="getStringODT">
736 <xsl:with-param name="stringName" select="'Related references'"/>
737 </xsl:call-template>
738 </xsl:element>
739 </xsl:element>
740 </xsl:variable>
741 <xsl:variable name="relatedInformationTitle">
742 <!--
743 <xsl:call-template name="insertVariable">
744 <xsl:with-param name="theVariableID" select="'Related information'"/>
745 </xsl:call-template>
746 -->
747 <xsl:element name="text:p">
748 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
749 <xsl:element name="text:span">
750 <xsl:attribute name="text:style-name">bold</xsl:attribute>
751 <xsl:call-template name="getStringODT">
752 <xsl:with-param name="stringName" select="'Related information'"/>
753 </xsl:call-template>
754 </xsl:element>
755 </xsl:element>
756 </xsl:variable>
757
758
759 <xsl:choose>
760 <xsl:when test="$selfCollectionType = 'none'">
761 <xsl:call-template name="linkToChilds">
762 <xsl:with-param name="listType" select="'none'"/>
763 </xsl:call-template>
764 </xsl:when>
765 <xsl:when test="($selfCollectionType = 'unordered') or ($selfCollectionType = 'choice') or ($selfCollectionType = 'family')">
766 <xsl:call-template name="linkToChilds">
767 <xsl:with-param name="listType" select="'bulleted'"/>
768 </xsl:call-template>
769 </xsl:when>
770 <xsl:when test="$selfCollectionType = 'sequence'">
771 <xsl:call-template name="linkToChilds">
772 <xsl:with-param name="listType" select="'numbered'"/>
773 </xsl:call-template>
774 </xsl:when>
775 </xsl:choose>
776
777 <xsl:choose>
778 <xsl:when test="($parentCollectionType = 'none') or ($parentCollectionType = 'unordered') or ($parentCollectionType = 'choice')">
779 <xsl:call-template name="linkToParent"/>
780
781 <!-- Creating relationships to the concepts -->
782 <xsl:call-template name="createRelatedLinks">
783 <xsl:with-param name="linkType" select="'concept'"/>
784 <xsl:with-param name="title" select="$relatedConceptsTitle"/>
785 </xsl:call-template>
786
787 <!-- Creating relationships to the tasks -->
788 <xsl:call-template name="createRelatedLinks">
789 <xsl:with-param name="linkType" select="'task'"/>
790 <xsl:with-param name="title" select="$relatedTasksTitle"/>
791 </xsl:call-template>
792
793 <!-- Creating relationships to the references -->
794 <xsl:call-template name="createRelatedLinks">
795 <xsl:with-param name="linkType" select="'reference'"/>
796 <xsl:with-param name="title" select="$relatedReferencesTitle"/>
797 </xsl:call-template>
798
799 <!-- Creating relationships to the topics -->
800 <xsl:call-template name="createRelatedLinks">
801 <xsl:with-param name="linkType" select="'topic'"/>
802 <xsl:with-param name="title" select="$relatedInformationTitle"/>
803 </xsl:call-template>
804 </xsl:when>
805
806 <xsl:when test="$parentCollectionType = 'sequence'">
807 <xsl:call-template name="linkToParent"/>
808 <xsl:call-template name="linkToPrevious"/>
809 <xsl:call-template name="linkToNext"/>
810
811 <!-- Creating relationships to the concepts -->
812 <xsl:call-template name="createRelatedLinks">
813 <xsl:with-param name="linkType" select="'concept'"/>
814 <xsl:with-param name="title" select="$relatedConceptsTitle"/>
815 </xsl:call-template>
816
817 <!-- Creating relationships to the tasks -->
818 <xsl:call-template name="createRelatedLinks">
819 <xsl:with-param name="linkType" select="'task'"/>
820 <xsl:with-param name="title" select="$relatedTasksTitle"/>
821 </xsl:call-template>
822
823 <!-- Creating relationships to the references -->
824 <xsl:call-template name="createRelatedLinks">
825 <xsl:with-param name="linkType" select="'reference'"/>
826 <xsl:with-param name="title" select="$relatedReferencesTitle"/>
827 </xsl:call-template>
828
829 <!-- Creating relationships to the topics -->
830 <xsl:call-template name="createRelatedLinks">
831 <xsl:with-param name="linkType" select="'topic'"/>
832 <xsl:with-param name="title" select="$relatedInformationTitle"/>
833 </xsl:call-template>
834 </xsl:when>
835
836 <xsl:when test="$parentCollectionType = 'family'">
837 <xsl:call-template name="linkToParent"/>
838
839 <!-- Creating relationships to the concepts -->
840 <xsl:variable name="siblingConcepts" select="preceding-sibling::*[contains(@class, ' concept/concept ') and not(contains(@class, ' bkinfo/bkinfo '))] | following-sibling::*[contains(@class, ' concept/concept ') and not(contains(@class, ' bkinfo/bkinfo '))]"/>
841 <xsl:call-template name="createMapLinks">
842 <xsl:with-param name="nodeSet" select="$siblingConcepts"/>
843 <xsl:with-param name="title" select="$relatedConceptsTitle"/>
844 </xsl:call-template>
845 <xsl:choose>
846 <xsl:when test="$siblingConcepts">
847 <xsl:call-template name="createRelatedLinks">
848 <xsl:with-param name="linkType" select="'concept'"/>
849 </xsl:call-template>
850 </xsl:when>
851 <xsl:otherwise>
852 <xsl:call-template name="createRelatedLinks">
853 <xsl:with-param name="linkType" select="'concept'"/>
854 <xsl:with-param name="title" select="$relatedConceptsTitle"/>
855 </xsl:call-template>
856 </xsl:otherwise>
857 </xsl:choose>
858
859 <!-- Creating relationships to the tasks -->
860 <xsl:variable name="siblingTasks" select="preceding-sibling::*[contains(@class, ' task/task ') and not(contains(@class, ' bkinfo/bkinfo '))] | following-sibling::*[contains(@class, ' task/task ') and not(contains(@class, ' bkinfo/bkinfo '))]"/>
861 <xsl:call-template name="createMapLinks">
862 <xsl:with-param name="nodeSet" select="$siblingTasks"/>
863 <xsl:with-param name="title" select="$relatedTasksTitle"/>
864 </xsl:call-template>
865 <xsl:choose>
866 <xsl:when test="$siblingTasks">
867 <xsl:call-template name="createRelatedLinks">
868 <xsl:with-param name="linkType" select="'task'"/>
869 </xsl:call-template>
870 </xsl:when>
871 <xsl:otherwise>
872 <xsl:call-template name="createRelatedLinks">
873 <xsl:with-param name="linkType" select="'task'"/>
874 <xsl:with-param name="title" select="$relatedTasksTitle"/>
875 </xsl:call-template>
876 </xsl:otherwise>
877 </xsl:choose>
878
879 <!-- Creating relationships to the references -->
880 <xsl:variable name="siblingReferences" select="preceding-sibling::*[contains(@class, ' reference/reference ') and not(contains(@class, ' bkinfo/bkinfo '))] | following-sibling::*[contains(@class, ' reference/reference ') and not(contains(@class, ' bkinfo/bkinfo '))]"/>
881 <xsl:call-template name="createMapLinks">
882 <xsl:with-param name="nodeSet" select="$siblingReferences"/>
883 <xsl:with-param name="title" select="$relatedReferencesTitle"/>
884 </xsl:call-template>
885 <xsl:choose>
886 <xsl:when test="$siblingReferences">
887 <xsl:call-template name="createRelatedLinks">
888 <xsl:with-param name="linkType" select="'reference'"/>
889 </xsl:call-template>
890 </xsl:when>
891 <xsl:otherwise>
892 <xsl:call-template name="createRelatedLinks">
893 <xsl:with-param name="linkType" select="'reference'"/>
894 <xsl:with-param name="title" select="$relatedReferencesTitle"/>
895 </xsl:call-template>
896 </xsl:otherwise>
897 </xsl:choose>
898
899 <!-- Creating relationships to the topics -->
900 <xsl:variable name="siblingTopics" select="preceding-sibling::*[contains(@class, ' topic/topic ') and not(contains(@class, ' bkinfo/bkinfo ') or contains(@class, ' concept/concept ') or contains(@class, ' task/task ') or contains(@class, ' reference/reference '))] | following-sibling::*[contains(@class, ' topic/topic ') and not(contains(@class, ' bkinfo/bkinfo ') or contains(@class, ' concept/concept ') or contains(@class, ' task/task ') or contains(@class, ' reference/reference '))]"/>
901 <xsl:call-template name="createMapLinks">
902 <xsl:with-param name="nodeSet" select="$siblingTopics"/>
903 <xsl:with-param name="title" select="$relatedInformationTitle"/>
904 </xsl:call-template>
905 <xsl:choose>
906 <xsl:when test="$siblingTopics">
907 <xsl:call-template name="createRelatedLinks">
908 <xsl:with-param name="linkType" select="'topic'"/>
909 </xsl:call-template>
910 </xsl:when>
911 <xsl:otherwise>
912 <xsl:call-template name="createRelatedLinks">
913 <xsl:with-param name="linkType" select="'topic'"/>
914 <xsl:with-param name="title" select="$relatedInformationTitle"/>
915 </xsl:call-template>
916 </xsl:otherwise>
917 </xsl:choose>
918 </xsl:when>
919 </xsl:choose>
920 </xsl:if>
921 </xsl:template>
922
923 <xsl:template name="getCollectionType">
924 <xsl:param name="nodeType"/>
925 <xsl:variable name="collectionType">
926 <xsl:choose>
927 <xsl:when test="$nodeType = 'parent'">
928 <xsl:value-of select="parent::*/@collection-type"/>
929 </xsl:when>
930 <xsl:when test="$nodeType = 'self'">
931 <xsl:value-of select="@collection-type"/>
932 </xsl:when>
933 </xsl:choose>
934 </xsl:variable>
935 <xsl:choose>
936 <xsl:when test="$collectionType = 'unordered'">
937 <xsl:value-of select="'none'"/>
938 </xsl:when>
939 <xsl:when test="$collectionType">
940 <xsl:value-of select="$collectionType"/>
941 </xsl:when>
942 <xsl:otherwise>
943 <xsl:value-of select="'none'"/>
944 </xsl:otherwise>
945 </xsl:choose>
946 </xsl:template>
947 <xsl:template name="linkToParent">
948 <!-- Creating relationships to the parent -->
949 <xsl:variable name="linksTitle">
950 <!--
951 <xsl:call-template name="insertVariable">
952 <xsl:with-param name="theVariableID" select="'Parent topic'"/>
953 </xsl:call-template>
954 -->
955 <xsl:element name="text:p">
956 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
957 <xsl:element name="text:span">
958 <xsl:attribute name="text:style-name">bold</xsl:attribute>
959 <xsl:call-template name="getStringODT">
960 <xsl:with-param name="stringName" select="'Parent topic'"/>
961 </xsl:call-template>
962 </xsl:element>
963 </xsl:element>
964 </xsl:variable>
965 <xsl:call-template name="createMapLinks">
966 <xsl:with-param name="nodeSet" select="parent::*[contains(@class, ' topic/topic ')]"/>
967 <xsl:with-param name="title" select="$linksTitle"/>
968 </xsl:call-template>
969 </xsl:template>
970
971 <xsl:template name="linkToNext">
972 <!-- Creating relationships to the next sibling -->
973 <xsl:variable name="linksTitle">
974 <!--
975 <xsl:call-template name="insertVariable">
976 <xsl:with-param name="theVariableID" select="'Next topic'"/>
977 </xsl:call-template>
978 -->
979 <xsl:element name="text:p">
980 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
981 <xsl:element name="text:span">
982 <xsl:attribute name="text:style-name">bold</xsl:attribute>
983 <xsl:call-template name="getStringODT">
984 <xsl:with-param name="stringName" select="'Next topic'"/>
985 </xsl:call-template>
986 </xsl:element>
987 </xsl:element>
988 </xsl:variable>
989 <xsl:call-template name="createMapLinks">
990 <xsl:with-param name="nodeSet" select="following-sibling::*[contains(@class, ' topic/topic ')][1]"/>
991 <xsl:with-param name="title" select="$linksTitle"/>
992 </xsl:call-template>
993 </xsl:template>
994
995 <xsl:template name="linkToPrevious">
996 <!-- Creating relationships to the previous sibling -->
997 <xsl:variable name="linksTitle">
998 <!--
999 <xsl:call-template name="insertVariable">
1000 <xsl:with-param name="theVariableID" select="'Previous topic'"/>
1001 </xsl:call-template>
1002 -->
1003 <xsl:element name="text:p">
1004 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1005 <xsl:element name="text:span">
1006 <xsl:attribute name="text:style-name">bold</xsl:attribute>
1007 <xsl:call-template name="getStringODT">
1008 <xsl:with-param name="stringName" select="'Previous topic'"/>
1009 </xsl:call-template>
1010 </xsl:element>
1011 </xsl:element>
1012 </xsl:variable>
1013 <xsl:call-template name="createMapLinks">
1014 <xsl:with-param name="nodeSet" select="preceding-sibling::*[contains(@class, ' topic/topic ')][1]"/>
1015 <xsl:with-param name="title" select="$linksTitle"/>
1016 </xsl:call-template>
1017 </xsl:template>
1018
1019 <xsl:template name="linkToChilds">
1020 <!-- Creating relationships to the childs -->
1021 <xsl:param name="listType"/>
1022 <xsl:variable name="linksTitle">
1023 <!--
1024 <xsl:call-template name="insertVariable">
1025 <xsl:with-param name="theVariableID" select="'Child topics'"/>
1026 </xsl:call-template>
1027 -->
1028 <xsl:element name="text:p">
1029 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1030 <xsl:element name="text:span">
1031 <xsl:attribute name="text:style-name">bold</xsl:attribute>
1032 <xsl:call-template name="getStringODT">
1033 <xsl:with-param name="stringName" select="'Child topics'"/>
1034 </xsl:call-template>
1035 </xsl:element>
1036 </xsl:element>
1037 </xsl:variable>
1038 <xsl:call-template name="createMapLinks">
1039 <xsl:with-param name="nodeSet" select="*[contains(@class, ' topic/topic ')] | *[contains(@class,' topic/dita ')]/*[contains(@class, ' topic/topic ')]"/>
1040 <xsl:with-param name="title" select="$linksTitle"/>
1041 <xsl:with-param name="listType" select="$listType"/>
1042 </xsl:call-template>
1043 </xsl:template>
1044
1045 <xsl:template name="createMapLinks">
1046 <xsl:param name="nodeSet"/>
1047 <xsl:param name="title"/>
1048 <xsl:param name="listType" select="'none'"/>
1049
1050 <xsl:variable name="linkNodes">
1051 <xsl:if test="$nodeSet">
1052 <xsl:choose>
1053 <xsl:when test="$listType = 'bulleted'">
1054 <xsl:call-template name="createMapLinksUnordered">
1055 <xsl:with-param name="nodeSet" select="$nodeSet"/>
1056 </xsl:call-template>
1057 </xsl:when>
1058 <xsl:when test="$listType = 'numbered'">
1059 <xsl:call-template name="createMapLinksOrdered">
1060 <xsl:with-param name="nodeSet" select="$nodeSet"/>
1061 </xsl:call-template>
1062 </xsl:when>
1063 <xsl:when test="$listType = 'none'">
1064 <xsl:element name="text:p">
1065 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1066 <xsl:for-each select="$nodeSet">
1067 <text:a xlink:href="concat('#', @id)">
1068 <xsl:apply-templates select="child::*[contains(@class, ' topic/title ')]" mode="insert-text"/>
1069 </text:a>
1070 <text:line-break/>
1071 </xsl:for-each>
1072 </xsl:element>
1073 </xsl:when>
1074 </xsl:choose>
1075 </xsl:if>
1076 </xsl:variable>
1077
1078 <xsl:if test="($linkNodes//text:list) or ($linkNodes//text:p)">
1079 <xsl:if test="$title">
1080 <xsl:value-of select="$title"/>
1081 </xsl:if>
1082 <xsl:copy-of select="$linkNodes"/>
1083 </xsl:if>
1084 </xsl:template>
1085
1086 <xsl:template name="createMapLinksUnordered">
1087 <xsl:param name="nodeSet"/>
1088
1089 <text:list text:style-name="list_style">
1090 <xsl:for-each select="$nodeSet">
1091 <text:list-item>
1092 <!--
1093 <xsl:call-template name="insertVariable">
1094 <xsl:with-param name="theVariableID" select="'Unordered List bullet'"/>
1095 </xsl:call-template>
1096 -->
1097 <xsl:element name="text:p">
1098 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1099 <xsl:element name="text:span">
1100 <xsl:attribute name="text:style-name">bold</xsl:attribute>
1101 <xsl:call-template name="getStringODT">
1102 <xsl:with-param name="stringName" select="'Unordered List bullet'"/>
1103 </xsl:call-template>
1104 </xsl:element>
1105 </xsl:element>
1106 <xsl:element name="text:p">
1107 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1108 <text:a xlink:href="concat('#' , @id)">
1109 <xsl:apply-templates select="child::*[contains(@class, ' topic/title ')]" mode="insert-text"/>
1110 </text:a>
1111 </xsl:element>
1112 </text:list-item>
1113 </xsl:for-each>
1114 </text:list>
1115 </xsl:template>
1116
1117 <xsl:template name="createMapLinksOrdered">
1118 <xsl:param name="nodeSet"/>
1119
1120 <text:list text:style-nam="ordered_list_style">
1121 <xsl:for-each select="$nodeSet">
1122 <text:list-item>
1123
1124 <xsl:element name="text:p">
1125 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1126 <xsl:value-of select="count(preceding-sibling::*[contains(@class,' topic/topic ')])"/>
1127 </xsl:element>
1128
1129 <xsl:element name="text:p">
1130 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1131 <text:a xlink:href="concat('#', @id)">
1132 <xsl:apply-templates select="child::*[contains(@class, ' topic/title ')]" mode="insert-text"/>
1133 </text:a>
1134 </xsl:element>
1135
1136 </text:list-item>
1137 </xsl:for-each>
1138 </text:list>
1139 </xsl:template>
1140
1141 <xsl:template name="createRelatedLinks">
1142 <xsl:param name="linkType"/>
1143 <xsl:param name="title"/>
1144 <xsl:variable name="id" select="@id"/>
1145
1146 <xsl:if test="$relatedTopicrefs/@id = $id">
1147 <xsl:variable name="resultLinks">
1148 <xsl:for-each select="$relatedTopicrefs[@id = $id]">
1149 <xsl:choose>
1150 <xsl:when test="ancestor::*[contains(@class, ' map/reltable ')]/*[contains(@class, ' map/relheader ')]">
1151 <xsl:variable name="topicTypeCellSpec" select="ancestor::*[contains(@class, ' map/reltable ')]/*[contains(@class, ' map/relheader ')]/*[contains(@class, ' map/relcolspec ')][@type = $linkType]"/>
1152 <xsl:if test="$topicTypeCellSpec">
1153 <xsl:variable name="currPosition" select="count(ancestor::*[contains(@class, ' map/relcell ')][1]/preceding-sibling::*) + 1"/>
1154 <xsl:variable name="position">
1155 <xsl:for-each select="$topicTypeCellSpec">
1156 <xsl:value-of select="count(preceding-sibling::*) + 1"/>
1157 </xsl:for-each>
1158 </xsl:variable>
1159 <xsl:if test="not($currPosition = $position)">
1160 <xsl:for-each select="ancestor::*[contains(@class, ' map/relrow ')]/*[contains(@class, ' map/relcell ')][position() = $position]//*[contains(@class, ' map/topicref ')]">
1161 <xsl:variable name="relatedTopic" select="key('key_anchor',@id)[1]"/>
1162 <xsl:element name="text:p">
1163 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1164 <text:a xlink:href="concat('#', $id)">
1165 <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
1166 </text:a>
1167 </xsl:element>
1168 </xsl:for-each>
1169 </xsl:if>
1170 </xsl:if>
1171 </xsl:when>
1172 <xsl:otherwise>
1173 <xsl:for-each select="ancestor::*[contains(@class, ' map/relcell ')][1]/preceding-sibling::*//*[contains(@class, ' map/topicref ')] | ancestor::*[contains(@class, ' map/relcell ')][1]/following-sibling::*//*[contains(@class, ' map/topicref ')]">
1174 <xsl:variable name="relatedTopic" select="key('key_anchor',@id)[1]"/>
1175 <xsl:choose>
1176 <xsl:when test="$linkType = 'topic'">
1177 <xsl:if test="contains($relatedTopic/@class, ' topic/topic ') and not(contains($relatedTopic/@class, ' concept/concept ') or contains($relatedTopic/@class, ' task/task ') or contains($relatedTopic/@class, ' reference/reference '))">
1178 <xsl:element name="text:p">
1179 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1180 <text:a xlink:href="concat('#', $id)">
1181 <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
1182 </text:a>
1183 </xsl:element>
1184 </xsl:if>
1185 </xsl:when>
1186 <xsl:when test="$linkType = 'task'">
1187 <xsl:if test="contains($relatedTopic/@class, ' task/task ')">
1188 <xsl:element name="text:p">
1189 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1190 <text:a xlink:href="concat('#', $id)">
1191 <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
1192 </text:a>
1193 </xsl:element>
1194 </xsl:if>
1195 </xsl:when>
1196 <xsl:when test="$linkType = 'concept'">
1197 <xsl:if test="contains($relatedTopic/@class, ' concept/concept ')">
1198 <xsl:element name="text:p">
1199 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1200 <text:a xlink:href="concat('#', $id)">
1201 <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
1202 </text:a>
1203 </xsl:element>
1204 </xsl:if>
1205 </xsl:when>
1206 <xsl:when test="$linkType = 'reference'">
1207 <xsl:if test="contains($relatedTopic/@class, ' reference/reference ')">
1208 <xsl:element name="text:p">
1209 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1210 <text:a xlink:href="concat('#', $id)">
1211 <xsl:apply-templates select="$relatedTopic/*[contains(@class,' topic/title ')]" mode="insert-text"/>
1212 </text:a>
1213 </xsl:element>
1214 </xsl:if>
1215 </xsl:when>
1216 </xsl:choose>
1217 </xsl:for-each>
1218 </xsl:otherwise>
1219 </xsl:choose>
1220 </xsl:for-each>
1221 </xsl:variable>
1222 <xsl:if test="$resultLinks/*">
1223 <xsl:if test="$title">
1224 <xsl:element name="text:p">
1225 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1226 <xsl:value-of select="$title"/>
1227 </xsl:element>
1228 </xsl:if>
1229 <xsl:copy-of select="$resultLinks"/>
1230 </xsl:if>
1231 </xsl:if>
1232 </xsl:template>
1233
1234 <xsl:template name="brokenLinks">
1235 <xsl:param name="href"/>
1236 <xsl:call-template name="output-message">
1237 <xsl:with-param name="msgnum">063</xsl:with-param>
1238 <xsl:with-param name="msgsev">W</xsl:with-param>
1239 <xsl:with-param name="msgparams">%1=<xsl:value-of select="$href"/></xsl:with-param>
1240 </xsl:call-template>
1241 </xsl:template>
1242
1243 <!--create prerequisite links with all dups eliminated. -->
1244 <!-- Omit prereq links from unordered related-links (handled by mode="prereqs" template). -->
1245 <xsl:key name="omit-from-unordered-links" match="*[@importance='required' and (not(@role) or @role='sibling' or @role='friend' or @role='cousin')]" use="1"/>
1246 <xsl:template match="*[contains(@class,' topic/related-links ')]" mode="prereqs">
1247
1248 <!--if there are any prereqs create a list with dups-->
1249 <xsl:if test="descendant::*[contains(@class, ' topic/link ')][not(ancestor::*[contains(@class, ' topic/linklist ')])][@importance='required' and (not(@role) or @role='sibling' or @role='friend' or @role='previous' or @role='cousin')]">
1250 <xsl:element name="text:p">
1251 <xsl:element name="text:span">
1252 <xsl:attribute name="text:style-name">default_text_style</xsl:attribute>
1253 <xsl:call-template name="getStringODT">
1254 <xsl:with-param name="stringName" select="'Prerequisites'"/>
1255 </xsl:call-template>
1256 </xsl:element>
1257 </xsl:element>
1258
1259 <!--only create link if there is an href, its importance is required, and the role is compatible (don't want a prereq showing up for a "next" or "parent" link, for example) - remove dups-->
1260 <xsl:apply-templates mode="prereqs" select="descendant::*[generate-id(.)=generate-id(key('link',concat(ancestor::*[contains(@class, ' topic/related-links ')]/parent::*[contains(@class, ' topic/topic ')]/@id, ' ', @href,@type,@role,@platform,@audience,@importance,@outputclass,@keyref,@scope,@format,@otherrole,@product,@otherprops,@rev,@class,child::*))[1])]
1261 [@href]
1262 [@importance='required' and (not(@role) or @role='sibling' or @role='friend' or @role='previous' or @role='cousin')]
1263 [not(ancestor::*[contains(@class, ' topic/linklist ')])]"/>
1264 </xsl:if>
1265 </xsl:template>
1266
1267 <xsl:template mode="prereqs" match="*[contains(@class, ' topic/link ')]" priority="2">
1268
1269 <!-- Allow for unknown metadata (future-proofing) -->
1270 <xsl:apply-templates select="*[contains(@class,' topic/data ') or contains(@class,' topic/foreign ')]"/>
1271 <xsl:variable name="samefile">
1272 <xsl:call-template name="check_file_location"/>
1273 </xsl:variable>
1274 <xsl:variable name="href-value">
1275 <xsl:call-template name="format_href_value"/>
1276 </xsl:variable>
1277 <xsl:element name="text:p">
1278 <xsl:attribute name="text:style-name">Default_20_Text</xsl:attribute>
1279 <xsl:call-template name="create_related_links">
1280 <xsl:with-param name="samefile" select="$samefile"/>
1281 <xsl:with-param name="href-value" select="$href-value"/>
1282 </xsl:call-template>
1283 </xsl:element>
1284 </xsl:template>
1285
1286 </xsl:stylesheet>