Update ooo320-m1
[ooovba.git] / helpcontent2 / source / auxiliary / main_transform.xsl
blob5686b2e5ee675e7fd0841a2ac991a06f07ed780a
1 <?xml version="1.0" encoding="UTF-8"?>
4 <!--***********************************************************************
5 This is the main transformation style sheet for transforming.
6 Only use with OOo 2.0
7 Owner: fpe@openoffice.org
8 =========================================================================
9 Changes Log
10 May 24 2004 Created
11 Aug 24 2004 Fixed for help2 CWS
12 Aug 27 2004 Added css link, fixed missing embed-mode for variable
13 Removed width/height for images
14 Sep 03 2004 Modularized xsl, added some embedded modes
15 Oct 08 2004 Fixed bug wrong mode "embedded" for links
16 Added embedded modes for embed and embedvar (for cascaded embeds)
17 Added <p> tags around falsely embedded pars and vars
18 Dec 08 2004 #i38483#, fixed wrong handling of web links
19 #i37377#, fixed missing usage of Database parameter for switching
20 Jan 04 2005 #i38905#, fixed buggy branding replacement template
21 Mar 17 2005 #i43972#, added language info to image URL, evaluate Language parameter
22 evaluate new localize attribute in images
23 May 10 2005 #i48785#, fixed wrong setting of distrib variable
24 Aug 16 2005 workaround for #i53365#
25 Aug 19 2005 fixed missing list processing in embedded sections
26 Aug 19 2005 #i53535#, fixed wrong handling of Database parameter
27 Oct 17 2006 #i70462#, disabled sorting to avoid output of error messages to console
28 Jun 15 2009 #i101799#, fixed wrong handling of http URLs with anchors
29 ***********************************************************************//-->
31 <!--
33 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35 Copyright 2008 by Sun Microsystems, Inc.
37 OpenOffice.org - a multi-platform office productivity suite
39 $RCSfile: main_transform.xsl,v $
41 $Revision: 1.18 $
43 This file is part of OpenOffice.org.
45 OpenOffice.org is free software: you can redistribute it and/or modify
46 it under the terms of the GNU Lesser General Public License version 3
47 only, as published by the Free Software Foundation.
49 OpenOffice.org is distributed in the hope that it will be useful,
50 but WITHOUT ANY WARRANTY; without even the implied warranty of
51 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52 GNU Lesser General Public License version 3 for more details
53 (a copy is included in the LICENSE file that accompanied this code).
55 You should have received a copy of the GNU Lesser General Public License
56 version 3 along with OpenOffice.org. If not, see
57 <http://www.openoffice.org/license.html>
58 for a copy of the LGPLv3 License.
60 -->
62 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
64 <xsl:output indent="yes" method="html"/>
66 <!--
67 ############################
68 # Variables and Parameters #
69 ############################
70 //-->
72 <!-- General Usage -->
73 <xsl:variable name="am" select="'&amp;'"/>
74 <xsl:variable name="sl" select="'/'"/>
75 <xsl:variable name="qt" select="'&quot;'"/>
77 <!-- generic Icon alt text -->
78 <xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/>
80 <!-- For calculating pixel sizes -->
81 <xsl:variable name="dpi" select="'96'"/>
82 <xsl:variable name="dpcm" select="'38'"/>
84 <!-- Product brand variables used in the help files -->
85 <xsl:variable name="brand1" select="'$[officename]'"/>
86 <xsl:variable name="brand2" select="'$[officeversion]'"/>
87 <xsl:variable name="brand3" select="'%PRODUCTNAME'"/>
88 <xsl:variable name="brand4" select="'%PRODUCTVERSION'"/>
90 <!-- meta data variables from the help file -->
91 <xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
92 <xsl:variable name="topic_id" select="/helpdocument/meta/topic/@id"/>
93 <xsl:variable name="topic_status" select="/helpdocument/meta/topic/@status"/>
94 <xsl:variable name="title" select="/helpdocument/meta/topic/title"/>
95 <xsl:variable name="doclang" select="/helpdocument/meta/topic/title/@xml-lang"/>
97 <!-- Module and the corresponding switching values-->
98 <xsl:param name="Database" select="'swriter'"/>
99 <xsl:variable name="module" select="$Database"/>
100 <xsl:variable name="appl">
101 <xsl:choose>
102 <xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when>
103 <xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when>
104 <xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when>
105 <xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when>
106 <xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when>
107 <xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when>
108 <xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when>
109 </xsl:choose>
110 </xsl:variable>
112 <!-- the other parameters given by the help caller -->
113 <xsl:param name="System" select="'WIN'"/>
114 <xsl:param name="productname" select="'Office'"/>
115 <xsl:param name="productversion" select="''"/>
116 <xsl:variable name="pversion">
117 <xsl:value-of select="translate($productversion,' ','')"/>
118 </xsl:variable>
119 <!-- this is were the images are -->
120 <xsl:param name="imgrepos" select="''"/>
121 <xsl:param name="Id" />
122 <!-- (lame) distinction between OS and Commercial -->
123 <xsl:param name="distrib">
124 <xsl:choose>
125 <xsl:when test="starts-with($productname,'OpenOffice')">
126 <xsl:value-of select="'OpenSource'"/>
127 </xsl:when>
128 <xsl:otherwise>
129 <xsl:value-of select="'COMMERCIAL'"/>
130 </xsl:otherwise>
131 </xsl:choose>
132 </xsl:param>
133 <xsl:param name="Language" select="'en-US'"/>
134 <xsl:variable name="lang" select="$Language"/>
136 <xsl:param name="ExtensionId" select="''"/>
137 <xsl:param name="ExtensionPath" select="''"/>
140 <!-- parts of help and image urls -->
141 <xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/>
142 <xsl:variable name="img_url_prefix" select="concat('vnd.sun.star.zip://',$imgrepos,'/')"/>
143 <xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/>
144 <xsl:variable name="urlpre" select="$help_url_prefix" />
145 <xsl:variable name="linkprefix" select="$urlpre"/>
146 <xsl:variable name="linkpostfix" select="$urlpost"/>
148 <xsl:variable name="css" select="'default.css'"/>
150 <!-- images for notes, tips and warnings -->
151 <xsl:variable name="note_img" select="concat($img_url_prefix,'res/helpimg/note.png')"/>
152 <xsl:variable name="tip_img" select="concat($img_url_prefix,'res/helpimg/tip.png')"/>
153 <xsl:variable name="warning_img" select="concat($img_url_prefix,'res/helpimg/warning.png')"/>
155 <!--
156 #############
157 # Templates #
158 #############
159 //-->
161 <!-- Create the document skeleton -->
162 <xsl:template match="/">
163 <xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/>
164 <html>
165 <head>
166 <title><xsl:value-of select="$title"/></title>
167 <link href="{$csslink}" rel="Stylesheet" type="text/css" /> <!-- stylesheet link -->
168 <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
169 </head>
170 <body lang="{$lang}">
171 <xsl:apply-templates select="/helpdocument/body"/>
172 </body>
173 </html>
174 </xsl:template>
176 <!-- AHELP -->
177 <xsl:template match="ahelp">
178 <xsl:if test="not(@visibility='hidden')"><span class="avis"><xsl:apply-templates /></span></xsl:if>
179 </xsl:template>
181 <!-- ALT -->
182 <xsl:template match="alt"/>
184 <!-- BOOKMARK -->
185 <xsl:template match="bookmark">
186 <a name="{@id}"></a>
187 <xsl:choose>
188 <xsl:when test="starts-with(@branch,'hid')" />
189 <xsl:otherwise><xsl:apply-templates /></xsl:otherwise>
190 </xsl:choose>
191 </xsl:template>
192 <xsl:template match="bookmark" mode="embedded" />
194 <!-- BOOKMARK_VALUE -->
195 <xsl:template match="bookmark_value" />
197 <!-- BR -->
198 <xsl:template match="br"><br /></xsl:template>
200 <!-- CAPTION -->
201 <xsl:template match="caption" />
203 <!-- CASE -->
204 <xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template>
205 <xsl:template match="case" mode="embedded">
206 <xsl:call-template name="insertcase">
207 <xsl:with-param name="embedded" select="'yes'"/>
208 </xsl:call-template>
209 </xsl:template>
211 <!-- CASEINLINE -->
212 <xsl:template match="caseinline"><xsl:call-template name="insertcase" /></xsl:template>
213 <xsl:template match="caseinline" mode="embedded">
214 <xsl:call-template name="insertcase">
215 <xsl:with-param name="embedded" select="'yes'"/>
216 </xsl:call-template>
217 </xsl:template>
219 <!-- COMMENT -->
220 <xsl:template match="comment" />
221 <xsl:template match="comment" mode="embedded"/>
223 <!-- CREATED -->
224 <xsl:template match="created" />
226 <!-- DEFAULT -->
227 <xsl:template match="default"><xsl:call-template name="insertdefault" /></xsl:template>
228 <xsl:template match="default" mode="embedded">
229 <xsl:call-template name="insertdefault">
230 <xsl:with-param name="embedded" select="'yes'"/>
231 </xsl:call-template>
232 </xsl:template>
234 <!-- DEFAULTINLINE -->
235 <xsl:template match="defaultinline"><xsl:call-template name="insertdefault" /></xsl:template>
236 <xsl:template match="defaultinline" mode="embedded">
237 <xsl:call-template name="insertdefault">
238 <xsl:with-param name="embedded" select="'yes'"/>
239 </xsl:call-template>
240 </xsl:template>
242 <!-- EMBED -->
243 <xsl:template match="embed"><xsl:call-template name="resolveembed"/></xsl:template>
244 <xsl:template match="embed" mode="embedded"><xsl:call-template name="resolveembed"/></xsl:template>
246 <!-- EMBEDVAR -->
247 <xsl:template match="embedvar"><xsl:call-template name="resolveembedvar"/></xsl:template>
248 <xsl:template match="embedvar" mode="embedded"><xsl:call-template name="resolveembedvar"/></xsl:template>
250 <!-- EMPH -->
251 <xsl:template match="emph">
252 <span class="emph"><xsl:apply-templates /></span>
253 </xsl:template>
254 <xsl:template match="emph" mode="embedded">
255 <span class="emph"><xsl:apply-templates /></span>
256 </xsl:template>
258 <!-- FILENAME -->
259 <xsl:template match="filename" />
261 <!-- HISTORY -->
262 <xsl:template match="history" />
264 <!-- IMAGE -->
265 <xsl:template match="image"><xsl:call-template name="insertimage"/></xsl:template>
266 <xsl:template match="image" mode="embedded"><xsl:call-template name="insertimage"/></xsl:template>
268 <!-- ITEM -->
269 <xsl:template match="item"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
270 <xsl:template match="item" mode="embedded"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
272 <!-- LASTEDITED -->
273 <xsl:template match="lastedited" />
275 <!-- LINK -->
276 <xsl:template match="link">
277 <xsl:choose> <!-- don't insert the heading link to itself -->
278 <xsl:when test="(concat('/',@href) = /helpdocument/meta/topic/filename) or (@href = /helpdocument/meta/topic/filename)">
279 <xsl:apply-templates />
280 </xsl:when>
281 <xsl:when test="contains(child::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
282 <xsl:call-template name="insert_howtoget">
283 <xsl:with-param name="linkhref" select="@href"/>
284 </xsl:call-template>
285 </xsl:when>
286 <xsl:otherwise>
287 <xsl:call-template name="createlink" />
288 </xsl:otherwise>
289 </xsl:choose>
290 </xsl:template>
291 <xsl:template match="link" mode="embedded">
292 <xsl:call-template name="createlink"/>
293 </xsl:template>
295 <!-- LIST -->
296 <xsl:template match="list">
297 <xsl:choose>
298 <xsl:when test="@type='ordered'">
299 <ol>
300 <xsl:if test="@startwith">
301 <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
302 </xsl:if>
303 <xsl:apply-templates />
304 </ol>
305 </xsl:when>
306 <xsl:otherwise>
307 <ul><xsl:apply-templates /></ul>
308 </xsl:otherwise>
309 </xsl:choose>
310 </xsl:template>
312 <xsl:template match="list" mode="embedded">
313 <xsl:choose>
314 <xsl:when test="@type='ordered'">
315 <ol>
316 <xsl:if test="@startwith">
317 <xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
318 </xsl:if>
319 <xsl:apply-templates mode="embedded"/>
320 </ol>
321 </xsl:when>
322 <xsl:otherwise>
323 <ul><xsl:apply-templates mode="embedded"/></ul>
324 </xsl:otherwise>
325 </xsl:choose>
326 </xsl:template>
328 <!-- LISTITEM -->
329 <xsl:template match="listitem">
330 <li><xsl:apply-templates /></li>
331 </xsl:template>
333 <xsl:template match="listitem" mode="embedded">
334 <li><xsl:apply-templates mode="embedded"/></li>
335 </xsl:template>
337 <!-- META, SEE HEADER -->
338 <xsl:template match="meta" />
340 <!-- OBJECT (UNUSED) -->
341 <xsl:template match="object" />
343 <!-- PARAGRAPH -->
344 <xsl:template match="paragraph">
345 <xsl:choose>
347 <xsl:when test="@role='heading'">
348 <xsl:call-template name="insertheading">
349 <xsl:with-param name="level" select="@level"/>
350 </xsl:call-template>
351 </xsl:when>
353 <xsl:when test="contains(' note warning tip ',@role)">
354 <xsl:call-template name="insertnote">
355 <xsl:with-param name="type" select="@role" />
356 </xsl:call-template>
357 </xsl:when>
359 <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
360 <xsl:apply-templates />
361 </xsl:when>
363 <xsl:otherwise>
364 <xsl:call-template name="insertpara" />
365 </xsl:otherwise>
367 </xsl:choose>
368 </xsl:template>
370 <xsl:template match="paragraph" mode="embedded">
371 <xsl:choose>
373 <xsl:when test="@role='heading'"> <!-- increase the level of headings that are embedded -->
374 <!--
375 The internal sablotron processor does not seem to support the number function.
376 Therefore, we need a workaround for
377 <xsl:variable name="level"><xsl:value-of select="number(@level)+1"/></xsl:variable>
379 <xsl:variable name="newlevel">
380 <xsl:choose>
381 <xsl:when test="@level='1'"><xsl:value-of select="'2'"/></xsl:when>
382 <xsl:when test="@level='2'"><xsl:value-of select="'2'"/></xsl:when>
383 <xsl:when test="@level='3'"><xsl:value-of select="'3'"/></xsl:when>
384 <xsl:when test="@level='4'"><xsl:value-of select="'4'"/></xsl:when>
385 <xsl:when test="@level='5'"><xsl:value-of select="'5'"/></xsl:when>
386 </xsl:choose>
387 </xsl:variable>
389 <xsl:call-template name="insertheading">
390 <xsl:with-param name="level" select="$newlevel"/>
391 <xsl:with-param name="embedded" select="'yes'"/>
392 </xsl:call-template>
393 </xsl:when>
395 <xsl:when test="contains(' note warning tip ',@role)">
396 <xsl:call-template name="insertnote">
397 <xsl:with-param name="type" select="@role" />
398 </xsl:call-template>
399 </xsl:when>
401 <xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
402 <xsl:apply-templates />
403 </xsl:when>
405 <xsl:otherwise>
406 <xsl:call-template name="insertpara" />
407 </xsl:otherwise>
409 </xsl:choose>
410 </xsl:template>
413 <!-- SECTION -->
414 <xsl:template match="section">
415 <a name="{@id}"></a>
417 <xsl:choose>
419 <xsl:when test="@id='relatedtopics'">
420 <div class="relatedtopics">
421 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
422 <xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
423 <xsl:variable name="doc" select="document($href)"/>
424 <p class="related">
425 <xsl:apply-templates select="$doc//variable[@id=$anchor]"/>
426 </p>
427 <div class="relatedbody">
428 <xsl:apply-templates />
429 </div>
430 </div>
431 </xsl:when>
433 <xsl:when test="@id='howtoget'">
434 <xsl:call-template name="insert_howtoget" />
435 </xsl:when>
437 <xsl:otherwise>
438 <xsl:apply-templates/>
439 </xsl:otherwise>
441 </xsl:choose>
443 </xsl:template>
446 <!-- SECTION -->
447 <xsl:template match="section" mode="embedded">
448 <a name="{@id}"></a>
449 <xsl:apply-templates mode="embedded"/>
450 </xsl:template>
452 <!-- SORT -->
453 <xsl:template match="sort" >
454 <!-- sorting disabled due to #i70462#
455 <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
456 //-->
457 <xsl:apply-templates />
458 </xsl:template>
459 <xsl:template match="sort" mode="embedded">
460 <!-- sorting disabled due to #i70462#
461 <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
462 //-->
463 <xsl:apply-templates />
464 </xsl:template>
466 <!-- SWITCH -->
467 <xsl:template match="switch"><xsl:apply-templates /></xsl:template>
468 <xsl:template match="switch" mode="embedded"><xsl:apply-templates /></xsl:template>
470 <!-- SWITCHINLINE -->
471 <xsl:template match="switchinline"><xsl:apply-templates /></xsl:template>
472 <xsl:template match="switchinline" mode="embedded"><xsl:apply-templates mode="embedded"/></xsl:template>
474 <!-- TABLE -->
475 <xsl:template match="table"><xsl:call-template name="inserttable"/></xsl:template>
476 <xsl:template match="table" mode="embedded"><xsl:call-template name="inserttable"/></xsl:template>
478 <!-- TABLECELL -->
479 <xsl:template match="tablecell"><td valign="top"><xsl:apply-templates /></td></xsl:template>
480 <xsl:template match="tablecell" mode="icontable"><td valign="top"><xsl:apply-templates/></td></xsl:template>
481 <xsl:template match="tablecell" mode="embedded"><td valign="top"><xsl:apply-templates mode="embedded"/></td></xsl:template>
483 <!-- TABLEROW -->
484 <xsl:template match="tablerow"><tr><xsl:apply-templates /></tr></xsl:template>
485 <xsl:template match="tablerow" mode="icontable"><tr><xsl:apply-templates mode="icontable"/></tr></xsl:template>
486 <xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates mode="embedded"/></tr></xsl:template>
488 <!-- TITLE -->
489 <xsl:template match="title"/>
491 <!-- TOPIC -->
492 <xsl:template match="topic"/>
494 <!-- VARIABLE -->
495 <xsl:template match="variable"><a name="{@id}"></a><xsl:apply-templates /></xsl:template>
496 <xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template>
498 <xsl:template match="text()">
499 <xsl:call-template name="brand">
500 <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
501 </xsl:call-template>
502 </xsl:template>
504 <xsl:template match="text()" mode="embedded">
505 <xsl:call-template name="brand">
506 <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
507 </xsl:call-template>
508 </xsl:template>
510 <!-- In case of missing help files -->
511 <xsl:template match="help-id-missing"><xsl:value-of select="$Id"/></xsl:template>
513 <!--
514 ###################
515 # NAMED TEMPLATES #
516 ###################
517 //-->
519 <!-- Branding -->
520 <xsl:template name="brand" >
521 <xsl:param name="string"/>
523 <xsl:choose>
525 <xsl:when test="contains($string,$brand1)">
526 <xsl:variable name="newstr">
527 <xsl:value-of select="substring-before($string,$brand1)"/>
528 <xsl:value-of select="$productname"/>
529 <xsl:value-of select="substring-after($string,$brand1)"/>
530 </xsl:variable>
531 <xsl:call-template name="brand">
532 <xsl:with-param name="string" select="$newstr"/>
533 </xsl:call-template>
534 </xsl:when>
536 <xsl:when test="contains($string,$brand2)">
537 <xsl:variable name="newstr">
538 <xsl:value-of select="substring-before($string,$brand2)"/>
539 <xsl:value-of select="$pversion"/>
540 <xsl:value-of select="substring-after($string,$brand2)"/>
541 </xsl:variable>
542 <xsl:call-template name="brand">
543 <xsl:with-param name="string" select="$newstr"/>
544 </xsl:call-template>
545 </xsl:when>
547 <xsl:when test="contains($string,$brand3)">
548 <xsl:variable name="newstr">
549 <xsl:value-of select="substring-before($string,$brand3)"/>
550 <xsl:value-of select="$productname"/>
551 <xsl:value-of select="substring-after($string,$brand3)"/>
552 </xsl:variable>
553 <xsl:call-template name="brand">
554 <xsl:with-param name="string" select="$newstr"/>
555 </xsl:call-template>
556 </xsl:when>
558 <xsl:when test="contains($string,$brand4)">
559 <xsl:variable name="newstr">
560 <xsl:value-of select="substring-before($string,$brand4)"/>
561 <xsl:value-of select="$pversion"/>
562 <xsl:value-of select="substring-after($string,$brand4)"/>
563 </xsl:variable>
564 <xsl:call-template name="brand">
565 <xsl:with-param name="string" select="$newstr"/>
566 </xsl:call-template>
567 </xsl:when>
569 <xsl:otherwise>
570 <xsl:value-of select="$string"/>
571 </xsl:otherwise>
572 </xsl:choose>
574 </xsl:template>
577 <!-- Insert Paragraph -->
578 <xsl:template name="insertpara">
579 <xsl:variable name="role">
580 <xsl:choose>
581 <xsl:when test="ancestor::table">
582 <xsl:value-of select="concat(@role,'intable')"/>
583 </xsl:when>
584 <xsl:otherwise>
585 <xsl:value-of select="@role"/>
586 </xsl:otherwise>
587 </xsl:choose>
588 </xsl:variable>
589 <p class="{$role}"><xsl:apply-templates /></p>
590 </xsl:template>
592 <!-- Insert "How to get Link" -->
593 <xsl:template name="insert_howtoget">
594 <xsl:param name="linkhref" />
595 <xsl:variable name="archive" select="'shared'"/>
596 <xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
597 <xsl:variable name="tmp_doc" select="document($tmp_href)"/>
598 <table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0">
599 <tr>
600 <td>
601 <p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p>
602 <div class="howtogetbody">
603 <xsl:choose>
604 <xsl:when test="$linkhref = ''"> <!-- new style -->
605 <xsl:apply-templates/>
606 </xsl:when>
607 <xsl:otherwise> <!-- old style -->
608 <xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable>
609 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable>
610 <xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable>
611 <xsl:variable name="docum" select="document($href)"/>
613 <xsl:call-template name="insertembed">
614 <xsl:with-param name="doc" select="$docum" />
615 <xsl:with-param name="anchor" select="$anc" />
616 </xsl:call-template>
618 </xsl:otherwise>
619 </xsl:choose>
620 </div>
621 </td>
622 </tr>
623 </table>
624 <br/>
625 </xsl:template>
627 <!-- Create a link -->
628 <xsl:template name="createlink">
629 <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
630 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
631 <xsl:choose>
632 <xsl:when test="starts-with(@href,'http://')"> <!-- web links -->
633 <a href="{@href}"><xsl:apply-templates /></a>
634 </xsl:when>
635 <xsl:when test="contains(@href,'#')">
636 <xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable>
637 <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,substring-before(@href,'#'),$linkpostfix,$dbpostfix,$anchor)"/></xsl:variable>
638 <a href="{$href}"><xsl:apply-templates /></a>
639 </xsl:when>
640 <xsl:otherwise>
641 <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,@href,$linkpostfix,$dbpostfix)"/></xsl:variable>
642 <a href="{$href}"><xsl:apply-templates /></a>
643 </xsl:otherwise>
644 </xsl:choose>
645 </xsl:template>
647 <!-- Insert Note, Warning, or Tip -->
648 <xsl:template name="insertnote">
649 <xsl:param name="type" /> <!-- note, tip, or warning -->
650 <xsl:variable name="imgsrc">
651 <xsl:choose>
652 <xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when>
653 <xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when>
654 <xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when>
655 </xsl:choose>
656 </xsl:variable>
657 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable>
658 <xsl:variable name="alt">
659 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/',$alttext,$urlpost,$dbpostfix)"/></xsl:variable>
660 <xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable>
661 <xsl:variable name="doc" select="document($href)"/>
662 <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
663 </xsl:variable>
664 <div class="{$type}">
665 <table border="0" class="{$type}" cellspacing="0" cellpadding="5">
666 <tr>
667 <td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td>
668 <td><xsl:apply-templates /></td>
669 </tr>
670 </table>
671 </div>
672 <br/>
673 </xsl:template>
675 <!-- Insert a heading -->
676 <xsl:template name="insertheading">
677 <xsl:param name="level" />
678 <xsl:param name="embedded" />
679 <xsl:text disable-output-escaping="yes">&lt;h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
680 <xsl:choose>
681 <xsl:when test="$embedded = 'yes'">
682 <xsl:apply-templates mode="embedded"/>
683 </xsl:when>
684 <xsl:otherwise>
685 <xsl:apply-templates />
686 </xsl:otherwise>
687 </xsl:choose>
688 <xsl:text disable-output-escaping="yes">&lt;/h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
689 </xsl:template>
691 <!-- Evaluate a case or caseinline switch -->
692 <xsl:template name="insertcase">
693 <xsl:param name="embedded" />
694 <xsl:choose>
695 <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
696 <xsl:if test="@select = $System">
697 <xsl:choose>
698 <xsl:when test="$embedded = 'yes'">
699 <xsl:apply-templates mode="embedded"/>
700 </xsl:when>
701 <xsl:otherwise>
702 <xsl:apply-templates />
703 </xsl:otherwise>
704 </xsl:choose>
705 </xsl:if>
706 </xsl:when>
707 <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
708 <xsl:if test="@select = $appl">
709 <xsl:choose>
710 <xsl:when test="$embedded = 'yes'">
711 <xsl:apply-templates mode="embedded"/>
712 </xsl:when>
713 <xsl:otherwise>
714 <xsl:apply-templates />
715 </xsl:otherwise>
716 </xsl:choose>
717 </xsl:if>
718 </xsl:when>
719 <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
720 <xsl:if test="@select = $distrib">
721 <xsl:choose>
722 <xsl:when test="$embedded = 'yes'">
723 <xsl:apply-templates mode="embedded"/>
724 </xsl:when>
725 <xsl:otherwise>
726 <xsl:apply-templates />
727 </xsl:otherwise>
728 </xsl:choose>
729 </xsl:if>
730 </xsl:when>
731 </xsl:choose>
732 </xsl:template>
734 <!-- Evaluate a default or defaultinline switch -->
735 <xsl:template name="insertdefault">
736 <xsl:param name="embedded" />
738 <xsl:choose>
739 <xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
740 <xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])">
741 <xsl:choose>
742 <xsl:when test="$embedded = 'yes'">
743 <xsl:apply-templates mode="embedded"/>
744 </xsl:when>
745 <xsl:otherwise>
746 <xsl:apply-templates />
747 </xsl:otherwise>
748 </xsl:choose>
749 </xsl:if>
750 </xsl:when>
751 <xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
752 <xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])">
753 <xsl:choose>
754 <xsl:when test="$embedded = 'yes'">
755 <xsl:apply-templates mode="embedded"/>
756 </xsl:when>
757 <xsl:otherwise>
758 <xsl:apply-templates />
759 </xsl:otherwise>
760 </xsl:choose>
761 </xsl:if>
762 </xsl:when>
763 <xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
764 <xsl:if test="not(../child::case[@select=$distrib]) and not(../child::caseinline[@select=$distrib])">
765 <xsl:choose>
766 <xsl:when test="$embedded = 'yes'">
767 <xsl:apply-templates mode="embedded"/>
768 </xsl:when>
769 <xsl:otherwise>
770 <xsl:apply-templates />
771 </xsl:otherwise>
772 </xsl:choose>
773 </xsl:if>
774 </xsl:when>
775 </xsl:choose>
776 </xsl:template>
778 <!-- evaluate embeds -->
779 <xsl:template name="insertembed">
780 <xsl:param name="doc" />
781 <xsl:param name="anchor" />
782 <!-- different embed targets (also falsely used embed instead embedvar) -->
783 <xsl:choose>
784 <xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name -->
785 <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
786 </xsl:when>
787 <xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name -->
788 <p class="embedded">
789 <xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/>
790 </p>
791 </xsl:when>
792 <xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name -->
793 <p class="embedded">
794 <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
795 </p>
796 </xsl:when>
797 <xsl:otherwise> <!-- then give up -->
798 <p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p>
799 </xsl:otherwise>
800 </xsl:choose>
801 </xsl:template>
803 <!-- Insert an image -->
804 <xsl:template name="insertimage">
806 <xsl:variable name="fpath">
807 <xsl:call-template name="getfpath">
808 <xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
809 </xsl:call-template>
810 </xsl:variable>
812 <xsl:variable name="fname">
813 <xsl:call-template name="getfname">
814 <xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
815 </xsl:call-template>
816 </xsl:variable>
818 <xsl:variable name="src">
819 <xsl:choose>
820 <xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)">
821 <xsl:value-of select="concat($ExtensionPath,'/',@src)"/>
822 </xsl:when>
823 <xsl:otherwise>
824 <xsl:choose>
825 <xsl:when test="(@localize='true') and not($lang='en-US')">
826 <xsl:value-of select="concat($img_url_prefix,$fpath,$lang,'/',$fname)"/>
827 </xsl:when>
828 <xsl:otherwise>
829 <xsl:value-of select="concat($img_url_prefix,$fpath,$fname)"/>
830 </xsl:otherwise>
831 </xsl:choose>
832 </xsl:otherwise>
833 </xsl:choose>
834 </xsl:variable>
836 <!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>-->
837 <xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
838 <xsl:variable name="width" select="''"/> <!-- Images don't all have the correct size -->
839 <xsl:variable name="height" select="''"/><!-- Image don't all have the correct size -->
840 <img src="{$src}" alt="{$alt}" title="{$alt}">
841 <xsl:if test="not($width='')"><xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute></xsl:if>
842 <xsl:if test="not($height='')"><xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute></xsl:if>
843 </img>
844 </xsl:template>
846 <!-- Insert a Table -->
847 <xsl:template name="inserttable">
848 <xsl:variable name="imgsrc"> <!-- see if we are in an image table -->
849 <xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/>
850 </xsl:variable>
852 <xsl:choose>
854 <xsl:when test="count(descendant::tablecell)=1">
855 <table border="0" class="onecell" cellpadding="0" cellspacing="0">
856 <xsl:apply-templates />
857 </table>
858 </xsl:when>
860 <xsl:when test="descendant::tablecell[1]/descendant::image">
861 <table border="0" class="icontable" cellpadding="5" cellspacing="0">
862 <xsl:apply-templates mode="icontable"/>
863 </table>
864 </xsl:when>
866 <xsl:when test="@class='wide'">
867 <table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" >
868 <xsl:apply-templates />
869 </table>
870 </xsl:when>
872 <xsl:when test="not(@class='')">
873 <table border="1" class="{@class}" cellpadding="0" cellspacing="0" >
874 <xsl:apply-templates />
875 </table>
876 </xsl:when>
878 <xsl:otherwise>
879 <table border="1" class="border" cellpadding="0" cellspacing="0" >
880 <xsl:apply-templates />
881 </table>
882 </xsl:otherwise>
883 </xsl:choose>
885 <br/>
886 </xsl:template>
888 <xsl:template name="resolveembed">
889 <div class="embedded">
890 <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
891 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
892 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
893 <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
894 <xsl:variable name="docum" select="document($href)"/>
896 <xsl:call-template name="insertembed">
897 <xsl:with-param name="doc" select="$docum" />
898 <xsl:with-param name="anchor" select="$anc" />
899 </xsl:call-template>
901 </div>
902 </xsl:template>
904 <xsl:template name="resolveembedvar">
905 <xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
906 <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
907 <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
908 <xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
909 <xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
910 <xsl:variable name="doc" select="document($href)"/>
911 <xsl:choose>
912 <xsl:when test="$doc//variable[@id=$anchor]"> <!-- test for a variable of that name -->
913 <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
914 </xsl:when>
915 <xsl:otherwise> <!-- or give up -->
916 <span class="bug">[<xsl:value-of select="@href"/> not found].</span>
917 </xsl:otherwise>
918 </xsl:choose>
919 </xsl:if>
920 </xsl:template>
922 <!-- Apply -->
923 <xsl:template name="apply">
924 <xsl:param name="embedded" />
925 <xsl:choose>
926 <xsl:when test="$embedded = 'yes'">
927 <xsl:apply-templates mode="embedded"/>
928 </xsl:when>
929 <xsl:otherwise>
930 <xsl:apply-templates />
931 </xsl:otherwise>
932 </xsl:choose>
933 </xsl:template>
935 <xsl:template name="getfpath">
936 <xsl:param name="s"/>
937 <xsl:param name="p"/>
938 <xsl:choose>
939 <xsl:when test="contains($s,'/')">
940 <xsl:call-template name="getfpath">
941 <xsl:with-param name="p"><xsl:value-of select="concat($p,substring-before($s,'/'),'/')"/></xsl:with-param>
942 <xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
943 </xsl:call-template>
944 </xsl:when>
945 <xsl:otherwise>
946 <xsl:value-of select="$p"/>
947 </xsl:otherwise>
948 </xsl:choose>
949 </xsl:template>
951 <xsl:template name="getfname">
952 <xsl:param name="s"/>
953 <xsl:choose>
954 <xsl:when test="contains($s,'/')">
955 <xsl:call-template name="getfname">
956 <xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
957 </xsl:call-template>
958 </xsl:when>
959 <xsl:otherwise>
960 <xsl:value-of select="$s"/>
961 </xsl:otherwise>
962 </xsl:choose>
963 </xsl:template>
965 <xsl:template name="createDBpostfix">
966 <xsl:param name="archive"/>
967 <xsl:variable name="newDB">
968 <xsl:choose>
969 <xsl:when test="(substring($archive,1,6) = 'shared')"><xsl:value-of select="$Database"/></xsl:when>
970 <xsl:otherwise><xsl:value-of select="substring-before($archive,'/')"/></xsl:otherwise>
971 </xsl:choose>
972 </xsl:variable>
973 <xsl:value-of select="concat($am,'DbPAR=',$newDB)"/>
974 </xsl:template>
976 </xsl:stylesheet>