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