home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 October / PCWorld_2004-10_cd.bin / akce / openoffice / f_0272 / main_transform.xsl
Extensible Markup Language  |  2003-11-12  |  48KB  |  1,180 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <!--
  4.    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  5.    | This is the transformation style sheet for Help files            |
  6.    | (main_tranform.xsl).                                             |
  7.    |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
  8.    | Copyright ┬⌐ 2002 Sun Microsystems, Inc. All rights reserved.     |
  9.    | Use of this product is subject to license terms.                 |
  10.    |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
  11.    | FPE                                                              |
  12.    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  13.    | You should not edit this file unless you know what you're doing! |
  14.    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  15.    | Revision History                                                 |
  16.    | ================                                                 |
  17.    |                                                                  |
  18.    |  27-Jul-01: Evaluation of $Program replaced by declaration       |
  19.    |             of $Prog for the same purpose                        |
  20.    |  09-Aug-01: Added evaluation of th in "How to get"-popups.       | 
  21.    |             Changed evaluation of icon/name tables within that.  |
  22.    |  09-Aug-01: Added special formatting of "Related" header         |
  23.    |             (styleclass "reltop")                                |
  24.    |  09-Aug-01: Added variable for column width of first columns of  |
  25.    |             tables with icons                                    |
  26.    |  14-Aug-01: Fixed Bug: Switches were not evaluated in document   |
  27.    |             title h1                                             |
  28.    |  14-Aug-01: Fixed Bug: System switches were falsely evaluated.   |
  29.    |             Changed the way of switch evaluation, now using modes|
  30.    |  17-AUG-01: Fixed Bug: switch as direct child of embedded were   |
  31.    |             not evaluated                                        |
  32.    |  22-Aug-01: Fixed: Axis PRECEDING no longer used (wasn't         |
  33.    |             supported by processor)                              |
  34.    |  22-Aug-01: Now empty Howtoget links are ignored                 |
  35.    |  27-Aug-01: Now the image size is evaluated (from cm to pixels)  |
  36.    |             and included in the img tags.                        |
  37.    |  28-Aug-01: Embedded Paras now check for a <p> ancestor          |
  38.    |             instead of a parent.                                 |
  39.    |  30-Aug-01: Added recursive evaluation of embedded text          |
  40.    |  02-Oct-01: ABI: Added parameter cs for use in css url           |
  41.    |  10-Oct-01: Added handling for text:tab-stop and text:s          |
  42.    |  10-Oct-01: Added handling for source file admin information     |
  43.    |  15-Oct-01: Fixed Bug: fix URL vnd.sun.star.help for internal URL| 
  44.    |             calls (embedded + popup-cut), $sm for external calls |
  45.    |  19-Oct-01: Added handling of product variable parameters        |
  46.    |  25-Oct-01: Removed insertion of hr before h2                    |
  47.    |  25-Oct-01: Added language handling                              |
  48.    |  15-Nov-01: Fixed Bug: embedded productname tags were not        |
  49.    |             replaced                                             |
  50.    |  15-Nov-01: Fixed Bug: embedde ol/ul were not evaluated due      |
  51.    |             to a typo                                            |
  52.    |  10-Dec-01: Changed transcription of "Head"s. Now they are       |
  53.    |             transformed to <h>s                                  |
  54.    |  10-Dec-01: Added OOo-switch for Product                         |
  55.    |  26-Mar-02: Added autosetting of name for hyperlink tags         |
  56.    |             (Accessibility issue)                                |
  57.    |  16-May-02: Fixed autonaming of links                            |
  58.    |  16-May-02: Added alt tag for images                             |
  59.    |  16-May-02: Changed size calculation for images                  |
  60.    |  27-Jun-02: Fixed bug, no evaluation of switches inside certain  |
  61.    |             popups                                               |
  62.    |  11-Oct-02: For accessibility reasons: Removed formatting topic  |
  63.    |             title inside table                                   |
  64.    |  27-Jan-03: Fixed bug for PRODUCT switch                         |
  65.    |  27-Jan-03: Added <help:paragraphinfo/> template                 |
  66.    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  67. //-->
  68.  
  69. <xsl:stylesheet version="1.0" 
  70.   xmlns:nu="http://www.jclark.com/xt/java/com.sun.xmlsearch.tree.NodeUtils" 
  71.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  72.   xmlns:office="http://openoffice.org/2000/office" 
  73.   xmlns:style="http://openoffice.org/2000/style"  
  74.   xmlns:text="http://openoffice.org/2000/text"  
  75.   xmlns:table="http://openoffice.org/2000/table"  
  76.   xmlns:draw="http://openoffice.org/2000/drawing" 
  77.   xmlns:fo="http://www.w3.org/1999/XSL/Format"  
  78.   xmlns:xlink="http://www.w3.org/1999/xlink" 
  79.   xmlns:dc="http://purl.org/dc/elements/1.1/"   
  80.   xmlns:meta="http://openoffice.org/2000/meta" 
  81.   xmlns:number="http://openoffice.org/2000/datastyle" 
  82.   xmlns:svg="http://www.w3.org/2000/svg" 
  83.   xmlns:chart="http://openoffice.org/2000/chart" 
  84.   xmlns:help="http://openoffice.org/2000/help">
  85.   
  86.   <!-- Generate html code -->
  87.   <xsl:output method="html"/>
  88.   
  89.   <!-- 
  90.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  91.   | STYLESHEET PARAMETER DEFINITION                                  |
  92.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  93.   | These are used to define the parameters handed over to the       |
  94.   | stylesheet processor. They are used to build the help URLs       |
  95.   | and for application and product/name evaluation.                 |
  96.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  97.   -->
  98.  
  99.     <!-- Unused parameter of mysterious origin ?-->
  100.   <xsl:param name="Device" select="'WARP'"/>
  101.   
  102.   <!-- Parameters used to construct the URL prefix -->
  103.   <xsl:param name="hp" select="''"/>
  104.   <xsl:param name="sm" select="'vnd.sun.star.help://'"/>
  105.   <xsl:param name="qm" select="'?'"/>
  106.   <xsl:param name="es" select="'='"/>
  107.   <xsl:param name="am" select="'&'"/>
  108.   <xsl:param name="cl" select="':'"/>
  109.   <xsl:param name="sl" select="'/'"/>
  110.   <xsl:param name="hm" select="'#'"/>
  111.   <xsl:param name="cs" select="''"/>
  112.   
  113.   <!-- Parameter used to identify the current application database -->
  114.   <xsl:param name="Database" select="'swriter'"/>
  115.  
  116.   <!-- Parameter used to identify the current language -->
  117.   <xsl:param name="Language" select="'de'"/>
  118.   
  119.   <!-- Parameter to identify the OS/platform used -->
  120.   <xsl:param name="System" select="'WIN'"/>
  121.  
  122.     <!-- Parameters used to output help error information -->
  123.   <xsl:param name="Id" select="'0000'"/>
  124.   <xsl:param name="Path" select="'Path'"/>
  125.  
  126.     <!-- Parameters used to assign product names -->
  127.   <xsl:param name="productname" select="'Office'"/>
  128.   <xsl:param name="productversion" select="''"/>
  129.   <xsl:param name="vendorname" select="'Webtop'"/>
  130.   <xsl:param name="vendorversion" select="''"/>
  131.   <xsl:param name="vendorshort" select="'Webtop'"/>
  132.   
  133.   <!-- 
  134.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  135.   | STYLESHEET VARIABLE DEFINITION                                   |
  136.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  137.   | These are used for repeated tasks in this stylesheet and only    |
  138.   | defined once here.                                               |
  139.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  140.   -->
  141.  
  142.   <!-- 
  143.         Variable to identify the application used for evaluation of program switches
  144.         This one is derived from the database name    
  145.     -->
  146.   <xsl:variable name="Program">
  147.     <xsl:choose>
  148.       <xsl:when test="$Database='swriter'">WRITER</xsl:when>
  149.       <xsl:when test="$Database='scalc'">CALC</xsl:when>
  150.       <xsl:when test="$Database='sdraw'">DRAW</xsl:when>
  151.       <xsl:when test="$Database='simpress'">IMPRESS</xsl:when>
  152.       <xsl:when test="$Database='sbasic'">BASIC</xsl:when>
  153.       <xsl:when test="$Database='smath'">MATH</xsl:when>
  154.       <xsl:when test="$Database='schart'">CHART</xsl:when>
  155.       <xsl:when test="$Database='portal'">PORTAL</xsl:when>
  156.       <xsl:otherwise>NONE</xsl:otherwise>
  157.     </xsl:choose>
  158.   </xsl:variable>
  159.   
  160.     <!-- 
  161.         Variable to define the language of the help document which may be different
  162.         from the one defined in the Language *parameter*! It is evaluated from a
  163.         meta tag in the xml source
  164.     -->
  165.   <xsl:variable name="lang">
  166.     <xsl:for-each select="/html/head/meta">
  167.       <xsl:if test="@name='language'">
  168.         <xsl:value-of select="@content"/>
  169.       </xsl:if>
  170.     </xsl:for-each>
  171.   </xsl:variable>
  172.   
  173.     <!-- Variables for formatting purposes. "onepixel" is the image number of a transparent 1-pixel image -->
  174.   <xsl:variable name="colwidth_1">25</xsl:variable>
  175.   <xsl:variable name="spacewidth">5</xsl:variable>
  176.   <xsl:variable name="tabwidth">15</xsl:variable>
  177.   <xsl:variable name="onepixel">67433</xsl:variable>
  178.  
  179.     <!-- Variable for distinguishing the Open Source distribution -->
  180.   <xsl:variable name="Prod">
  181.     <xsl:choose>
  182.       <xsl:when test="$productname='StarOffice'">Commercial</xsl:when>
  183.       <xsl:when test="$productname='StarSuite'">Commercial</xsl:when>
  184.       <xsl:otherwise>OpenSource</xsl:otherwise>
  185.     </xsl:choose>
  186.   </xsl:variable>
  187.  
  188.   <!-- 
  189.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  190.   | BASIC PROCESSING OF ELEMENTS                                     |
  191.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  192.   -->
  193.  
  194.   <!-- Copy through of all elements including their attributes -->
  195.   <xsl:template match="*|@*|comment()|processing-instruction()|text()">
  196.     <xsl:copy>
  197.       <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
  198.     </xsl:copy>
  199.   </xsl:template>
  200.  
  201.   <xsl:template match="help:*">
  202.     <xsl:element name="{name()}">
  203.       <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
  204.     </xsl:element>
  205.   </xsl:template>
  206.  
  207.   <!-- The language of the document body is set here as an attribute of the body tag -->
  208.   <xsl:template match="body">
  209.     <xsl:element name="body">
  210.       <xsl:attribute name="lang"><xsl:value-of select="$lang"/></xsl:attribute>
  211.       <xsl:apply-templates/>
  212.     </xsl:element>
  213.   </xsl:template>
  214.  
  215.  
  216.   <!-- 
  217.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  218.   | PROCESSING OF SPECIFIC HELP ELEMENTS                             |
  219.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  220.   -->
  221.  
  222.   <xsl:template match="help:to-be-embedded">
  223.     <xsl:apply-templates/>
  224.   </xsl:template>
  225.   
  226.     <xsl:template match="help:to-popup">
  227.     <xsl:apply-templates/>
  228.   </xsl:template>
  229.   
  230.     <!-- Text for active help must only show in the content if set to visible -->
  231.   <xsl:template match="help:help-text">
  232.     <xsl:if test="@value='visible'">
  233.       <xsl:apply-templates/>
  234.     </xsl:if>
  235.   </xsl:template>
  236.  
  237.     <xsl:template match="help:paragraphinfo">
  238.     </xsl:template>
  239.  
  240.   <!-- 
  241.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  242.   | CONDITIONAL PROCESSING                                           |
  243.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  244.     | There are program, system and product switches throughout the    |
  245.     | help enabling or disabling content depending on their context    |
  246.     | which is described using the parameters/variables defined above. |
  247.     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  248.   -->
  249.  
  250.     <!-- Switches inside normal text -->
  251.   <xsl:template match="help:switch">
  252.     <xsl:choose>
  253.       <xsl:when test="@select='Program'">
  254.         <xsl:apply-templates mode="switch_prog"/>
  255.       </xsl:when>
  256.       <xsl:when test="@select='System'">
  257.         <xsl:apply-templates mode="switch_sys"/>
  258.       </xsl:when>
  259.       <xsl:when test="@select='Product'">
  260.         <xsl:apply-templates mode="switch_prod"/>
  261.       </xsl:when>
  262.       <xsl:when test="@select='PRODUCT'">
  263.         <xsl:apply-templates mode="switch_prod"/>
  264.       </xsl:when>
  265.     </xsl:choose>
  266.   </xsl:template>
  267.  
  268.     <!-- Switches inside popups -->
  269.   <xsl:template match="help:switch" mode="popup">
  270.     <xsl:choose>
  271.       <xsl:when test="@select='Program'">
  272.         <xsl:apply-templates mode="switch_prog"/>
  273.       </xsl:when>
  274.       <xsl:when test="@select='System'">
  275.         <xsl:apply-templates mode="switch_sys"/>
  276.       </xsl:when>
  277.       <xsl:when test="@select='Product'">
  278.         <xsl:apply-templates mode="switch_prod"/>
  279.       </xsl:when>
  280.     </xsl:choose>
  281.   </xsl:template>
  282.  
  283.  
  284.  
  285.     <!-- Switches inside text which is embedded from elsewhere -->
  286.   <xsl:template match="help:switch" mode="embedded">
  287.     <xsl:choose>
  288.       <xsl:when test="@select='Program'">
  289.         <xsl:apply-templates mode="switch_prog"/>
  290.       </xsl:when>
  291.       <xsl:when test="@select='System'">
  292.         <xsl:apply-templates mode="switch_sys"/>
  293.       </xsl:when>
  294.       <xsl:when test="@select='Product'">
  295.         <xsl:apply-templates mode="switch_prod"/>
  296.       </xsl:when>
  297.     </xsl:choose>
  298.   </xsl:template>
  299.  
  300.     
  301.   <xsl:template match="help:case" mode="switch_prog">
  302.     <xsl:if test="@select=$Program">
  303.       <xsl:apply-templates/>
  304.     </xsl:if>
  305.   </xsl:template>
  306.  
  307.     <xsl:template match="help:default" mode="switch_prog">
  308.     <xsl:if test="not(../help:case[@select=$Program])">
  309.       <xsl:apply-templates/>
  310.     </xsl:if>
  311.   </xsl:template>
  312.  
  313.   <xsl:template match="help:case" mode="switch_sys">
  314.     <xsl:if test="@select=$System">
  315.       <xsl:apply-templates/>
  316.     </xsl:if>
  317.   </xsl:template>
  318.  
  319.   <xsl:template match="help:default" mode="switch_sys">
  320.     <xsl:if test="not(../help:case[@select=$System])">
  321.       <xsl:apply-templates/>
  322.     </xsl:if>
  323.   </xsl:template>
  324.  
  325.   <xsl:template match="help:case" mode="switch_prod">
  326.     <xsl:if test="@select=$Prod">
  327.       <xsl:apply-templates/>
  328.     </xsl:if>
  329.   </xsl:template>
  330.  
  331.   <xsl:template match="help:default" mode="switch_prod">
  332.     <xsl:if test="not(../help:case[@select=$Prod])">
  333.       <xsl:apply-templates/>
  334.     </xsl:if>
  335.   </xsl:template>
  336.  
  337.     <!-- Switches inside the document title -->
  338.   <xsl:template match="help:switch" mode="doctitle">
  339.     <xsl:if test="@select='Program' or @select='System'">
  340.       <xsl:apply-templates mode="doctitle"/>
  341.     </xsl:if>
  342.   </xsl:template>
  343.   <xsl:template match="help:case" mode="doctitle">
  344.     <xsl:if test="@select=$Program or @select=$System">
  345.       <xsl:apply-templates mode="doctitle"/>
  346.     </xsl:if>
  347.   </xsl:template>
  348.   <xsl:template match="help:default" mode="doctitle">
  349.     <xsl:if test="../../help:switch[@select='System'] and not(../help:case[@select=$System])">
  350.       <xsl:apply-templates mode="doctitle"/>
  351.     </xsl:if>
  352.     <xsl:if test="../../help:switch[@select='Program'] and not(../help:case[@select=$Program])">
  353.       <xsl:apply-templates mode="doctitle"/>
  354.     </xsl:if>
  355.   </xsl:template>
  356.  
  357.   <!-- 
  358.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  359.   | PROCESSING OF PARAGRAPHS AND HEADINGS                            |
  360.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  361.   | This one is quite cascaded to take account of the different para |
  362.   | contexts. This includes headers as in the xml source files these |
  363.   | are only paragraphs with a special style class, viz "Head"       |
  364.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  365.   -->
  366.  
  367.     <!-- Normal Paragraphs --> 
  368.   <xsl:template match="p">
  369.  
  370.     <!-- Disregard empty paragraphs -->
  371.     <xsl:choose>
  372.       <xsl:when test=".='' and count(child::*)=0"/>
  373.       <xsl:otherwise>
  374.  
  375.         <!-- Process all headings -->
  376.         <xsl:choose>
  377.           <xsl:when test="substring(@class,1,4)='Head'">
  378.  
  379.             <!-- Head 1 should only be the document title at the top and is treated differently -->
  380.             <!-- removed table as formatting help -->
  381.             <xsl:choose>
  382.               <xsl:when test="@class='Head1'">
  383.                       <xsl:element name="h1">
  384.                         <xsl:apply-templates mode="doctitle"/>
  385.                       </xsl:element>
  386.                 <xsl:element name="br"/>
  387.               </xsl:when>
  388.  
  389.                         <!-- All other Heads are converted to HTML headings -->
  390.               <xsl:when test="@class='Head2'">
  391.                 <xsl:element name="h2">
  392.                   <xsl:apply-templates/>
  393.                 </xsl:element>
  394.               </xsl:when>
  395.  
  396.               <xsl:when test="@class='Head3'">
  397.                 <xsl:element name="h3">
  398.                   <xsl:apply-templates/>
  399.                 </xsl:element>
  400.               </xsl:when>
  401.  
  402.               <xsl:when test="@class='Head4'">
  403.                 <xsl:element name="h4">
  404.                   <xsl:apply-templates/>
  405.                 </xsl:element>
  406.               </xsl:when>
  407.  
  408.               <xsl:when test="@class='Head5'">
  409.                 <xsl:element name="h5">
  410.                   <xsl:apply-templates/>
  411.                 </xsl:element>
  412.               </xsl:when>
  413.  
  414.               <xsl:when test="@class='Head6'">
  415.                 <xsl:element name="h6">
  416.                   <xsl:apply-templates/>
  417.                 </xsl:element>
  418.               </xsl:when>
  419.  
  420.             </xsl:choose>
  421.  
  422.           </xsl:when>
  423.           
  424.                 <!-- 
  425.             All Non-Header paragraphs are converted into HTML p with corresponding style class assigned.
  426.             Valid style classes are Paragraph, ParaList, TextInTable, TableHead, PropText
  427.           -->
  428.  
  429.           <xsl:when test="@class='Paragraph' 
  430.                        or @class='ParaList' 
  431.                        or @class='TextInTable' 
  432.                        or @class='TableHead' 
  433.                        or @class='PropText'">
  434.             <xsl:element name="p">
  435.               <xsl:choose>
  436.                 <!-- By special request, turn the "Related Topics" header into an own style class -->
  437.                 <xsl:when test="child::help:embedded[@Eid='related']">
  438.                   <xsl:attribute name="class">reltop</xsl:attribute>
  439.                 </xsl:when>
  440.                 <xsl:otherwise>
  441.                   <xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
  442.                 </xsl:otherwise>
  443.                 </xsl:choose>
  444.               <xsl:apply-templates/>
  445.             </xsl:element>
  446.           </xsl:when>
  447.  
  448.           <!-- all unknown paragraph styles are just converted into the standard "paragraph" style -->
  449.           <xsl:otherwise>
  450.             <xsl:element name="p">
  451.               <xsl:attribute name="class">Paragraph</xsl:attribute>
  452.               <xsl:apply-templates/>
  453.             </xsl:element>
  454.           </xsl:otherwise>
  455.  
  456.         </xsl:choose>
  457.  
  458.       </xsl:otherwise> <!-- non-empty paras-->
  459.     </xsl:choose>
  460.   </xsl:template>
  461.  
  462.   <!-- Paragraphs inside text which is embedded from somewhere else -->
  463.   <xsl:template match="p" mode="embedded">
  464.   
  465.     <!-- Disregard empty paragraphs -->
  466.     <xsl:choose>
  467.       <xsl:when test=".='' and count(child::*)=0"/>
  468.       <xsl:otherwise>
  469.         <xsl:choose>
  470.           
  471.           <xsl:when test="@class='Head1'">
  472.             <xsl:element name="h2">
  473.               <xsl:apply-templates/>
  474.             </xsl:element>
  475.           </xsl:when>
  476.           
  477.           <xsl:when test="@class='Head2'">
  478.             <xsl:element name="h2">
  479.               <xsl:apply-templates/>
  480.             </xsl:element>
  481.           </xsl:when>
  482.       
  483.           <xsl:when test="@class='Head3'">
  484.             <xsl:element name="h3">
  485.               <xsl:apply-templates/>
  486.             </xsl:element>
  487.           </xsl:when>
  488.           
  489.           <xsl:when test="@class='Head4'">
  490.             <xsl:element name="h4">
  491.               <xsl:apply-templates/>
  492.             </xsl:element>
  493.           </xsl:when>
  494.           
  495.           <xsl:when test="@class='Head5'">
  496.             <xsl:element name="h5">
  497.               <xsl:apply-templates/>
  498.             </xsl:element>
  499.           </xsl:when>
  500.           
  501.           <xsl:when test="@class='Head6'">
  502.             <xsl:element name="h6">
  503.               <xsl:apply-templates/>
  504.             </xsl:element>
  505.           </xsl:when>
  506.       
  507.               <!-- 
  508.             All Non-Header paragraphs are converted into HTML p with corresponding style class assigned.
  509.             Valid style classes are Paragraph, ParaList, TextInTable, TableHead, PropText
  510.           -->
  511.           
  512.           <xsl:when test="@class='Paragraph' 
  513.                        or @class='ParaList' 
  514.                        or @class='TextInTable' 
  515.                        or @class='TableHead' 
  516.                        or @class='PropText'">
  517.             <xsl:element name="p">
  518.               <xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>
  519.               <xsl:apply-templates/>
  520.             </xsl:element>
  521.           </xsl:when>
  522.         
  523.           <!-- all unknown paragraph styles are just converted into the standard "paragraph" style -->
  524.           <xsl:otherwise>
  525.             <xsl:element name="p">
  526.               <xsl:attribute name="class">Paragraph</xsl:attribute>
  527.               <xsl:apply-templates/>
  528.             </xsl:element>
  529.           </xsl:otherwise>
  530.     
  531.         </xsl:choose>
  532.       </xsl:otherwise> <!-- non-empty paragraphs -->
  533.     </xsl:choose>
  534.   </xsl:template>
  535.  
  536.   <!-- Paragraphs inside popup text (mainly the information of how to get a function) -->
  537.   <xsl:template match="p" mode="popup">
  538.     <xsl:if test="(. != '') or (count(child::*)>0)">
  539.       <xsl:element name="p">
  540.         <xsl:attribute name="class">howtogetpara</xsl:attribute>
  541.         <xsl:apply-templates/>
  542.       </xsl:element>
  543.     </xsl:if>
  544.   </xsl:template>
  545.  
  546.   <!-- 
  547.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  548.   | PROCESSING OF LISTS                                              |
  549.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  550.   -->
  551.  
  552.   <!-- Numbered lists in normal text -->
  553.   <xsl:template match="ol">
  554.     <xsl:element name="ol">    
  555.         <xsl:if test="@start">
  556.             <xsl:attribute name="start"><xsl:value-of select="@start"/></xsl:attribute>
  557.         </xsl:if>
  558.       <xsl:apply-templates/>
  559.     </xsl:element>
  560.   </xsl:template>
  561.   
  562.   <!-- Numbered lists in text embedded from somewhere else -->
  563.   <xsl:template match="ol" mode="embedded">
  564.     <xsl:element name="ol">
  565.         <xsl:if test="@start">
  566.             <xsl:attribute name="start"><xsl:value-of select="@start"/></xsl:attribute>
  567.         </xsl:if>
  568.       <xsl:apply-templates/>
  569.     </xsl:element>
  570.   </xsl:template>
  571.   
  572.   <!-- Bulleted lists in normal text -->
  573.   <xsl:template match="ul">
  574.     <xsl:element name="ul">
  575.       <xsl:apply-templates/>
  576.     </xsl:element>
  577.   </xsl:template>
  578.   
  579.   <!-- Bulleted lists in text embedded from somewhere else -->
  580.   <xsl:template match="ul" mode="embedded">
  581.     <xsl:element name="ul">
  582.       <xsl:apply-templates/>
  583.     </xsl:element>
  584.   </xsl:template>
  585.   
  586.   <!-- List items in any context -->
  587.   <xsl:template match="li">
  588.     <xsl:element name="li">
  589.       <xsl:apply-templates/>
  590.     </xsl:element>
  591.   </xsl:template>
  592.   
  593.   
  594.   <!-- 
  595.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  596.   | PROCESSING OF CHARACTER CLASSES                                  |
  597.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  598.   -->
  599.   
  600.   <!-- Process character formatting -->
  601.   <xsl:template match="span">
  602.     <!-- Disregard spans with table automatic formats, starting with "Tabelle" -->
  603.     <xsl:choose>
  604.       <xsl:when test="substring(@class,1,7)='Tabelle'">
  605.         <xsl:apply-templates/>
  606.       </xsl:when>
  607.       <xsl:otherwise>
  608.         <!-- insert emphasized span -->
  609.         <xsl:element name="span">
  610.           <xsl:attribute name="class">emph</xsl:attribute>
  611.           <xsl:apply-templates/>
  612.         </xsl:element>
  613.       </xsl:otherwise>
  614.     </xsl:choose>
  615.   </xsl:template>
  616.   <xsl:template match="span" mode="embedded">
  617.     <!-- Disregard spans with table automatic formats, starting with "Tabelle" -->
  618.     <xsl:choose>
  619.       <xsl:when test="substring(@class,1,7)='Tabelle'">
  620.         <xsl:apply-templates/>
  621.       </xsl:when>
  622.       <xsl:otherwise>
  623.         <!-- insert emphasized span -->
  624.         <xsl:element name="span">
  625.           <xsl:attribute name="class">emph</xsl:attribute>
  626.           <xsl:apply-templates/>
  627.         </xsl:element>
  628.       </xsl:otherwise>
  629.     </xsl:choose>
  630.   </xsl:template>
  631.   <xsl:template match="span" mode="popup">
  632.     <!-- Disregard spans with table automatic formats, starting with "Tabelle" -->
  633.     <xsl:choose>
  634.       <xsl:when test="substring(@class,1,7)='Tabelle'">
  635.         <xsl:apply-templates/>
  636.       </xsl:when>
  637.       <xsl:otherwise>
  638.         <!-- insert emphasized span -->
  639.         <xsl:element name="span">
  640.           <xsl:attribute name="class">emph</xsl:attribute>
  641.           <xsl:apply-templates/>
  642.         </xsl:element>
  643.       </xsl:otherwise>
  644.     </xsl:choose>
  645.   </xsl:template>
  646.   
  647.   <!-- 
  648.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  649.   | PROCESSING OF TABLES                                             |
  650.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  651.   -->
  652.   
  653.   <!-- Tables should be preceded and followed by a line break -->
  654.   <xsl:template match="table">
  655.     <xsl:element name="br"/>
  656.     <xsl:element name="table">
  657.       <xsl:if test="@border>0">
  658.         <xsl:attribute name="border">1</xsl:attribute>
  659.         <xsl:attribute name="class">tablebg</xsl:attribute>
  660.       </xsl:if>
  661.       <xsl:attribute name="cellspacing">0</xsl:attribute>
  662.       <xsl:attribute name="cellpadding">2</xsl:attribute>
  663.       <xsl:apply-templates/>
  664.     </xsl:element>
  665.     <xsl:element name="br"/>
  666.   </xsl:template>
  667.   <xsl:template match="table" mode="embedded">
  668.     <xsl:element name="br"/>
  669.     <xsl:element name="table">
  670.       <xsl:if test="@border>0">
  671.         <xsl:attribute name="border">1</xsl:attribute>
  672.         <xsl:attribute name="class">tablebg</xsl:attribute>
  673.       </xsl:if>
  674.       <xsl:attribute name="cellspacing">0</xsl:attribute>
  675.       <xsl:attribute name="cellpadding">2</xsl:attribute>
  676.       <xsl:apply-templates/>
  677.     </xsl:element>
  678.     <xsl:element name="br"/>
  679.   </xsl:template>
  680.   <xsl:template match="table" mode="popup">
  681.     <xsl:element name="table">
  682.       <xsl:attribute name="border">0</xsl:attribute>
  683.       <xsl:attribute name="cellspacing">0</xsl:attribute>
  684.       <xsl:attribute name="cellpadding">2</xsl:attribute>
  685.       <xsl:apply-templates mode="popup"/>
  686.     </xsl:element>
  687.   </xsl:template>
  688.   <xsl:template match="tr">
  689.     <xsl:element name="tr">
  690.       <xsl:apply-templates/>
  691.     </xsl:element>
  692.   </xsl:template>
  693.   <xsl:template match="tr" mode="popup">
  694.     <xsl:element name="tr">
  695.       <xsl:apply-templates mode="popup"/>
  696.     </xsl:element>
  697.   </xsl:template>
  698.   <xsl:template match="th">
  699.     <!-- no th for borderless tables - 24/07/01-->
  700.     <xsl:choose>
  701.       <xsl:when test="../../table[@border>0]">
  702.         <xsl:element name="th">
  703.           <xsl:attribute name="align">left</xsl:attribute>
  704.           <xsl:attribute name="valign">top</xsl:attribute>
  705.           <xsl:attribute name="class">tableheadbg</xsl:attribute>
  706.           <xsl:apply-templates/>
  707.         </xsl:element>
  708.       </xsl:when>
  709.       <xsl:otherwise>
  710.         <xsl:element name="td">
  711.           <xsl:attribute name="align">left</xsl:attribute>
  712.           <xsl:attribute name="valign">top</xsl:attribute>
  713.           <xsl:attribute name="class">tabledatabg</xsl:attribute>
  714.           <xsl:apply-templates/>
  715.         </xsl:element>
  716.       </xsl:otherwise>
  717.     </xsl:choose>
  718.   </xsl:template>
  719.   <xsl:template match="td" mode="popup">
  720.     <xsl:element name="td">
  721.       <xsl:if test="descendant::draw:image">
  722.         <xsl:attribute name="width"><xsl:value-of select="$colwidth_1"/></xsl:attribute>
  723.       </xsl:if>
  724.       <xsl:apply-templates mode="popup"/>
  725.     </xsl:element>
  726.   </xsl:template>
  727.   <xsl:template match="th" mode="popup">
  728.     <xsl:element name="td">
  729.       <xsl:if test="descendant::draw:image">
  730.         <xsl:attribute name="width"><xsl:value-of select="$colwidth_1"/></xsl:attribute>
  731.       </xsl:if>
  732.       <xsl:apply-templates mode="popup"/>
  733.     </xsl:element>
  734.   </xsl:template>
  735.   <xsl:template match="td">
  736.     <xsl:element name="td">
  737.       <xsl:attribute name="align">left</xsl:attribute>
  738.       <xsl:attribute name="valign">top</xsl:attribute>
  739.       <xsl:attribute name="class">tabledatabg</xsl:attribute>
  740.       <xsl:apply-templates/>
  741.     </xsl:element>
  742.   </xsl:template>
  743.   
  744.   <!-- 
  745.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  746.   | PROCESSING OF TEXT EMBEDDED FROM SOMEHWERE ELSE                  |
  747.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  748.   -->
  749.   
  750.   
  751.   <!-- Process embedded help text -->
  752.   <xsl:template match="help:embedded">
  753.     <xsl:variable name="Link" select="concat('vnd.sun.star.help://',$Database,'/',@Id,'?Language=',$Language,'&System=',$System)"/>
  754.     <xsl:variable name="EmbeddedDoc" select="document($Link)"/>
  755.     <xsl:variable name="Docpart" select="@Eid"/>
  756.     <xsl:choose>
  757.       <!-- prevent embedded paragraphs without p tag -->
  758.       <xsl:when test="not(ancestor::p)">
  759.         <xsl:element name="p">
  760.           <xsl:attribute name="class">Paragraph</xsl:attribute>
  761.           <xsl:apply-templates select="$EmbeddedDoc//help:to-be-embedded[@Eid=$Docpart]" mode="embedded"/>
  762.         </xsl:element>
  763.       </xsl:when>
  764.       <xsl:otherwise>
  765.         <xsl:apply-templates select="$EmbeddedDoc//help:to-be-embedded[@Eid=$Docpart]" mode="embedded"/>
  766.       </xsl:otherwise>
  767.     </xsl:choose>
  768.   </xsl:template>
  769.   <!-- Process embedded help text -->
  770.   <xsl:template match="help:embedded" mode="embedded">
  771.     <xsl:variable name="Link" select="concat($sm,$Database,'/',@Id,'?Language=',$Language,'&System=',$System)"/>
  772.     <xsl:variable name="EmbeddedDoc" select="document($Link)"/>
  773.     <xsl:variable name="Docpart" select="@Eid"/>
  774.     <xsl:choose>
  775.       <!-- prevent embedded paragraphs without p tag -->
  776.       <xsl:when test="not(ancestor::p)">
  777.         <xsl:element name="p">
  778.           <xsl:attribute name="class">Paragraph</xsl:attribute>
  779.           <xsl:apply-templates select="$EmbeddedDoc//help:to-be-embedded[@Eid=$Docpart]" mode="embedded"/>
  780.         </xsl:element>
  781.       </xsl:when>
  782.       <xsl:otherwise>
  783.         <xsl:apply-templates select="$EmbeddedDoc//help:to-be-embedded[@Eid=$Docpart]" mode="embedded"/>
  784.       </xsl:otherwise>
  785.     </xsl:choose>
  786.   </xsl:template>
  787.   
  788.   <!-- 
  789.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  790.   | PROCESSING OF POPUP TEXT                                         |
  791.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  792.   -->
  793.   
  794.   <!-- Process Popup help text -->
  795.   <xsl:template match="help:popup-cut">
  796.     <xsl:variable name="ref" select="concat('vnd.sun.star.help://',$Database,'/',@Id,'?Language=',$Language,'&System=',$System)"/>
  797.     <xsl:variable name="popupdoc" select="document($ref)"/>
  798.     <xsl:variable name="part" select="@Eid"/>
  799.     <xsl:apply-templates select="$popupdoc//help:to-popup[@Eid=$part]"/>
  800.     <!--
  801.         <xsl:element name="hr">
  802.           <xsl:attribute name="width">50%</xsl:attribute>
  803.           <xsl:attribute name="align">center</xsl:attribute>
  804.           <xsl:attribute name="size">1</xsl:attribute>
  805.         </xsl:element>
  806. //-->
  807.   </xsl:template>
  808.   
  809.   <!-- Process help popups -->
  810.   <!-- Workaround for "How to get this function" popup is to load it in a small table into the document -->
  811.   <xsl:template match="help:popup">
  812.     <xsl:choose>
  813.       <xsl:when test="child::help:embedded[@Eid='wie']">
  814.         <xsl:variable name="Link" select="concat('vnd.sun.star.help://',$Database,'/',@Id,'?Language=',$Language,'&System=',$System)"/>
  815.         <xsl:variable name="EmbeddedDoc" select="document($Link)"/>
  816.         <xsl:variable name="Docpart" select="@Eid"/>
  817.         <xsl:if test="$EmbeddedDoc//help:to-popup[@Eid=$Docpart]!=''">
  818.           <xsl:element name="table">
  819.             <xsl:attribute name="width">100%</xsl:attribute>
  820.             <xsl:attribute name="border">0</xsl:attribute>
  821.             <xsl:attribute name="cellspacing">0</xsl:attribute>
  822.             <xsl:attribute name="cellpadding">4</xsl:attribute>
  823.             <xsl:element name="tr">
  824.               <xsl:element name="td">
  825.                 <xsl:attribute name="class">howtogetheader</xsl:attribute>
  826.                 <xsl:value-of select="."/>
  827.                 <xsl:apply-templates/>
  828.               </xsl:element>
  829.             </xsl:element>
  830.             <xsl:element name="tr">
  831.               <xsl:element name="td">
  832.                 <xsl:attribute name="class">howtogetbody</xsl:attribute>
  833.                 <xsl:apply-templates select="$EmbeddedDoc//help:to-popup[@Eid=$Docpart]" mode="popup"/>
  834.               </xsl:element>
  835.             </xsl:element>
  836.           </xsl:element>
  837.         </xsl:if>
  838.         <xsl:element name="br"/>
  839.       </xsl:when>
  840.       <xsl:otherwise>
  841.         <xsl:variable name="Link" select="concat($hp,$sm,$Database,$sl,@Id,$qm,'Language',$es,$Language,$am,'System',$es,$System,$am,'Eid',$es,@Eid)"/>
  842.         <xsl:element name="a">
  843.           <xsl:attribute name="class">ContentLink</xsl:attribute>
  844.           <xsl:attribute name="href"><xsl:value-of select="$Link"/></xsl:attribute>
  845.           <xsl:attribute name="name">    <xsl:call-template name="linkname"/></xsl:attribute>
  846.           <xsl:apply-templates/>
  847.         </xsl:element>
  848.       </xsl:otherwise>
  849.     </xsl:choose>
  850.   </xsl:template>
  851.   
  852.   
  853.   <!-- 
  854.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  855.   | PROCESSING OF ANCHORS                                            |
  856.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  857.   | These can be based on help index keywords or Help-IDs            |
  858.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  859.   -->
  860.   
  861.   <!-- Process anchor names (help index keywords) -->
  862.   <xsl:template match="help:key-word">
  863.     <xsl:element name="a">
  864.       <xsl:attribute name="name"><xsl:value-of select="@tag"/></xsl:attribute>
  865.     </xsl:element>
  866.   </xsl:template>
  867.   <xsl:template match="help:key-word" mode="doctitle">
  868.     <xsl:element name="a">
  869.       <xsl:attribute name="name"><xsl:value-of select="@tag"/></xsl:attribute>
  870.     </xsl:element>
  871.   </xsl:template>
  872.   <!-- Process anchor names (help ids) -->
  873.   <xsl:template match="help:help-id">
  874.     <xsl:element name="a">
  875.       <xsl:attribute name="name"><xsl:value-of select="@value"/></xsl:attribute>
  876.     </xsl:element>
  877.   </xsl:template>
  878.   <xsl:template match="help:help-id" mode="doctitle">
  879.     <xsl:element name="a">
  880.       <xsl:attribute name="name"><xsl:value-of select="@value"/></xsl:attribute>
  881.     </xsl:element>
  882.   </xsl:template>
  883.   
  884.   <!-- 
  885.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  886.   | PROCESSING OF LINKS                                              |
  887.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  888.   -->
  889.   
  890.   <!-- Process help links -->
  891.   <xsl:template match="help:link">
  892.     <xsl:choose>
  893.       <xsl:when test="@Eid">
  894.         <xsl:variable name="Link" select="concat($hp,$sm,$Database,$sl,@Id,$qm,'Language',$es,$Language,$am,'System',$es,$System,'#',@Eid)"/>
  895.         <xsl:element name="a">
  896.           <xsl:attribute name="class">ContentLink</xsl:attribute>
  897.           <xsl:attribute name="href"><xsl:value-of select="$Link"/></xsl:attribute>
  898.           <xsl:attribute name="name">    <xsl:call-template name="linkname"/></xsl:attribute>
  899.           <xsl:apply-templates/>
  900.         </xsl:element>
  901.       </xsl:when>
  902.       <xsl:otherwise>
  903.         <xsl:variable name="Link" select="concat($hp,$sm,$Database,$sl,@Id,$qm,'Language',$es,$Language,$am,'System',$es,$System)"/>
  904.         <xsl:element name="a">
  905.           <xsl:attribute name="class">ContentLink</xsl:attribute>
  906.           <xsl:attribute name="href"><xsl:value-of select="$Link"/></xsl:attribute>
  907.           <xsl:attribute name="name">    <xsl:call-template name="linkname"/></xsl:attribute>
  908.           <xsl:apply-templates/>
  909.         </xsl:element>
  910.       </xsl:otherwise>
  911.     </xsl:choose>
  912.   </xsl:template>
  913.   <xsl:template match="help:link" mode="embedded">
  914.     <xsl:choose>
  915.       <xsl:when test="@Eid">
  916.         <xsl:variable name="Link" select="concat($hp,$sm,$Database,$sl,@Id,$qm,'Language',$es,$Language,$am,'System',$es,$System,'#',@Eid)"/>
  917.         <xsl:element name="a">
  918.           <xsl:attribute name="class">ContentLink</xsl:attribute>
  919.           <xsl:attribute name="href"><xsl:value-of select="$Link"/></xsl:attribute>
  920.           <xsl:attribute name="name">    <xsl:call-template name="linkname"/></xsl:attribute>
  921.           <xsl:apply-templates/>
  922.         </xsl:element>
  923.       </xsl:when>
  924.       <xsl:otherwise>
  925.         <xsl:variable name="Link" select="concat($hp,$sm,$Database,$sl,@Id,$qm,'Language',$es,$Language,$am,'System',$es,$System)"/>
  926.         <xsl:element name="a">
  927.           <xsl:attribute name="class">ContentLink</xsl:attribute>
  928.           <xsl:attribute name="href"><xsl:value-of select="$Link"/></xsl:attribute>
  929.           <xsl:attribute name="name">    <xsl:call-template name="linkname"/></xsl:attribute>
  930.           <xsl:apply-templates/>
  931.         </xsl:element>
  932.       </xsl:otherwise>
  933.     </xsl:choose>
  934.   </xsl:template>
  935.   <xsl:template match="help:link" mode="doctitle">
  936.     <xsl:apply-templates/>
  937.   </xsl:template>
  938.   
  939.   <!-- 
  940.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  941.   | PROCESSING OF IMAGES                                              |
  942.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  943.   -->
  944.   
  945.   <!-- Process images -->
  946.   <xsl:template match="draw:image | office:image">
  947.     <xsl:element name="img">
  948.       <xsl:variable name="pictureLink" select="concat($hp,$sm,'picture',$sl,@xlink:href,$qm,'Language',$es,$Language,$am,'System',$es,$System)"/>
  949.       <xsl:attribute name="src"><xsl:value-of select="$pictureLink"/></xsl:attribute>
  950.         <xsl:attribute name="width"><xsl:value-of select="@svg:pixelx"/></xsl:attribute>
  951.        <xsl:attribute name="height"><xsl:value-of select="@svg:pixely"/></xsl:attribute>
  952.        <xsl:attribute name="alt"><xsl:value-of select="@svg:desc"/></xsl:attribute>
  953.  
  954. <!--
  955.         Width/Height is now contained in the svg:pixelx and svg:pixely attributes
  956.       <xsl:attribute name="width"><xsl:value-of select="round(substring-before(@svg:width,'cm')*37.8)"/></xsl:attribute>
  957.       <xsl:attribute name="height"><xsl:value-of select="round(substring-before(@svg:height,'cm')*37.8)"/></xsl:attribute>
  958. //-->
  959.     </xsl:element>
  960.   </xsl:template>
  961.   <!-- Remove residues of formatting information -->
  962.   <xsl:template match="style"/>
  963.   <!-- Add CSS link to custom.css -->
  964.   <xsl:template match="help:css-file-link">
  965.     <xsl:variable name="CssStylesheet" select="concat($hp,$sm,$cs,$sl,$qm,'Language',$es,$Language,$am,'System',$es,$System)"/>
  966.     <xsl:element name="link">
  967.       <xsl:attribute name="rel">STYLESHEET</xsl:attribute>
  968.       <xsl:attribute name="href"><xsl:value-of select="$CssStylesheet"/></xsl:attribute>
  969.       <xsl:attribute name="type">text/css</xsl:attribute>
  970.     </xsl:element>
  971.     <!-- Add Encoding meta tag for correct display of asian text -->
  972.     <xsl:element name="meta">
  973.       <xsl:attribute name="http-equiv">Content-type</xsl:attribute>
  974.       <xsl:attribute name="content">text/html; charset=utf-8</xsl:attribute>
  975.     </xsl:element>
  976.   </xsl:template>
  977.   
  978.   <!-- 
  979.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  980.   | ERROR HANDLING                                                   |
  981.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  982.   -->
  983.   
  984.   <!-- error handling -->
  985.   <xsl:template match="help:error-id">
  986.     <xsl:value-of select="$Id"/>
  987.   </xsl:template>
  988.   <xsl:template match="help:help-id-missing">
  989.     <xsl:value-of select="$Id"/>
  990.   </xsl:template>
  991.   <xsl:template match="help:error-module">
  992.     <xsl:value-of select="$Database"/>
  993.   </xsl:template>
  994.   <xsl:template match="help:help-mod-missing">
  995.     <xsl:value-of select="$Database"/>
  996.   </xsl:template>
  997.   <xsl:template match="help:help-org-missing">
  998.     <xsl:value-of select="$Path"/>
  999.   </xsl:template>
  1000.   <xsl:template match="help:error-path">
  1001.     <xsl:value-of select="$Path"/>
  1002.   </xsl:template>
  1003.  
  1004.   <!-- 
  1005.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1006.   | PROCESSING OF PRODUCT INFORMATION/BRANDING                       |
  1007.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1008.   -->
  1009.   
  1010.   <!-- Branding -->
  1011.   <xsl:template match="help:productname">
  1012.     <xsl:element name="span">
  1013.       <xsl:attribute name="class">prod</xsl:attribute>
  1014.       <xsl:value-of select="$productname"/>
  1015.     </xsl:element>
  1016.   </xsl:template>
  1017.   <xsl:template match="help:productversion">
  1018.     <xsl:element name="span">
  1019.       <xsl:attribute name="class">prod</xsl:attribute>
  1020.       <xsl:value-of select="$productversion"/>
  1021.     </xsl:element>
  1022.   </xsl:template>
  1023.   <xsl:template match="help:productpath">{installpath}</xsl:template>
  1024.   <xsl:template match="help:vendorname">
  1025.     <xsl:element name="span">
  1026.       <xsl:attribute name="class">vendor</xsl:attribute>
  1027.       <xsl:value-of select="$vendorname"/>
  1028.     </xsl:element>
  1029.   </xsl:template>
  1030.   <xsl:template match="help:vendorversion">
  1031.     <xsl:element name="span">
  1032.       <xsl:attribute name="class">vendor</xsl:attribute>
  1033.       <xsl:value-of select="$vendorversion"/>
  1034.     </xsl:element>
  1035.   </xsl:template>
  1036.   <xsl:template match="help:vendorpath">{installpath}</xsl:template>
  1037.   <xsl:template match="help:vendorshort">
  1038.     <xsl:element name="span">
  1039.       <xsl:attribute name="class">vendor</xsl:attribute>
  1040.       <xsl:value-of select="$vendorshort"/>
  1041.     </xsl:element>
  1042.   </xsl:template>
  1043.   <xsl:template match="help:productname" mode="doctitle">
  1044.     <xsl:value-of select="$productname"/>
  1045.   </xsl:template>
  1046.   <xsl:template match="help:productversion" mode="doctitle">
  1047.     <xsl:value-of select="$productversion"/>
  1048.   </xsl:template>
  1049.   <xsl:template match="help:productpath" mode="doctitle">{installpath}</xsl:template>
  1050.   <xsl:template match="help:vendorname" mode="doctitle">
  1051.     <xsl:value-of select="$vendorname"/>
  1052.   </xsl:template>
  1053.   <xsl:template match="help:vendorversion" mode="doctitle">
  1054.     <xsl:value-of select="$vendorversion"/>
  1055.   </xsl:template>
  1056.   <xsl:template match="help:vendorpath" mode="doctitle">{installpath}</xsl:template>
  1057.   <xsl:template match="help:vendorshort" mode="doctitle">
  1058.     <xsl:value-of select="$vendorshort"/>
  1059.   </xsl:template>
  1060.   <xsl:template match="help:productname" mode="popup">
  1061.     <xsl:value-of select="$productname"/>
  1062.   </xsl:template>
  1063.   <xsl:template match="help:productversion" mode="popup">
  1064.     <xsl:value-of select="$productversion"/>
  1065.   </xsl:template>
  1066.   <xsl:template match="help:productpath" mode="popup">{installpath}</xsl:template>
  1067.   <xsl:template match="help:vendorname" mode="popup">
  1068.     <xsl:value-of select="$vendorname"/>
  1069.   </xsl:template>
  1070.   <xsl:template match="help:vendorversion" mode="popup">
  1071.     <xsl:value-of select="$vendorversion"/>
  1072.   </xsl:template>
  1073.   <xsl:template match="help:vendorpath" mode="popup">{installpath}</xsl:template>
  1074.   <xsl:template match="help:vendorshort" mode="popup">
  1075.     <xsl:value-of select="$vendorshort"/>
  1076.   </xsl:template>
  1077.   <xsl:template match="help:productname" mode="embedded">
  1078.     <xsl:value-of select="$productname"/>
  1079.   </xsl:template>
  1080.   <xsl:template match="help:productversion" mode="embedded">
  1081.     <xsl:value-of select="$productversion"/>
  1082.   </xsl:template>
  1083.   <xsl:template match="help:productpath" mode="embedded">{installpath}</xsl:template>
  1084.   <xsl:template match="help:vendorname" mode="embedded">
  1085.     <xsl:value-of select="$vendorname"/>
  1086.   </xsl:template>
  1087.   <xsl:template match="help:vendorversion" mode="embedded">
  1088.     <xsl:value-of select="$vendorversion"/>
  1089.   </xsl:template>
  1090.   <xsl:template match="help:vendorpath" mode="embedded">{installpath}</xsl:template>
  1091.   <xsl:template match="help:vendorshort" mode="embedded">
  1092.     <xsl:value-of select="$vendorshort"/>
  1093.   </xsl:template>
  1094.   
  1095.    <!-- 
  1096.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1097.   | ADDITIONAL STUFF                                                 |
  1098.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1099.   -->
  1100.    
  1101.   <!-- admin info -->
  1102.   <xsl:template match="referenznumber"/>
  1103.   <!-- spacing -->
  1104.   <xsl:template match="text:s">
  1105.     <!-- not currentyl working -->
  1106.     <xsl:apply-templates/>
  1107.   </xsl:template>
  1108.   <xsl:template match="text:tab-stop">
  1109.     <xsl:call-template name="spacer">
  1110.       <xsl:with-param name="width">
  1111.         <xsl:value-of select="$tabwidth"/>
  1112.       </xsl:with-param>
  1113.     </xsl:call-template>
  1114.     <xsl:apply-templates/>
  1115.   </xsl:template>
  1116.    
  1117.   <xsl:template name="loop">
  1118.     <xsl:param name="ct">1</xsl:param>
  1119.     <xsl:param name="cur">1</xsl:param>
  1120.     <xsl:param name="wdth">1</xsl:param>
  1121.     <xsl:call-template name="spacer">
  1122.       <xsl:with-param name="width">
  1123.         <xsl:value-of select="$wdth"/>
  1124.       </xsl:with-param>
  1125.     </xsl:call-template>
  1126.     <xsl:if test="$cur < $ct">
  1127.       <xsl:call-template name="loop">
  1128.         <xsl:with-param name="ct">
  1129.           <xsl:value-of select="$ct"/>
  1130.         </xsl:with-param>
  1131.         <xsl:with-param name="cur">
  1132.           <xsl:value-of select="$cur+1"/>
  1133.         </xsl:with-param>
  1134.         <xsl:with-param name="wdth">
  1135.           <xsl:value-of select="$wdth"/>
  1136.         </xsl:with-param>
  1137.       </xsl:call-template>
  1138.     </xsl:if>
  1139.   </xsl:template>
  1140.   
  1141.   <xsl:template name="spacer">
  1142.     <xsl:param name="width">1</xsl:param>
  1143.     <xsl:element name="img">
  1144.       <xsl:variable name="pictureLink" select="concat($hp,$sm,'picture',$sl,$onepixel,$qm,'Language',$es,$Language,$am,'System',$es,$System)"/>
  1145.       <xsl:attribute name="src"><xsl:value-of select="$pictureLink"/></xsl:attribute>
  1146.       <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
  1147.       <xsl:attribute name="height">1</xsl:attribute>
  1148.     </xsl:element>
  1149.   </xsl:template>
  1150.   
  1151.   <xsl:template name="linkname">
  1152.       <xsl:call-template name="string-replace">
  1153.           <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
  1154.           <xsl:with-param name="from">%PRODUCTNAME</xsl:with-param>
  1155.           <xsl:with-param name="to"><xsl:value-of select="$productname"/></xsl:with-param>
  1156.       </xsl:call-template>
  1157.   </xsl:template>
  1158.  
  1159.     <xsl:template name="string-replace" >
  1160.      <xsl:param name="string"/>
  1161.      <xsl:param name="from"/>
  1162.      <xsl:param name="to"/>
  1163.      <xsl:choose>
  1164.        <xsl:when test="contains($string,$from)">
  1165.          <xsl:value-of select="substring-before($string,$from)"/>
  1166.          <xsl:value-of select="$to"/>
  1167.          <xsl:call-template name="string-replace">
  1168.          <xsl:with-param name="string" 
  1169.              select="substring-after($string,$from)"/>
  1170.          <xsl:with-param name="from" select="$from"/>
  1171.          <xsl:with-param name="to" select="$to"/>
  1172.          </xsl:call-template>
  1173.        </xsl:when>
  1174.        <xsl:otherwise>
  1175.          <xsl:value-of select="$string"/>
  1176.        </xsl:otherwise>
  1177.      </xsl:choose>
  1178.    </xsl:template>
  1179.  
  1180. </xsl:stylesheet>