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