bump product version to 25.8.0.0.alpha0+
[LibreOffice.git] / xmlhelp / util / main_transform.xsl
blobac1b3abb7d9d41104ac786651d449ef884a4202b
1 <?xml version="1.0" encoding="UTF-8"?>
3 <!--***********************************************************************
4 This is the main transformation style sheet for transforming.
5 For use with LibreOffice 4.0+
6 =========================================================================
7 Changes Log
8 May 24 2004 Created
9 Aug 24 2004 Fixed for help2 CWS
10 Aug 27 2004 Added css link, fixed missing embed-mode for variable
11 Removed width/height for images
12 Sep 03 2004 Modularized xsl, added some embedded modes
13 Oct 08 2004 Fixed bug wrong mode "embedded" for links
14 Added embedded modes for embed and embedvar (for cascaded embeds)
15 Added <p> tags around falsely embedded pars and vars
16 Dec 08 2004 #i38483#, fixed wrong handling of web links
17 #i37377#, fixed missing usage of Database parameter for switching
18 Jan 04 2005 #i38905#, fixed buggy branding replacement template
19 Mar 17 2005 #i43972#, added language info to image URL, evaluate Language parameter
20 evaluate new localize attribute in images
21 May 10 2005 #i48785#, fixed wrong setting of distrib variable
22 Aug 16 2005 workaround for #i53365#
23 Aug 19 2005 fixed missing list processing in embedded sections
24 Aug 19 2005 #i53535#, fixed wrong handling of Database parameter
25 Oct 17 2006 #i70462#, disabled sorting to avoid output of error messages to console
26 Jun 15 2009 #i101799#, fixed wrong handling of http URLs with anchors
27 ***********************************************************************//-->
29 <!--
30 * This file is part of the LibreOffice project.
32 * This Source Code Form is subject to the terms of the Mozilla Public
33 * License, v. 2.0. If a copy of the MPL was not distributed with this
34 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
36 * This file incorporates work covered by the following license notice:
38 * Licensed to the Apache Software Foundation (ASF) under one or more
39 * contributor license agreements. See the NOTICE file distributed
40 * with this work for additional information regarding copyright
41 * ownership. The ASF licenses this file to you under the Apache
42 * License, Version 2.0 (the "License"); you may not use this file
43 * except in compliance with the License. You may obtain a copy of
44 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
45 -->
47 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
49 <xsl:output indent="yes" method="html"/>
51 <!--
52 ############################
53 # Variables and Parameters #
54 ############################
55 //-->
57 <!-- General Usage -->
58 <xsl:variable name="am" select="'&amp;'"/>
59 <xsl:variable name="sl" select="'/'"/>
60 <xsl:variable name="qt" select="'&quot;'"/>
62 <!-- generic Icon alt text -->
63 <xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/>
65 <!-- For calculating pixel sizes -->
66 <xsl:variable name="dpi" select="'96'"/>
67 <xsl:variable name="dpcm" select="'38'"/>
69 <!-- Product brand variables used in the help files -->
70 <xsl:variable name="brand1" select="'$[officename]'"/>
71 <xsl:variable name="brand2" select="'$[officeversion]'"/>
72 <xsl:variable name="brand3" select="'%PRODUCTNAME'"/>
73 <xsl:variable name="brand4" select="'%PRODUCTVERSION'"/>
75 <!-- meta data variables from the help file -->
76 <xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
77 <xsl:variable name="title" select="/helpdocument/meta/topic/title"/>
79 <!-- Module and the corresponding switching values-->
80 <xsl:param name="Database" select="'swriter'"/>
81 <xsl:variable name="module" select="$Database"/>
82 <xsl:variable name="appl">
83 <xsl:choose>
84 <xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when>
85 <xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when>
86 <xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when>
87 <xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when>
88 <xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when>
89 <xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when>
90 <xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when>
91 </xsl:choose>
92 </xsl:variable>
94 <!-- the other parameters given by the help caller -->
95 <xsl:param name="System" select="'WIN'"/>
96 <xsl:param name="productname" select="'Office'"/>
97 <xsl:param name="productversion" select="''"/>
98 <xsl:variable name="pversion">
99 <xsl:value-of select="translate($productversion,' ','')"/>
100 </xsl:variable>
101 <!-- this is were the images are -->
102 <xsl:param name="imgtheme" select="''"/>
103 <xsl:param name="Id" />
104 <xsl:param name="Language" select="'en-US'"/>
105 <xsl:variable name="lang" select="$Language"/>
107 <xsl:param name="ExtensionId" select="''"/>
108 <xsl:param name="ExtensionPath" select="''"/>
111 <!-- parts of help and image urls -->
112 <xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/>
113 <xsl:variable name="img_url_prefix" select="concat('vnd.libreoffice.image://',$imgtheme,'/')"/>
114 <xsl:variable name="img_url_internal" select="'vnd.libreoffice.image://helpimg/'"/>
115 <xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/>
116 <xsl:variable name="urlpre" select="$help_url_prefix" />
117 <xsl:variable name="linkprefix" select="$urlpre"/>
118 <xsl:variable name="linkpostfix" select="$urlpost"/>
120 <xsl:variable name="css" select="'default.css'"/>
122 <!-- images for notes, tips and warnings -->
123 <xsl:variable name="note_img" select="concat($img_url_internal,'media/helpimg/note.png')"/>
124 <xsl:variable name="tip_img" select="concat($img_url_internal,'media/helpimg/tip.png')"/>
125 <xsl:variable name="warning_img" select="concat($img_url_internal,'media/helpimg/warning.png')"/>
127 <!--
128 #############
129 # Templates #
130 #############
131 //-->
133 <!-- Create the document skeleton -->
134 <xsl:template match="/">
135 <xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/>
136 <html>
137 <head>
138 <title><xsl:value-of select="$title"/></title>
139 <link href="{$csslink}" rel="Stylesheet" type="text/css" /> <!-- stylesheet link -->
140 <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
141 </head>
142 <body lang="{$lang}">
143 <xsl:apply-templates select="/helpdocument/body"/>
144 </body>
145 </html>
146 </xsl:template>
148 <!-- AHELP -->
149 <xsl:template match="ahelp">
150 <xsl:if test="not(@visibility='hidden')"><span class="avis"><xsl:apply-templates /></span></xsl:if>
151 </xsl:template>
153 <!-- ALT -->
154 <xsl:template match="alt"/>
156 <!-- BOOKMARK -->
157 <xsl:template match="bookmark">
158 <a name="{@id}"></a>
159 <xsl:choose>
160 <xsl:when test="starts-with(@branch,'hid')" />
161 <xsl:otherwise><xsl:apply-templates /></xsl:otherwise>
162 </xsl:choose>
163 </xsl:template>
164 <xsl:template match="bookmark" mode="embedded" />
166 <!-- BOOKMARK_VALUE -->
167 <xsl:template match="bookmark_value" />
169 <!-- BR -->
170 <xsl:template match="br"><br /></xsl:template>
172 <!-- CAPTION -->
173 <xsl:template match="caption" />
175 <!-- CASE -->
176 <xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template>
177 <xsl:template match="case" mode="embedded">
178 <xsl:call-template name="insertcase">
179 <xsl:with-param name="embedded" select="'yes'"/>
180 </xsl:call-template>
181 </xsl:template>
183 <!-- CASEINLINE -->
184 <xsl:template match="caseinline"><xsl:call-template name="insertcase" /></xsl:template>
185 <xsl:template match="caseinline" mode="embedded">
186 <xsl:call-template name="insertcase">
187 <xsl:with-param name="embedded" select="'yes'"/>
188 </xsl:call-template>
189 </xsl:template>
191 <!-- COMMENT -->
192 <xsl:template match="comment" />
193 <xsl:template match="comment" mode="embedded"/>
195 <!-- CREATED -->
196 <xsl:template match="created" />
198 <!-- DEFAULT -->
199 <xsl:template match="default"><xsl:call-template name="insertdefault" /></xsl:template>
200 <xsl:template match="default" mode="embedded">
201 <xsl:call-template name="insertdefault">
202 <xsl:with-param name="embedded" select="'yes'"/>
203 </xsl:call-template>
204 </xsl:template>
206 <!-- DEFAULTINLINE -->
207 <xsl:template match="defaultinline"><xsl:call-template name="insertdefault" /></xsl:template>
208 <xsl:template match="defaultinline" mode="embedded">
209 <xsl:call-template name="insertdefault">
210 <xsl:with-param name="embedded" select="'yes'"/>
211 </xsl:call-template>
212 </xsl:template>
214 <!-- EMBED -->
215 <xsl:template match="embed"><xsl:call-template name="resolveembed"/></xsl:template>
216 <xsl:template match="embed" mode="embedded"><xsl:call-template name="resolveembed"/></xsl:template>
218 <!-- EMBEDVAR -->
219 <xsl:template match="embedvar"><xsl:call-template name="resolveembedvar"/></xsl:template>
220 <xsl:template match="embedvar" mode="embedded"><xsl:call-template name="resolveembedvar"/></xsl:template>
222 <!-- EMPH -->
223 <xsl:template match="emph">
224 <span class="emph"><xsl:apply-templates /></span>
225 </xsl:template>
226 <xsl:template match="emph" mode="embedded">
227 <span class="emph"><xsl:apply-templates /></span>
228 </xsl:template>
230 <!-- SUB -->
231 <xsl:template match="sub">
232 <sub><xsl:apply-templates /></sub>
233 </xsl:template>
234 <xsl:template match="sub" mode="embedded">
235 <sub><xsl:apply-templates /></sub>
236 </xsl:template>
238 <!-- SUP -->
239 <xsl:template match="sup">
240 <sup><xsl:apply-templates /></sup>
241 </xsl:template>
242 <xsl:template match="sup" mode="embedded">
243 <sup><xsl:apply-templates /></sup>
244 </xsl:template>
246 <!-- FILENAME -->
247 <xsl:template match="filename" />
249 <!-- HISTORY -->
250 <xsl:template match="history" />
252 <!-- IMAGE -->
253 <xsl:template match="image"><xsl:call-template name="insertimage"/></xsl:template>
254 <xsl:template match="image" mode="embedded"><xsl:call-template name="insertimage"/></xsl:template>
256 <!-- ITEM -->
257 <xsl:template match="item"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
258 <xsl:template match="item" mode="embedded"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
260 <!-- LINK -->
261 <xsl:template match="link">
262 <xsl:choose> <!-- don't insert the heading link to itself -->
263 <xsl:when test="(concat('/',@href) = /helpdocument/meta/topic/filename) or (@href = /helpdocument/meta/topic/filename)">
264 <xsl:apply-templates />
265 </xsl:when>
266 <xsl:when test="contains(child::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
267 <xsl:call-template name="insert_howtoget">
268 <xsl:with-param name="linkhref" select="@href"/>
269 </xsl:call-template>
270 </xsl:when>
271 <xsl:otherwise>
272 <xsl:call-template name="createlink" />
273 </xsl:otherwise>
274 </xsl:choose>
275 </xsl:template>
276 <xsl:template match="link" mode="embedded">
277 <xsl:call-template name="createlink"/>
278 </xsl:template>
280 <!-- LIST -->
281 <xsl:template match="list">
282 <xsl:choose>
283 <xsl:when test="@type='ordered'">
284 <ol>
285 <xsl:if test="@startwith">
286 <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
287 </xsl:if>
288 <xsl:apply-templates />
289 </ol>
290 </xsl:when>
291 <xsl:otherwise>
292 <ul><xsl:apply-templates /></ul>
293 </xsl:otherwise>
294 </xsl:choose>
295 </xsl:template>
297 <xsl:template match="list" mode="embedded">
298 <xsl:choose>
299 <xsl:when test="@type='ordered'">
300 <ol>
301 <xsl:if test="@startwith">
302 <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
303 </xsl:if>
304 <xsl:apply-templates mode="embedded"/>
305 </ol>
306 </xsl:when>
307 <xsl:otherwise>
308 <ul><xsl:apply-templates mode="embedded"/></ul>
309 </xsl:otherwise>
310 </xsl:choose>
311 </xsl:template>
313 <!-- LISTITEM -->
314 <xsl:template match="listitem">
315 <li><xsl:apply-templates /></li>
316 </xsl:template>
318 <xsl:template match="listitem" mode="embedded">
319 <li><xsl:apply-templates mode="embedded"/></li>
320 </xsl:template>
322 <!-- META, SEE HEADER -->
323 <xsl:template match="meta" />
325 <!-- OBJECT (UNUSED) -->
326 <xsl:template match="object" />
328 <!-- PARAGRAPH -->
329 <xsl:template match="paragraph">
330 <xsl:choose>
332 <xsl:when test="@role='heading'">
333 <xsl:call-template name="insertheading">
334 <xsl:with-param name="level" select="@level"/>
335 </xsl:call-template>
336 </xsl:when>
338 <xsl:when test="contains(' note warning tip ',@role)">
339 <xsl:call-template name="insertnote">
340 <xsl:with-param name="type" select="@role" />
341 </xsl:call-template>
342 </xsl:when>
344 <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
345 <xsl:apply-templates />
346 </xsl:when>
348 <xsl:when test="@role='bascode'">
349 <xsl:call-template name="insertbascode" />
350 </xsl:when>
352 <xsl:when test="@role='logocode'">
353 <xsl:call-template name="insertlogocode" />
354 </xsl:when>
356 <xsl:otherwise>
357 <xsl:call-template name="insertpara" />
358 </xsl:otherwise>
360 </xsl:choose>
361 </xsl:template>
363 <xsl:template match="paragraph" mode="embedded">
364 <xsl:choose>
366 <xsl:when test="@role='heading'"> <!-- increase the level of headings that are embedded -->
367 <!--
368 The internal sablotron processor does not seem to support the number function.
369 Therefore, we need a workaround for
370 <xsl:variable name="level"><xsl:value-of select="number(@level)+1"/></xsl:variable>
372 <xsl:variable name="newlevel">
373 <xsl:choose>
374 <xsl:when test="@level='1'"><xsl:value-of select="'2'"/></xsl:when>
375 <xsl:when test="@level='2'"><xsl:value-of select="'2'"/></xsl:when>
376 <xsl:when test="@level='3'"><xsl:value-of select="'3'"/></xsl:when>
377 <xsl:when test="@level='4'"><xsl:value-of select="'4'"/></xsl:when>
378 <xsl:when test="@level='5'"><xsl:value-of select="'5'"/></xsl:when>
379 </xsl:choose>
380 </xsl:variable>
382 <xsl:call-template name="insertheading">
383 <xsl:with-param name="level" select="$newlevel"/>
384 <xsl:with-param name="embedded" select="'yes'"/>
385 </xsl:call-template>
386 </xsl:when>
388 <xsl:when test="contains(' note warning tip ',@role)">
389 <xsl:call-template name="insertnote">
390 <xsl:with-param name="type" select="@role" />
391 </xsl:call-template>
392 </xsl:when>
394 <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
395 <xsl:apply-templates />
396 </xsl:when>
398 <xsl:otherwise>
399 <xsl:call-template name="insertpara" />
400 </xsl:otherwise>
402 </xsl:choose>
403 </xsl:template>
406 <!-- SECTION -->
407 <xsl:template match="section">
408 <a name="{@id}"></a>
410 <xsl:choose>
412 <xsl:when test="@id='relatedtopics'">
413 <div class="relatedtopics">
414 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
415 <xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
416 <xsl:variable name="doc" select="document($href)"/>
417 <p class="related">
418 <xsl:apply-templates select="$doc//variable[@id=$anchor]"/>
419 </p>
420 <div class="relatedbody">
421 <xsl:apply-templates />
422 </div>
423 </div>
424 </xsl:when>
426 <xsl:when test="@id='howtoget'">
427 <xsl:call-template name="insert_howtoget" />
428 </xsl:when>
430 <xsl:otherwise>
431 <xsl:apply-templates/>
432 </xsl:otherwise>
434 </xsl:choose>
436 </xsl:template>
439 <!-- SECTION -->
440 <xsl:template match="section" mode="embedded">
441 <a name="{@id}"></a>
442 <xsl:apply-templates mode="embedded"/>
443 </xsl:template>
445 <!-- SORT -->
446 <xsl:template match="sort" >
447 <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
448 </xsl:template>
449 <xsl:template match="sort" mode="embedded">
450 <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
451 </xsl:template>
453 <!-- SWITCH -->
454 <xsl:template match="switch"><xsl:apply-templates /></xsl:template>
455 <xsl:template match="switch" mode="embedded"><xsl:apply-templates /></xsl:template>
457 <!-- SWITCHINLINE -->
458 <xsl:template match="switchinline"><xsl:apply-templates /></xsl:template>
459 <xsl:template match="switchinline" mode="embedded"><xsl:apply-templates mode="embedded"/></xsl:template>
461 <!-- TABLE -->
462 <xsl:template match="table"><xsl:call-template name="inserttable"/></xsl:template>
463 <xsl:template match="table" mode="embedded"><xsl:call-template name="inserttable"/></xsl:template>
465 <!-- TABLECELL -->
466 <xsl:template match="tablecell"><td valign="top"><xsl:apply-templates /></td></xsl:template>
467 <xsl:template match="tablecell" mode="icontable"><td valign="top"><xsl:apply-templates/></td></xsl:template>
468 <xsl:template match="tablecell" mode="embedded"><td valign="top"><xsl:apply-templates mode="embedded"/></td></xsl:template>
470 <!-- TABLEROW -->
471 <xsl:template match="tablerow"><tr><xsl:apply-templates /></tr></xsl:template>
472 <xsl:template match="tablerow" mode="icontable"><tr><xsl:apply-templates mode="icontable"/></tr></xsl:template>
473 <xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates mode="embedded"/></tr></xsl:template>
475 <!-- TITLE -->
476 <xsl:template match="title"/>
478 <!-- TOPIC -->
479 <xsl:template match="topic"/>
481 <!-- VARIABLE -->
482 <xsl:template match="variable"><a name="{@id}"></a><xsl:apply-templates /></xsl:template>
483 <xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template>
485 <xsl:template match="text()">
486 <xsl:call-template name="brand">
487 <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
488 </xsl:call-template>
489 </xsl:template>
491 <xsl:template match="text()" mode="embedded">
492 <xsl:call-template name="brand">
493 <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
494 </xsl:call-template>
495 </xsl:template>
497 <!-- In case of missing help files -->
498 <xsl:template match="help-id-missing"><xsl:value-of select="$Id"/></xsl:template>
500 <!--
501 ###################
502 # NAMED TEMPLATES #
503 ###################
504 //-->
506 <!-- Branding -->
507 <xsl:template name="brand" >
508 <xsl:param name="string"/>
510 <xsl:choose>
512 <xsl:when test="contains($string,$brand1)">
513 <xsl:variable name="newstr">
514 <xsl:value-of select="substring-before($string,$brand1)"/>
515 <xsl:value-of select="$productname"/>
516 <xsl:value-of select="substring-after($string,$brand1)"/>
517 </xsl:variable>
518 <xsl:call-template name="brand">
519 <xsl:with-param name="string" select="$newstr"/>
520 </xsl:call-template>
521 </xsl:when>
523 <xsl:when test="contains($string,$brand2)">
524 <xsl:variable name="newstr">
525 <xsl:value-of select="substring-before($string,$brand2)"/>
526 <xsl:value-of select="$pversion"/>
527 <xsl:value-of select="substring-after($string,$brand2)"/>
528 </xsl:variable>
529 <xsl:call-template name="brand">
530 <xsl:with-param name="string" select="$newstr"/>
531 </xsl:call-template>
532 </xsl:when>
534 <xsl:when test="contains($string,$brand3)">
535 <xsl:variable name="newstr">
536 <xsl:value-of select="substring-before($string,$brand3)"/>
537 <xsl:value-of select="$productname"/>
538 <xsl:value-of select="substring-after($string,$brand3)"/>
539 </xsl:variable>
540 <xsl:call-template name="brand">
541 <xsl:with-param name="string" select="$newstr"/>
542 </xsl:call-template>
543 </xsl:when>
545 <xsl:when test="contains($string,$brand4)">
546 <xsl:variable name="newstr">
547 <xsl:value-of select="substring-before($string,$brand4)"/>
548 <xsl:value-of select="$pversion"/>
549 <xsl:value-of select="substring-after($string,$brand4)"/>
550 </xsl:variable>
551 <xsl:call-template name="brand">
552 <xsl:with-param name="string" select="$newstr"/>
553 </xsl:call-template>
554 </xsl:when>
556 <xsl:otherwise>
557 <xsl:value-of select="$string"/>
558 </xsl:otherwise>
559 </xsl:choose>
561 </xsl:template>
564 <!-- Insert Paragraph -->
565 <xsl:template name="insertpara">
566 <xsl:variable name="role">
567 <xsl:choose>
568 <xsl:when test="ancestor::table">
569 <xsl:value-of select="concat(@role,'intable')"/>
570 </xsl:when>
571 <xsl:otherwise>
572 <xsl:value-of select="@role"/>
573 </xsl:otherwise>
574 </xsl:choose>
575 </xsl:variable>
576 <p class="{$role}"><xsl:apply-templates /></p>
577 </xsl:template>
579 <!-- Insert Basic code snippet -->
580 <xsl:template name="insertbascode">
581 <pre><xsl:apply-templates /></pre>
582 </xsl:template>
584 <!-- Insert Logo code snippet -->
585 <xsl:template name="insertlogocode">
586 <pre><xsl:apply-templates /></pre>
587 </xsl:template>
589 <!-- Insert "How to get Link" -->
590 <xsl:template name="insert_howtoget">
591 <xsl:param name="linkhref" />
592 <xsl:variable name="archive" select="'shared'"/>
593 <xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
594 <xsl:variable name="tmp_doc" select="document($tmp_href)"/>
595 <table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0">
596 <tr>
597 <td>
598 <p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p>
599 <div class="howtogetbody">
600 <xsl:choose>
601 <xsl:when test="$linkhref = ''"> <!-- new style -->
602 <xsl:apply-templates/>
603 </xsl:when>
604 <xsl:otherwise> <!-- old style -->
605 <xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable>
606 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable>
607 <xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable>
608 <xsl:variable name="docum" select="document($href)"/>
610 <xsl:call-template name="insertembed">
611 <xsl:with-param name="doc" select="$docum" />
612 <xsl:with-param name="anchor" select="$anc" />
613 </xsl:call-template>
615 </xsl:otherwise>
616 </xsl:choose>
617 </div>
618 </td>
619 </tr>
620 </table>
621 <br/>
622 </xsl:template>
624 <!-- Create a link -->
625 <xsl:template name="createlink">
626 <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
627 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
628 <xsl:choose>
629 <xsl:when test="starts-with(@href,'http://') or starts-with(@href,'https://')"> <!-- web links -->
630 <a href="{@href}"><xsl:apply-templates /></a>
631 </xsl:when>
632 <xsl:when test="contains(@href,'#')">
633 <xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable>
634 <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,substring-before(@href,'#'),$linkpostfix,$dbpostfix,$anchor)"/></xsl:variable>
635 <a href="{$href}"><xsl:apply-templates /></a>
636 </xsl:when>
637 <xsl:otherwise>
638 <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,@href,$linkpostfix,$dbpostfix)"/></xsl:variable>
639 <a href="{$href}"><xsl:apply-templates /></a>
640 </xsl:otherwise>
641 </xsl:choose>
642 </xsl:template>
644 <!-- Insert Note, Warning, or Tip -->
645 <xsl:template name="insertnote">
646 <xsl:param name="type" /> <!-- note, tip, or warning -->
647 <xsl:variable name="imgsrc">
648 <xsl:choose>
649 <xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when>
650 <xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when>
651 <xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when>
652 </xsl:choose>
653 </xsl:variable>
654 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable>
655 <xsl:variable name="alt">
656 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/',$alttext,$urlpost,$dbpostfix)"/></xsl:variable>
657 <xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable>
658 <xsl:variable name="doc" select="document($href)"/>
659 <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
660 </xsl:variable>
661 <div class="{$type}">
662 <table border="0" class="{$type}" cellspacing="0" cellpadding="5">
663 <tr>
664 <td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td>
665 <td><xsl:apply-templates /></td>
666 </tr>
667 </table>
668 </div>
669 <br/>
670 </xsl:template>
672 <!-- Insert a heading -->
673 <xsl:template name="insertheading">
674 <xsl:param name="level" />
675 <xsl:param name="embedded" />
676 <xsl:text disable-output-escaping="yes">&lt;h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
677 <xsl:choose>
678 <xsl:when test="$embedded = 'yes'">
679 <xsl:apply-templates mode="embedded"/>
680 </xsl:when>
681 <xsl:otherwise>
682 <xsl:apply-templates />
683 </xsl:otherwise>
684 </xsl:choose>
685 <xsl:text disable-output-escaping="yes">&lt;/h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
686 </xsl:template>
688 <!-- Evaluate a case or caseinline switch -->
689 <xsl:template name="insertcase">
690 <xsl:param name="embedded" />
691 <xsl:choose>
692 <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
693 <xsl:if test="@select = $System">
694 <xsl:choose>
695 <xsl:when test="$embedded = 'yes'">
696 <xsl:apply-templates mode="embedded"/>
697 </xsl:when>
698 <xsl:otherwise>
699 <xsl:apply-templates />
700 </xsl:otherwise>
701 </xsl:choose>
702 </xsl:if>
703 </xsl:when>
704 <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
705 <xsl:if test="@select = $appl">
706 <xsl:choose>
707 <xsl:when test="$embedded = 'yes'">
708 <xsl:apply-templates mode="embedded"/>
709 </xsl:when>
710 <xsl:otherwise>
711 <xsl:apply-templates />
712 </xsl:otherwise>
713 </xsl:choose>
714 </xsl:if>
715 </xsl:when>
716 <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
717 <xsl:if test="@select = $distrib">
718 <xsl:choose>
719 <xsl:when test="$embedded = 'yes'">
720 <xsl:apply-templates mode="embedded"/>
721 </xsl:when>
722 <xsl:otherwise>
723 <xsl:apply-templates />
724 </xsl:otherwise>
725 </xsl:choose>
726 </xsl:if>
727 </xsl:when>
728 </xsl:choose>
729 </xsl:template>
731 <!-- Evaluate a default or defaultinline switch -->
732 <xsl:template name="insertdefault">
733 <xsl:param name="embedded" />
735 <xsl:choose>
736 <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
737 <xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])">
738 <xsl:choose>
739 <xsl:when test="$embedded = 'yes'">
740 <xsl:apply-templates mode="embedded"/>
741 </xsl:when>
742 <xsl:otherwise>
743 <xsl:apply-templates />
744 </xsl:otherwise>
745 </xsl:choose>
746 </xsl:if>
747 </xsl:when>
748 <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
749 <xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])">
750 <xsl:choose>
751 <xsl:when test="$embedded = 'yes'">
752 <xsl:apply-templates mode="embedded"/>
753 </xsl:when>
754 <xsl:otherwise>
755 <xsl:apply-templates />
756 </xsl:otherwise>
757 </xsl:choose>
758 </xsl:if>
759 </xsl:when>
760 <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
761 <xsl:if test="not(../child::case[@select=$distrib]) and not(../child::caseinline[@select=$distrib])">
762 <xsl:choose>
763 <xsl:when test="$embedded = 'yes'">
764 <xsl:apply-templates mode="embedded"/>
765 </xsl:when>
766 <xsl:otherwise>
767 <xsl:apply-templates />
768 </xsl:otherwise>
769 </xsl:choose>
770 </xsl:if>
771 </xsl:when>
772 </xsl:choose>
773 </xsl:template>
775 <!-- evaluate embeds -->
776 <xsl:template name="insertembed">
777 <xsl:param name="doc" />
778 <xsl:param name="anchor" />
779 <!-- different embed targets (also falsely used embed instead embedvar) -->
780 <xsl:choose>
781 <xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name -->
782 <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
783 </xsl:when>
784 <xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name -->
785 <p class="embedded">
786 <xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/>
787 </p>
788 </xsl:when>
789 <xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name -->
790 <p class="embedded">
791 <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
792 </p>
793 </xsl:when>
794 <xsl:otherwise> <!-- then give up -->
795 <p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p>
796 </xsl:otherwise>
797 </xsl:choose>
798 </xsl:template>
800 <!-- Insert an image -->
801 <xsl:template name="insertimage">
802 <xsl:variable name="src">
803 <xsl:choose>
804 <xsl:when test="starts-with(@src,'media/')">
805 <xsl:value-of select="concat($img_url_internal,@src)"/>
806 </xsl:when>
807 <xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)">
808 <xsl:value-of select="concat($ExtensionPath,'/',@src)"/>
809 </xsl:when>
810 <xsl:otherwise>
811 <xsl:choose>
812 <xsl:when test="@localize='true'">
813 <xsl:value-of select="concat($img_url_prefix,@src,'?lang=',$lang)"/>
814 </xsl:when>
815 <xsl:otherwise>
816 <xsl:value-of select="concat($img_url_prefix,@src)"/>
817 </xsl:otherwise>
818 </xsl:choose>
819 </xsl:otherwise>
820 </xsl:choose>
821 </xsl:variable>
823 <!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>-->
824 <xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
825 <xsl:variable name="width" select="''"/> <!-- Images don't all have the correct size -->
826 <xsl:variable name="height" select="''"/><!-- Image don't all have the correct size -->
827 <img src="{$src}" alt="{$alt}" title="{$alt}">
828 <xsl:if test="not($width='')"><xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute></xsl:if>
829 <xsl:if test="not($height='')"><xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute></xsl:if>
830 </img>
831 </xsl:template>
833 <!-- Insert a Table -->
834 <xsl:template name="inserttable">
835 <xsl:variable name="imgsrc"> <!-- see if we are in an image table -->
836 <xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/>
837 </xsl:variable>
839 <xsl:choose>
841 <xsl:when test="count(descendant::tablecell)=1">
842 <table border="0" class="onecell" cellpadding="0" cellspacing="0">
843 <xsl:apply-templates />
844 </table>
845 </xsl:when>
847 <xsl:when test="descendant::tablecell[1]/descendant::image">
848 <table border="0" class="icontable" cellpadding="5" cellspacing="0">
849 <xsl:apply-templates mode="icontable"/>
850 </table>
851 </xsl:when>
853 <xsl:when test="@class='wide'">
854 <table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" >
855 <xsl:apply-templates />
856 </table>
857 </xsl:when>
859 <xsl:when test="not(@class='')">
860 <table border="1" class="{@class}" cellpadding="0" cellspacing="0" >
861 <xsl:apply-templates />
862 </table>
863 </xsl:when>
865 <xsl:otherwise>
866 <table border="1" class="border" cellpadding="0" cellspacing="0" >
867 <xsl:apply-templates />
868 </table>
869 </xsl:otherwise>
870 </xsl:choose>
872 <br/>
873 </xsl:template>
875 <xsl:template name="resolveembed">
876 <div class="embedded">
877 <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
878 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
879 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
880 <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
881 <xsl:variable name="docum" select="document($href)"/>
883 <xsl:call-template name="insertembed">
884 <xsl:with-param name="doc" select="$docum" />
885 <xsl:with-param name="anchor" select="$anc" />
886 </xsl:call-template>
888 </div>
889 </xsl:template>
891 <xsl:template name="resolveembedvar">
892 <xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
893 <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
894 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
895 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
896 <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
897 <xsl:variable name="doc" select="document($href)"/>
898 <xsl:choose>
899 <xsl:when test="$doc//variable[@id=$anchor]"> <!-- test for a variable of that name -->
900 <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
901 </xsl:when>
902 <xsl:otherwise> <!-- or give up -->
903 <span class="bug">[<xsl:value-of select="@href"/> not found].</span>
904 </xsl:otherwise>
905 </xsl:choose>
906 </xsl:if>
907 </xsl:template>
909 <!-- Apply -->
910 <xsl:template name="apply">
911 <xsl:param name="embedded" />
912 <xsl:choose>
913 <xsl:when test="$embedded = 'yes'">
914 <xsl:apply-templates mode="embedded"/>
915 </xsl:when>
916 <xsl:otherwise>
917 <xsl:apply-templates />
918 </xsl:otherwise>
919 </xsl:choose>
920 </xsl:template>
922 <xsl:template name="createDBpostfix">
923 <xsl:param name="archive"/>
924 <xsl:variable name="newDB">
925 <xsl:choose>
926 <xsl:when test="(substring($archive,1,6) = 'shared')"><xsl:value-of select="$Database"/></xsl:when>
927 <xsl:otherwise><xsl:value-of select="substring-before($archive,'/')"/></xsl:otherwise>
928 </xsl:choose>
929 </xsl:variable>
930 <xsl:value-of select="concat($am,'DbPAR=',$newDB)"/>
931 </xsl:template>
933 </xsl:stylesheet>