home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 May / PCWorld_2004-05_cd.bin / akce / openoffice / f_0384 / common.xsl
Text File  |  2003-04-24  |  61KB  |  1,166 lines

  1. <!--
  2.  
  3.    The Contents of this file are made available subject to the terms of
  4.    either of the following licenses
  5.  
  6.           - GNU Lesser General Public License Version 2.1
  7.           - Sun Industry Standards Source License Version 1.1
  8.  
  9.    Sun Microsystems Inc., October, 2000
  10.  
  11.    GNU Lesser General Public License Version 2.1
  12.    =============================================
  13.    Copyright 2000 by Sun Microsystems, Inc.
  14.    901 San Antonio Road, Palo Alto, CA 94303, USA
  15.  
  16.    This library is free software; you can redistribute it and/or
  17.    modify it under the terms of the GNU Lesser General Public
  18.    License version 2.1, as published by the Free Software Foundation.
  19.  
  20.    This library is distributed in the hope that it will be useful,
  21.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  22.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  23.    Lesser General Public License for more details.
  24.  
  25.    You should have received a copy of the GNU Lesser General Public
  26.    License along with this library; if not, write to the Free Software
  27.    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  28.    MA  02111-1307  USA
  29.  
  30.  
  31.    Sun Industry Standards Source License Version 1.1
  32.    =================================================
  33.    The contents of this file are subject to the Sun Industry Standards
  34.    Source License Version 1.1 (the "License"); You may not use this file
  35.    except in compliance with the License. You may obtain a copy of the
  36.    License at http://www.openoffice.org/license.html.
  37.  
  38.    Software provided under this License is provided on an "AS IS" basis,
  39.    WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  40.    WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  41.    MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  42.    See the License for the specific provisions governing your rights and
  43.    obligations concerning the Software.
  44.  
  45.    The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  46.  
  47.    Copyright ┬⌐ 2002 by Sun Microsystems, Inc.
  48.  
  49.    All Rights Reserved.
  50.  
  51.    Contributor(s): _______________________________________
  52.  
  53. -->
  54. <xsl:stylesheet version="1.0"
  55.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  56.                 xmlns:office="http://openoffice.org/2000/office"
  57.                 xmlns:style="http://openoffice.org/2000/style"
  58.                 xmlns:text="http://openoffice.org/2000/text"
  59.                 xmlns:table="http://openoffice.org/2000/table"
  60.                 xmlns:draw="http://openoffice.org/2000/drawing"
  61.                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
  62.                 xmlns:xlink="http://www.w3.org/1999/xlink"
  63.                 xmlns:number="http://openoffice.org/2000/datastyle"
  64.                 xmlns:svg="http://www.w3.org/2000/svg"
  65.                 xmlns:chart="http://openoffice.org/2000/chart"
  66.                 xmlns:dr3d="http://openoffice.org/2000/dr3d"
  67.                 xmlns:math="http://www.w3.org/1998/Math/MathML"
  68.                 xmlns:form="http://openoffice.org/2000/form"
  69.                 xmlns:script="http://openoffice.org/2000/script"
  70.                 office:class="text"
  71.                 office:version="1.0"
  72.                 xmlns:dc="http://purl.org/dc/elements/1.1/"
  73.                 xmlns:meta="http://openoffice.org/2000/meta"
  74.                 xmlns:config="http://openoffice.org/2001/config"
  75.                 xmlns:help="http://openoffice.org/2000/help"
  76.                 xmlns:xt="http://www.jclark.com/xt"
  77.                 extension-element-prefixes="xt"
  78.                 xmlns:xalan="http://xml.apache.org/xalan"
  79.                 xmlns:java="http://xml.apache.org/xslt/java"
  80.                 exclude-result-prefixes="java">
  81.  
  82.  
  83.  
  84.     <!-- ************ -->
  85.     <!-- *** body *** -->
  86.     <!-- ************ -->
  87.  
  88.  
  89.     <xsl:template match="/*/office:body">
  90.         <xsl:param name="collectedGlobalData"/>
  91.  
  92.         <!-- isDebugMode-START: only isDebugMode purpose: shows the inlined style attributes of the temporary variable -->
  93.         <xsl:if test="$isDebugMode and not($outputType = 'CSS_HEADER')">
  94.             <xsl:element name="debug_tree_of_styles"><xsl:text>
  95.             </xsl:text><xsl:for-each select="$collectedGlobalData/allstyles/*">
  96. <xsl:text>                      </xsl:text><xsl:value-of select="name()"/><xsl:text> = </xsl:text><xsl:value-of select="."/><xsl:text>
  97.             </xsl:text>
  98.                     </xsl:for-each>
  99.             </xsl:element>
  100.         </xsl:if>
  101.     <!-- isDebugMode-END -->
  102.  
  103.  
  104.         <!-- not using of 'apply-styles-and-content' as the content table information migth have been added to 'collectedGlobalData' variable -->
  105.         <xsl:apply-templates select="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name -->
  106.             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  107.         </xsl:apply-templates>
  108.  
  109.  
  110.         <!-- Usability feature, a link to the Content talbe above all level 1 header -->
  111.         <xsl:if test="$contentTableHeadings">
  112.             <xsl:call-template name="add-child-document-usability-links"/>
  113.         </xsl:if>
  114.  
  115.  
  116.         <xsl:choose>
  117.             <xsl:when test="not($outputType = 'WML') and not($outputType = 'PALM')">
  118.                 <xsl:choose>
  119.                     <!--If the input document is a global document and embed child documents (links) the transformation of the children will be started as well.
  120.                         This is necessary as child documents do not know anything about their embedding into a global document. Chapters of childs
  121.                         always start to count by zero instead of continously numbering.
  122.                         For this, the chapter numbers of the current document (as a sequence of a global document) is dependent
  123.                         of the number of chapter of the same level in preceding documents.
  124.                         In case of multiple children, for usability reasons some linking is gonna be offered and the URLs of the content-table,
  125.                         preceding and following file have to be given for the transformation.
  126.                         -->
  127.                     <xsl:when test="/*/@office:class='text-global' and /*/office:body/text:section/text:section-source/@xlink:href">
  128.                         <!-- the children will be called later with a modified 'collectedGlobalData' variable -->
  129.                         <xsl:call-template name="transform-global-document-and-children">
  130.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  131.                         </xsl:call-template>
  132.                     </xsl:when>
  133.                     <xsl:otherwise>
  134.                         <xsl:apply-templates>
  135.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  136.                         </xsl:apply-templates>
  137.                     </xsl:otherwise>
  138.                 </xsl:choose>
  139.             </xsl:when>
  140.             <xsl:otherwise>
  141.                 <xsl:apply-templates>
  142.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  143.                 </xsl:apply-templates>
  144.             </xsl:otherwise>
  145.         </xsl:choose>
  146.  
  147.  
  148.  
  149.         <!-- Usability feature, a link to the Content talbe above all level 1 header -->
  150.         <xsl:if test="$contentTableHeadings">
  151.             <xsl:call-template name="add-child-document-usability-links"/>
  152.         </xsl:if>
  153.  
  154.  
  155.     </xsl:template>
  156.  
  157.  
  158.  
  159.  
  160.     <!-- deactivating default template -->
  161.     <xsl:template match="*"/>
  162.  
  163.  
  164.     <!-- allowing all matched text nodes -->
  165.     <xsl:template match="text()">
  166. <!-- WML         <xsl:value-of select="normalize-space(.)"/> -->
  167.         <xsl:value-of select="."/>
  168.     </xsl:template>
  169.  
  170.  
  171.  
  172.     <!-- ################### -->
  173.     <!-- ### INLINE-TEXT ### -->
  174.     <!-- ################### -->
  175.  
  176.  
  177.     <!-- ****************** -->
  178.     <!-- *** Whitespace *** -->
  179.     <!-- ****************** -->
  180.  
  181.  
  182.     <xsl:template match="text:s">
  183.         <xsl:call-template name="write-breakable-whitespace">
  184.             <xsl:with-param name="whitespaces" select="@text:c"/>
  185.         </xsl:call-template>
  186.     </xsl:template>
  187.  
  188.  
  189.     <!--write the number of 'whitespaces' -->
  190.     <xsl:template name="write-breakable-whitespace">
  191.         <xsl:param name="whitespaces"/>
  192.  
  193.         <!--write two space chars as the normal white space character will be stripped
  194.             and the other is able to break -->
  195.         <xsl:text> </xsl:text>
  196.         <xsl:if test="$whitespaces >= 2">
  197.             <xsl:call-template name="write-breakable-whitespace-2">
  198.                 <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
  199.             </xsl:call-template>
  200.         </xsl:if>
  201.     </xsl:template>
  202.  
  203.  
  204.     <!--write the number of 'whitespaces' -->
  205.     <xsl:template name="write-breakable-whitespace-2">
  206.         <xsl:param name="whitespaces"/>
  207.         <!--write two space chars as the normal white space character will be stripped
  208.             and the other is able to break -->
  209.         <xsl:text> </xsl:text>
  210.         <xsl:if test="$whitespaces >= 2">
  211.             <xsl:call-template name="write-breakable-whitespace">
  212.                 <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
  213.             </xsl:call-template>
  214.         </xsl:if>
  215.     </xsl:template>
  216.  
  217.  
  218.  
  219.  
  220.     <!-- *************** -->
  221.     <!-- *** Textbox *** -->
  222.     <!-- *************** -->
  223.  
  224.     <xsl:template match="draw:text-box">
  225.         <xsl:param name="collectedGlobalData"/>
  226.  
  227.             <xsl:choose>
  228.                 <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  229.                 <!--                or                  -->
  230.                 <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  231.                 <xsl:when test="$outputType = 'CSS_HEADER' or $outputType = 'CSS_INLINED'">
  232.                     <xsl:element name="span">
  233.                         <xsl:if test="@fo:min-height | @svg:width">
  234.                             <xsl:attribute name="style">
  235.                                 <xsl:choose>
  236.                                     <xsl:when test="not(@svg:width)">
  237.                                         <xsl:text>height: </xsl:text><xsl:value-of select="@fo:min-height"/><xsl:text>; </xsl:text>
  238.                                     </xsl:when>
  239.                                     <xsl:when test="not(@fo:min-height)">
  240.                                         <xsl:text>width: </xsl:text><xsl:value-of select="@svg:width"/><xsl:text>; </xsl:text>
  241.                                     </xsl:when>
  242.                                     <xsl:otherwise>
  243.                                         <xsl:text>height: </xsl:text><xsl:value-of select="@fo:min-height"/><xsl:text>; </xsl:text>
  244.                                         <xsl:text>width: </xsl:text><xsl:value-of select="@svg:width"/><xsl:text>; </xsl:text>
  245.                                     </xsl:otherwise>
  246.                                 </xsl:choose>
  247.                             </xsl:attribute>
  248.                         </xsl:if>
  249.                         <xsl:apply-templates select="@draw:name"/>
  250.                         <xsl:call-template name="apply-styles-and-content">
  251.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  252.                         </xsl:call-template>
  253.                     </xsl:element>
  254.                 </xsl:when>
  255.                 <!-- 2DO prove best usage for PALM -->
  256.                 <!--+++++ PALM 3.2 SUBSET INLINED WAY  +++++-->
  257.                 <xsl:when test="$outputType = 'PALM'">
  258.                     <xsl:element name="span">
  259.                         <xsl:call-template name="apply-styles-and-content">
  260.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  261.                         </xsl:call-template>
  262.                     </xsl:element>
  263.                 </xsl:when>
  264.                 <!-- 2DO prove best usage for WML -->
  265.                 <!--+++++ WML / WAP  +++++-->
  266.                 <xsl:otherwise>
  267.                     <!-- no nested p tags in wml1.1 allowed -->
  268.                     <xsl:choose>
  269.                         <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  270.                             <xsl:call-template name="apply-styles-and-content">
  271.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  272.                             </xsl:call-template>
  273.                         </xsl:when>
  274.                         <xsl:otherwise>
  275.                             <xsl:element name="p">
  276.                                 <xsl:call-template name="apply-styles-and-content">
  277.                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  278.                                 </xsl:call-template>
  279.                              </xsl:element>
  280.                         </xsl:otherwise>
  281.                     </xsl:choose>
  282.                 </xsl:otherwise>
  283.             </xsl:choose>
  284.     </xsl:template>
  285.  
  286.     <!-- ID / NAME of text-box -->
  287.     <xsl:template match="@draw:name">
  288.  
  289.         <xsl:attribute name="id">
  290.             <xsl:value-of select="."/>
  291.         </xsl:attribute>
  292.     </xsl:template>
  293.  
  294.  
  295.  
  296.     <!-- ****************** -->
  297.     <!-- *** Paragraphs *** -->
  298.     <!-- ****************** -->
  299.  
  300.     <xsl:template match="text:p | draw:page">
  301.         <xsl:param name="collectedGlobalData"/>
  302.  
  303.             <xsl:choose>
  304.                 <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  305.                 <xsl:when test="$outputType = 'CSS_HEADER'">
  306.                     <xsl:element name="p">
  307.                         <xsl:call-template name="apply-styles-and-content">
  308.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  309.                         </xsl:call-template>
  310.                     </xsl:element>
  311.                 </xsl:when>
  312.  
  313.                 <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  314.                 <xsl:when test="$outputType = 'CSS_INLINED'">
  315.                     <xsl:element name="p">
  316.                         <xsl:call-template name="apply-styles-and-content">
  317.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  318.                         </xsl:call-template>
  319.                     </xsl:element>
  320.                 </xsl:when>
  321.                 <!--+++++ PALM 3.2 SUBSET INLINED WAY  +++++-->
  322.                 <xsl:when test="$outputType = 'PALM'">
  323.                     <xsl:choose>
  324.                         <!-- in palm paragraphs children of text:list-items are better shown without 'p' tag-->
  325.                         <xsl:when test="name(parent::*) = 'text:list-item'">
  326.                             <xsl:call-template name="apply-styles-and-content">
  327.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  328.                             </xsl:call-template>
  329.                         </xsl:when>
  330.                         <xsl:otherwise>
  331.                             <xsl:element name="p">
  332.                                 <xsl:call-template name="apply-styles-and-content">
  333.                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  334.                                 </xsl:call-template>
  335.                             </xsl:element>
  336.                         </xsl:otherwise>
  337.                     </xsl:choose>
  338.                 </xsl:when>
  339.                 <!--+++++ WML / WAP  +++++-->
  340.                 <xsl:otherwise>
  341.                     <!-- no nested p tags in wml1.1 allowed -->
  342.                     <xsl:choose>
  343.                         <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  344.                             <xsl:call-template name="apply-styles-and-content">
  345.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  346.                             </xsl:call-template>
  347.                         </xsl:when>
  348.                         <xsl:otherwise>
  349.                             <xsl:element name="p">
  350.                                 <xsl:call-template name="apply-styles-and-content">
  351.                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  352.                                 </xsl:call-template>
  353.                              </xsl:element>
  354.                         </xsl:otherwise>
  355.                     </xsl:choose>
  356.                 </xsl:otherwise>
  357.             </xsl:choose>
  358.     </xsl:template>
  359.  
  360.  
  361.  
  362.     <!-- ***************** -->
  363.     <!-- *** Text Span *** -->
  364.     <!-- ***************** -->
  365.  
  366.     <xsl:template match="text:span">
  367.         <xsl:param name="collectedGlobalData"/>
  368.  
  369.         <xsl:choose>
  370.             <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  371.             <xsl:when test="$outputType = 'CSS_HEADER'">
  372.                 <xsl:element name="span">
  373.                     <xsl:call-template name="apply-styles-and-content">
  374.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  375.                     </xsl:call-template>
  376.                 </xsl:element>
  377.             </xsl:when>
  378.  
  379.             <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  380.             <xsl:when test="$outputType = 'CSS_INLINED'">
  381.                 <xsl:element name="span">
  382.                     <xsl:call-template name="apply-styles-and-content">
  383.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  384.                     </xsl:call-template>
  385.                 </xsl:element>
  386.             </xsl:when>
  387.             <!--+++++ PALM 3.2 SUBSET INLINED WAY  +++++-->
  388.             <xsl:when test="$outputType = 'PALM'">
  389.                 <xsl:call-template name="apply-styles-and-content">
  390.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  391.                 </xsl:call-template>
  392.             </xsl:when>
  393.             <!--+++++ WML / WAP  +++++-->
  394.             <xsl:otherwise>
  395.                 <!-- no nested p tags in wml1.1 allowed -->
  396.                 <xsl:choose>
  397.                     <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  398.                         <xsl:call-template name="apply-styles-and-content">
  399.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  400.                         </xsl:call-template>
  401.                     </xsl:when>
  402.                     <xsl:otherwise>
  403.                         <xsl:element name="p">
  404.                             <xsl:call-template name="apply-styles-and-content">
  405.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  406.                             </xsl:call-template>
  407.                         </xsl:element>
  408.                     </xsl:otherwise>
  409.                 </xsl:choose>
  410.             </xsl:otherwise>
  411.         </xsl:choose>
  412.     </xsl:template>
  413.  
  414.  
  415.  
  416.     <!-- **************** -->
  417.     <!-- *** Headings *** -->
  418.     <!-- **************** -->
  419.  
  420.     <xsl:template match="text:h">
  421.         <xsl:param name="collectedGlobalData"/>
  422.  
  423.         <!-- Every heading element will get an unique anchor for its file, from its hiearchy level and name:
  424.             For example:  The heading title 'My favorite heading' might get <a name="1+2+2+My+favorite+heading"/> -->
  425.         <xsl:choose>
  426.             <xsl:when test="$disableLinkedTableOfContent or $isJavaDisabled or not($outputType = 'CSS_HEADER')">
  427.             <!-- The URL linking of an table-of-content is due to a bug (cmp. bug id# 102311) not mapped as URL in the XML.
  428.                  Linking of the table-of-content can therefore only be archieved by a work-around in HTML -->
  429.                 <xsl:call-template name="create-heading">
  430.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  431.                 </xsl:call-template>
  432.            </xsl:when>
  433.            <xsl:otherwise>
  434.                 <!-- necessary as anchor for the content table -->
  435.                 <xsl:call-template name="create-heading-anchor">
  436.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  437.                 </xsl:call-template>
  438.  
  439.                 <!-- no embedding the orginal header, as an explicit anchor might be already set -->
  440.                 <xsl:call-template name="create-heading">
  441.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  442.                 </xsl:call-template>
  443.             </xsl:otherwise>
  444.         </xsl:choose>
  445.     </xsl:template>
  446.  
  447.  
  448.     <!-- default matching for header elements -->
  449.     <xsl:template name="create-heading">
  450.         <xsl:param name="collectedGlobalData"/>
  451.  
  452.         <xsl:choose>
  453.             <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  454.             <xsl:when test="$outputType = 'CSS_HEADER'">
  455.  
  456.                 <xsl:variable name="headertyp" select="concat('h', @text:level)"/>
  457.                 <xsl:element name="{$headertyp}">
  458.  
  459.                     <!-- outline style 'text:min-label-width' is interpreted as a CSS 'margin-left' attribute -->
  460.                     <xsl:variable name="min-label" select="$office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:level]/style:properties/@text:min-label-width"/>
  461.                     <xsl:if test="$min-label">
  462.                         <xsl:attribute name="style"><xsl:text>margin-left:</xsl:text><xsl:value-of select="$min-label"/><xsl:text>;</xsl:text></xsl:attribute>
  463.                     </xsl:if>
  464.  
  465.  
  466.                     <xsl:attribute name="class"><xsl:value-of select="translate(@text:style-name, '. %()/\', '')"/></xsl:attribute>
  467.  
  468.                     <!-- writing out a chapter number if desired (noticable when a corresponding 'text:outline-style' exist -->
  469.                     <xsl:if test="string-length($office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:level]/@style:num-format) != 0">
  470.  
  471.                         <xsl:choose>
  472.                             <xsl:when test="$disableLinkedTableOfContent or $isJavaDisabled or not($outputType = 'CSS_HEADER')">
  473.                                 <!-- the chapter number is the sum of 'text:start-value' and preceding siblings of 'text:h' with the same 'text:level',
  474.                                      furthermore when the current document is referenced by a global document - as part of a whole sequence of documents -,
  475.                                      the chapter no. is dependent of the amount of started headers in preceding documents.
  476.                                      If the 'text:start-value is not set the default value of '1' has to be taken. -->
  477.                                 <xsl:variable name="startValue" select="$office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:level]/@text:start-value"/>
  478.                                 <xsl:choose>
  479.                                     <xsl:when test="$startValue">
  480.                                         <xsl:choose>
  481.                                             <xsl:when test="@text:level='1'">
  482.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  483.                                                             + $precedingChapterLevel1
  484.                                                             + $startValue"/>
  485.                                             </xsl:when>
  486.                                             <xsl:when test="@text:level='2'">
  487.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  488.                                                             + $precedingChapterLevel2
  489.                                                             + $startValue"/>
  490.                                             </xsl:when>
  491.                                             <xsl:when test="@text:level='3'">
  492.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  493.                                                             + $precedingChapterLevel3
  494.                                                             + $startValue"/>
  495.                                             </xsl:when>
  496.                                             <xsl:when test="@text:level='4'">
  497.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  498.                                                             + $precedingChapterLevel4
  499.                                                             + $startValue"/>
  500.                                             </xsl:when>
  501.                                             <xsl:when test="@text:level='5'">
  502.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  503.                                                             + $precedingChapterLevel5
  504.                                                             + $startValue"/>
  505.                                             </xsl:when>
  506.                                             <xsl:when test="@text:level='6'">
  507.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  508.                                                             + $precedingChapterLevel6
  509.                                                             + $startValue"/>
  510.                                             </xsl:when>
  511.                                             <xsl:when test="@text:level='7'">
  512.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  513.                                                             + $precedingChapterLevel7
  514.                                                             + $startValue"/>
  515.                                             </xsl:when>
  516.                                             <xsl:when test="@text:level='8'">
  517.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  518.                                                             + $precedingChapterLevel8
  519.                                                             + $startValue"/>
  520.                                             </xsl:when>
  521.                                             <xsl:when test="@text:level='9'">
  522.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  523.                                                             + $precedingChapterLevel9
  524.                                                             + $startValue"/>
  525.                                             </xsl:when>
  526.                                             <xsl:when test="@text:level='10'">
  527.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  528.                                                             + $precedingChapterLevel10
  529.                                                             + $startValue"/>
  530.                                             </xsl:when>
  531.                                         </xsl:choose>
  532.                                     </xsl:when>
  533.                                     <xsl:otherwise>
  534.                                         <xsl:choose>
  535.                                             <xsl:when test="@text:level='1'">
  536.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  537.                                                             + $precedingChapterLevel1
  538.                                                             + 1"/>
  539.                                             </xsl:when>
  540.                                             <xsl:when test="@text:level='2'">
  541.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  542.                                                             + $precedingChapterLevel2
  543.                                                             + 1"/>
  544.                                             </xsl:when>
  545.                                             <xsl:when test="@text:level='3'">
  546.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  547.                                                             + $precedingChapterLevel3
  548.                                                             + 1"/>
  549.                                             </xsl:when>
  550.                                             <xsl:when test="@text:level='4'">
  551.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  552.                                                             + $precedingChapterLevel4
  553.                                                             + 1"/>
  554.                                             </xsl:when>
  555.                                             <xsl:when test="@text:level='5'">
  556.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  557.                                                             + $precedingChapterLevel5
  558.                                                             + 1"/>
  559.                                             </xsl:when>
  560.                                             <xsl:when test="@text:level='6'">
  561.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  562.                                                             + $precedingChapterLevel6
  563.                                                             + 1"/>
  564.                                             </xsl:when>
  565.                                             <xsl:when test="@text:level='7'">
  566.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  567.                                                             + $precedingChapterLevel7
  568.                                                             + 1"/>
  569.                                             </xsl:when>
  570.                                             <xsl:when test="@text:level='8'">
  571.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  572.                                                             + $precedingChapterLevel8
  573.                                                             + 1"/>
  574.                                             </xsl:when>
  575.                                             <xsl:when test="@text:level='9'">
  576.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  577.                                                             + $precedingChapterLevel9
  578.                                                             + 1"/>
  579.                                             </xsl:when>
  580.                                             <xsl:when test="@text:level='10'">
  581.                                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  582.                                                             + $precedingChapterLevel10
  583.                                                             + 1"/>
  584.                                             </xsl:when>
  585.                                         </xsl:choose>
  586.                                     </xsl:otherwise>
  587.                                 </xsl:choose>
  588.                             </xsl:when>
  589.                             <xsl:otherwise>
  590.                                 <xsl:call-template name="get-absolute-chapter-no">
  591.                                     <xsl:with-param name="precedingChapterLevel1"    select="$precedingChapterLevel1"/>
  592.                                     <xsl:with-param name="collectedGlobalData"       select="$collectedGlobalData"/>
  593.                                 </xsl:call-template>
  594.                             </xsl:otherwise>
  595.                         </xsl:choose>
  596.                         <xsl:text>    </xsl:text>
  597.                     </xsl:if>
  598.                     <xsl:apply-templates>
  599.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  600.                     </xsl:apply-templates>
  601.  
  602.                 </xsl:element>
  603.             </xsl:when>
  604.  
  605.  
  606.             <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  607.             <xsl:when test="$outputType = 'CSS_INLINED'">
  608.                 <xsl:variable name="headertyp" select="concat('h', @text:level)"/>
  609.                 <xsl:element name="{$headertyp}">
  610.  
  611.                     <xsl:apply-templates select="@text:style-name">
  612.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  613.                     </xsl:apply-templates>
  614.  
  615.                     <!-- writing out a chapter number if desired (noticable when a corresponding 'text:outline-style' exist -->
  616.                     <xsl:if test="$office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:level]/@text:style-name">
  617.  
  618.                         <!-- the chapter number is the sum of 'text:start-value' and preceding siblings of 'text:h' with the same 'text:level' -->
  619.                         <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  620.                                             + $office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:level]/@text:start-value"/>
  621.                         <xsl:text>    </xsl:text>
  622.                     </xsl:if>
  623.  
  624.                 </xsl:element>
  625.             </xsl:when>
  626.  
  627.             <!-- 2DO: add Chapter No. for PALM and WML <-> problem nested apply-templates -->
  628.  
  629.             <!--+++++ PALM 3.2 SUBSET INLINED WAY  +++++-->
  630.             <xsl:when test="$outputType = 'PALM'">
  631.                 <xsl:variable name="headertyp" select="concat('h', @text:level)"/>
  632.                 <xsl:element name="{$headertyp}">
  633.  
  634.  
  635.                     <!-- All children content have to be nested in the styles (e.g. <i><b>ANY CONTENT</b></i>)
  636.                          for this xsl:apply-templates will be called later / implicit -->
  637.                     <xsl:call-template name="create-attribute-ALIGN">
  638.                         <!-- getting the css styles for the style name (mapped by style-mapping.xsl) -->
  639.                         <xsl:with-param name="styleProperties" select="$collectedGlobalData/allstyles/*[name()=current()/@text:style-name]"/>
  640.                     </xsl:call-template>
  641.                 </xsl:element>
  642.             </xsl:when>
  643.  
  644.             <!--+++++ WML / WAP  +++++-->
  645.             <xsl:otherwise>
  646.                 <!-- no nested p tags in wml1.1 allowed -->
  647.                 <xsl:choose>
  648.                     <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  649.                         <!-- since no header styles exist, an emphasis is used -->
  650.                         <xsl:element name="em">
  651.  
  652.                             <!-- writing out a chapter number if desired (noticable when a corresponding 'text:outline-style' exist -->
  653.                             <xsl:if test="$office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:level]/@text:style-name">
  654.  
  655.                                 <!-- the chapter number is the sum of 'text:start-value' and preceding siblings of 'text:h' with the same 'text:level' -->
  656.                                 <xsl:value-of select="count(preceding-sibling::text:h[@text:level = current()/@text:level])
  657.                                                     + $office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:level]/@text:start-value"/>
  658.                                 <xsl:text>    </xsl:text>
  659.                             </xsl:if>
  660.  
  661.                             <xsl:apply-templates select="@text:style-name">
  662.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  663.                             </xsl:apply-templates>
  664.  
  665.                         </xsl:element>
  666.                     </xsl:when>
  667.                     <xsl:otherwise>
  668.                         <xsl:element name="p">
  669.                             <!-- since no header styles exist, an emphasis is used -->
  670.                             <xsl:element name="em">
  671.                                 <xsl:call-template name="apply-styles-and-content">
  672.                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  673.                                 </xsl:call-template>
  674.                             </xsl:element>
  675.                         </xsl:element>
  676.                     </xsl:otherwise>
  677.                 </xsl:choose>
  678.             </xsl:otherwise>
  679.         </xsl:choose>
  680.     </xsl:template>
  681.  
  682.  
  683.  
  684.     <!-- ************* -->
  685.     <!-- *** Link  *** -->
  686.     <!-- ************* -->
  687.  
  688.     <xsl:template match="text:a | draw:a">
  689.         <xsl:param name="collectedGlobalData"/>
  690.  
  691.         <xsl:call-template name="create-common-link">
  692.             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  693.         </xsl:call-template>
  694.     </xsl:template>
  695.  
  696.  
  697.     <xsl:template name="create-common-link">
  698.         <xsl:param name="collectedGlobalData"/>
  699.  
  700.         <xsl:choose>
  701.             <xsl:when test="not($outputType = 'WML')">
  702.                 <xsl:element name="a">
  703.                     <xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute>
  704.                     <!--<xsl:attribute name="class">ContentLink</xsl:attribute>-->
  705.                     <xsl:call-template name="apply-styles-and-content">
  706.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  707.                     </xsl:call-template>
  708.                 </xsl:element>
  709.             </xsl:when>
  710.             <xsl:otherwise>
  711.                 <!-- no nested p tags in wml1.1 allowed -->
  712.                 <xsl:choose>
  713.                     <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  714.                         <xsl:element name="a">
  715.                             <xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute>
  716.                             <xsl:apply-templates select="descendant::text()"/>
  717.                         </xsl:element>
  718.                     </xsl:when>
  719.                     <xsl:otherwise>
  720.                         <xsl:element name="p">
  721.                             <xsl:element name="a">
  722.                                 <xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute>
  723.                                 <xsl:apply-templates select="descendant::text()"/>
  724.                             </xsl:element>
  725.                         </xsl:element>
  726.                     </xsl:otherwise>
  727.                 </xsl:choose>
  728.             </xsl:otherwise>
  729.         </xsl:choose>
  730.     </xsl:template>
  731.  
  732.  
  733.  
  734.  
  735.  
  736.     <!-- ******************* -->
  737.     <!-- *** Image Link  *** -->
  738.     <!-- ******************* -->
  739.  
  740.     <xsl:template match="draw:image">
  741.         <xsl:param name="collectedGlobalData"/>
  742.  
  743.         <!-- NO IMAGES SUPPLIED FOR WAP OR PALM -->
  744.         <xsl:if test="$outputType = 'CSS_HEADER' or $outputType = 'CSS_INLINED'">
  745.  
  746.             <xsl:element name="img">
  747.                 <xsl:if test="@svg:width">
  748.                     <xsl:attribute name="width">
  749.                         <xsl:call-template name="convert2pixel">
  750.                             <xsl:with-param name="value" select="@svg:width"/>
  751.                         </xsl:call-template>
  752.                     </xsl:attribute>
  753.                 </xsl:if>
  754.                 <xsl:if test="@svg:height">
  755.                     <xsl:attribute name="height">
  756.                         <xsl:call-template name="convert2pixel">
  757.                             <xsl:with-param name="value" select="@svg:height"/>
  758.                         </xsl:call-template>
  759.                     </xsl:attribute>
  760.                 </xsl:if>
  761.                 <xsl:if test="svg:desc">
  762.                     <xsl:attribute name="alt">
  763.                         <xsl:value-of select="svg:desc"/>
  764.                     </xsl:attribute>
  765.                 </xsl:if>
  766.                 <xsl:choose>
  767.                      <!-- for images jared in open office document -->
  768.                     <xsl:when test="contains(@xlink:href, '#Pictures/')">
  769.                         <!-- creating an absolute http URL to the packed image file -->
  770.                         <xsl:attribute name="src"><xsl:value-of select="concat($jaredRootURL, '/Pictures/', substring-after(@xlink:href, '#Pictures/'), $optionalURLSuffix)"/></xsl:attribute>
  771.                     </xsl:when>
  772. <!--                    Due to a XT bug no DOS ':' before DRIVE letter is allowed, it would result in a unkown protoco exception, but a file URL for a DOS
  773.                         path needs the DRIVE letter, therefore all relative URLs remain relativ
  774.  
  775.                     <xsl:when test="contains(@xlink:href,'//') or (substring(@xlink:href,2,1) = ':') or starts-with(@xlink:href, '/')">
  776.                         <xsl:attribute name="src"><xsl:value-of select="@xlink:href"/></xsl:attribute>
  777.                     </xsl:when>
  778.                     <xsl:otherwise>
  779.                         <!~~ creating a absolute path/URL for the referenced resource ~~>
  780.                         <xsl:attribute name="src"><xsl:value-of select="concat($absoluteSourceDirRef, @xlink:href, $optionalURLSuffix)"/></xsl:attribute>
  781.                     </xsl:otherwise>
  782. -->
  783.                     <xsl:otherwise>
  784.                         <xsl:attribute name="src"><xsl:value-of select="@xlink:href"/></xsl:attribute>
  785.                     </xsl:otherwise>
  786.                 </xsl:choose>
  787.  
  788.                 <xsl:call-template name="apply-styles-and-content">
  789.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  790.                 </xsl:call-template>
  791.             </xsl:element>
  792.             <!-- adding a line break to make the presentation more even with the OOo view -->
  793.             <xsl:element name="br"/>
  794.         </xsl:if>
  795.     </xsl:template>
  796.  
  797.  
  798.  
  799.     <!-- ******************** -->
  800.     <!-- *** ordered list *** -->
  801.     <!-- ******************** -->
  802.  
  803.     <xsl:template match="text:ordered-list">
  804.         <xsl:param name="collectedGlobalData"/>
  805.  
  806.             <xsl:choose>
  807.                 <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  808.                 <xsl:when test="$outputType = 'CSS_HEADER'">
  809.                     <xsl:element name="ol">
  810.                         <xsl:call-template name="apply-styles-and-content">
  811.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  812.                         </xsl:call-template>
  813.                     </xsl:element>
  814.                 </xsl:when>
  815.                 <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  816.                 <xsl:when test="$outputType = 'CSS_INLINED'">
  817.                     <xsl:element name="ol">
  818.                         <xsl:call-template name="apply-styles-and-content">
  819.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  820.                         </xsl:call-template>
  821.                     </xsl:element>
  822.                 </xsl:when>
  823.                 <!--+++++ PALM 3.2 SUBSET AND WAP INLINED WAY  +++++-->
  824.                 <xsl:when test="$outputType = 'PALM'">
  825.                     <xsl:element name="ol">
  826.                         <xsl:call-template name="apply-styles-and-content">
  827.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  828.                         </xsl:call-template>
  829.                     </xsl:element>
  830.                 </xsl:when>
  831.                 <!--+++++ WML / WAP  +++++-->
  832.                 <xsl:otherwise>
  833.                     <xsl:choose>
  834.                         <!-- simulating content break of capsulated list elements -->
  835.                         <xsl:when test="ancestor::text:list-item">
  836.                             <xsl:choose>
  837.                                 <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  838.                                     <!-- simulating content break of capsulated list elements -->
  839.                                     <xsl:element name="br"></xsl:element>
  840.                                     <xsl:call-template name="apply-styles-and-content">
  841.                                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  842.                                     </xsl:call-template>
  843.                                 </xsl:when>
  844.                                 <xsl:otherwise>
  845.                                     <xsl:element name="p">
  846.                                         <!-- simulating content break of capsulated list elements -->
  847.                                         <xsl:element name="br"></xsl:element>
  848.                                         <xsl:call-template name="apply-styles-and-content">
  849.                                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  850.                                         </xsl:call-template>
  851.                                     </xsl:element>
  852.                                 </xsl:otherwise>
  853.                             </xsl:choose>
  854.                         </xsl:when>
  855.                         <xsl:otherwise>
  856.                             <xsl:call-template name="apply-styles-and-content">
  857.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  858.                             </xsl:call-template>
  859.                         </xsl:otherwise>
  860.                     </xsl:choose>
  861.                 </xsl:otherwise>
  862.             </xsl:choose>
  863.     </xsl:template>
  864.  
  865.  
  866.  
  867.     <!-- ********************** -->
  868.     <!-- *** unordered list *** -->
  869.     <!-- ********************** -->
  870.  
  871.     <xsl:template match="text:unordered-list">
  872.         <xsl:param name="collectedGlobalData"/>
  873.  
  874.         <xsl:choose>
  875.             <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  876.             <xsl:when test="$outputType = 'CSS_HEADER'">
  877.                 <xsl:element name="ul">
  878.                     <xsl:call-template name="apply-styles-and-content">
  879.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  880.                     </xsl:call-template>
  881.                 </xsl:element>
  882.             </xsl:when>
  883.  
  884.             <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  885.             <xsl:when test="$outputType = 'CSS_INLINED'">
  886.                 <xsl:element name="ul">
  887.                     <xsl:call-template name="apply-styles-and-content">
  888.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  889.                     </xsl:call-template>
  890.                 </xsl:element>
  891.             </xsl:when>
  892.  
  893.             <!--+++++ PALM 3.2 SUBSET AND WAP INLINED WAY  +++++-->
  894.             <xsl:when test="$outputType = 'PALM'">
  895.                 <xsl:element name="ul">
  896.                     <xsl:call-template name="apply-styles-and-content">
  897.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  898.                     </xsl:call-template>
  899.                 </xsl:element>
  900.             </xsl:when>
  901.  
  902.             <!--+++++ WML / WAP  +++++-->
  903.             <xsl:otherwise>
  904.                 <xsl:choose>
  905.                     <!-- simulating content break of capsulated list elements -->
  906.                     <xsl:when test="ancestor::text:list-item">
  907.                         <xsl:choose>
  908.                             <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  909.                                 <!-- simulating content break of capsulated list elements -->
  910.                                 <xsl:element name="br"></xsl:element>
  911.                                 <xsl:call-template name="apply-styles-and-content">
  912.                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  913.                                 </xsl:call-template>
  914.                             </xsl:when>
  915.                             <xsl:otherwise>
  916.                                 <xsl:element name="p">
  917.                                     <!-- simulating content break of capsulated list elements -->
  918.                                     <xsl:element name="br"></xsl:element>
  919.                                     <xsl:call-template name="apply-styles-and-content">
  920.                                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  921.                                     </xsl:call-template>
  922.                                 </xsl:element>
  923.                             </xsl:otherwise>
  924.                         </xsl:choose>
  925.                     </xsl:when>
  926.                     <xsl:otherwise>
  927.                         <xsl:call-template name="apply-styles-and-content">
  928.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  929.                         </xsl:call-template>
  930.                     </xsl:otherwise>
  931.                 </xsl:choose>
  932.             </xsl:otherwise>
  933.         </xsl:choose>
  934.     </xsl:template>
  935.  
  936.  
  937.  
  938.     <!-- ****************** -->
  939.     <!-- *** list item  *** -->
  940.     <!-- ****************** -->
  941.  
  942.     <xsl:template match="text:list-item">
  943.         <xsl:param name="collectedGlobalData"/>
  944.  
  945.         <xsl:choose>
  946.             <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  947.             <xsl:when test="$outputType = 'CSS_HEADER'">
  948.                 <xsl:element name="li">
  949.                     <xsl:call-template name="apply-styles-and-content">
  950.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  951.                     </xsl:call-template>
  952.                 </xsl:element>
  953.             </xsl:when>
  954.  
  955.             <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  956.             <xsl:when test="$outputType = 'CSS_INLINED'">
  957.                 <xsl:element name="li">
  958.                     <xsl:call-template name="apply-styles-and-content">
  959.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  960.                     </xsl:call-template>
  961.                 </xsl:element>
  962.             </xsl:when>
  963.  
  964.             <!--+++++ PALM 3.2 SUBSET AND WAP INLINED WAY  +++++-->
  965.             <xsl:when test="$outputType = 'PALM'">
  966.                 <xsl:element name="li">
  967.                     <xsl:call-template name="apply-styles-and-content">
  968.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  969.                     </xsl:call-template>
  970.                 </xsl:element>
  971.             </xsl:when>
  972.  
  973.             <!--+++++ WML / WAP  +++++-->
  974.             <xsl:otherwise>
  975.                 <xsl:choose>
  976.                     <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  977.                         <!-- simulating list elements -->
  978.                         <xsl:for-each select="ancestor::text:list-item">*</xsl:for-each>
  979.                         <xsl:text>* </xsl:text>
  980.                         <xsl:call-template name="apply-styles-and-content">
  981.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  982.                         </xsl:call-template>
  983.                         <!-- list item break simulation (not in a table)-->
  984.                         <xsl:if test="not(ancestor::table:table-cell) or following-sibling::text:list-item">
  985.                             <xsl:element name="br"/>
  986.                         </xsl:if>
  987.                     </xsl:when>
  988.                     <xsl:otherwise>
  989.                         <xsl:element name="p">
  990.                             <!-- simulating list elements -->
  991.                             <xsl:for-each select="ancestor::text:list-item">*</xsl:for-each>
  992.                             <xsl:text>* </xsl:text>
  993.                             <xsl:call-template name="apply-styles-and-content">
  994.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  995.                             </xsl:call-template>
  996.                             <!-- list item break simulation (not in a table)-->
  997.                             <xsl:if test="not(ancestor::table:table-cell) or following-sibling::text:list-item">
  998.                                 <xsl:element name="br"/>
  999.                             </xsl:if>
  1000.                         </xsl:element>
  1001.                     </xsl:otherwise>
  1002.                 </xsl:choose>
  1003.             </xsl:otherwise>
  1004.         </xsl:choose>
  1005.     </xsl:template>
  1006.  
  1007.  
  1008.  
  1009.     <!-- ********************************************** -->
  1010.     <!-- *** Text Section (contains: draw:text-box) *** -->
  1011.     <!-- ********************************************** -->
  1012.  
  1013.         <xsl:template match="text:section">
  1014.         <xsl:param name="collectedGlobalData"/>
  1015.  
  1016.         <xsl:if test="not(contains(@text:display, 'none'))">
  1017.             <xsl:choose>
  1018.                 <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  1019.                 <xsl:when test="$outputType = 'CSS_HEADER'">
  1020.                     <xsl:element name="span">
  1021.                         <xsl:call-template name="apply-styles-and-content">
  1022.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1023.                         </xsl:call-template>
  1024.                     </xsl:element>
  1025.                 </xsl:when>
  1026.                 <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  1027.                 <xsl:when test="$outputType = 'CSS_INLINED'">
  1028.                     <xsl:element name="span">
  1029.                         <xsl:call-template name="apply-styles-and-content">
  1030.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1031.                         </xsl:call-template>
  1032.                     </xsl:element>
  1033.                 </xsl:when>
  1034.                 <!--+++++ PALM 3.2 SUBSET INLINED WAY  +++++-->
  1035.                 <xsl:when test="$outputType = 'PALM'">
  1036.                     <xsl:choose>
  1037.                         <xsl:when test="name(parent::*) = 'text:list-item'">
  1038.                                         <xsl:call-template name="apply-styles-and-content">
  1039.                                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1040.                                         </xsl:call-template>
  1041.                         </xsl:when>
  1042.                         <xsl:otherwise>
  1043.                             <xsl:element name="p">
  1044.                                 <xsl:call-template name="apply-styles-and-content">
  1045.                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1046.                                 </xsl:call-template>
  1047.                             </xsl:element>
  1048.                         </xsl:otherwise>
  1049.                     </xsl:choose>
  1050.                 </xsl:when>
  1051.                 <!--+++++ WML / WAP  +++++-->
  1052.                 <xsl:otherwise>
  1053.                     <xsl:choose>
  1054.                         <xsl:when test="not($outputType = 'WML')">
  1055.                             <xsl:element name="a">
  1056.                                 <xsl:attribute name="href"><xsl:value-of select="@xlink:href"/></xsl:attribute>
  1057.                                 <xsl:call-template name="apply-styles-and-content">
  1058.                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1059.                                 </xsl:call-template>
  1060.                             </xsl:element>
  1061.                         </xsl:when>
  1062.                         <xsl:otherwise>
  1063.                             <!-- no nested p tags in wml1.1 allowed -->
  1064.                             <xsl:choose>
  1065.                                 <xsl:when test="ancestor::*[contains($wap-paragraph-elements, name())]">
  1066.                                     <xsl:call-template name="apply-styles-and-content">
  1067.                                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1068.                                     </xsl:call-template>
  1069.                                 </xsl:when>
  1070.                                 <xsl:otherwise>
  1071.                                     <xsl:element name="p">
  1072.                                         <xsl:call-template name="apply-styles-and-content">
  1073.                                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1074.                                         </xsl:call-template>
  1075.                                     </xsl:element>
  1076.                                 </xsl:otherwise>
  1077.                             </xsl:choose>
  1078.                         </xsl:otherwise>
  1079.                     </xsl:choose>
  1080.                 </xsl:otherwise>
  1081.             </xsl:choose>
  1082.         </xsl:if>
  1083.     </xsl:template>
  1084.  
  1085.  
  1086.  
  1087.     <xsl:template match="text:line-break">
  1088.         <xsl:element name="br"/>
  1089.     </xsl:template>
  1090.  
  1091.  
  1092. <!--
  1093.     TABHANDLING PROBLEM: Tabs are possible to be shown in the HTML text file, but will be later stripped as whitespaces.
  1094.         To prevent this one way would be the PRE tag which unfortunately ALWAYS result into a line-break. No surrounding NOBR tags help.
  1095.  
  1096.     <xsl:template match="text:tab-stop">
  1097.         <xsl:if test="not(preceding-sibling::text:tab-stop)">
  1098.             <xsl:element name="pre"><xsl:text> </xsl:text><xsl:for-each select="following-sibling::text:tab-stop"><xsl:text> </xsl:text></xsl:for-each></xsl:element>
  1099.         </xsl:if>
  1100.      </xsl:template>
  1101.  
  1102.     <xsl:template match="text:tab-stop"><xsl:text> </xsl:text></xsl:template>
  1103. -->
  1104.     <!-- HOTFIX: 8 non-breakable-spaces instead of a TAB is a hack sometimes less Tabs are needed and the code more difficult to read -->
  1105.     <xsl:template match="text:tab-stop">
  1106.         <xsl:call-template name="write-breakable-whitespace">
  1107.             <xsl:with-param name="whitespaces" select="8"/>
  1108.         </xsl:call-template>
  1109.     </xsl:template>
  1110.  
  1111.     <!-- currently there have to be an explicit call of the style attribute nodes, maybe the attributes nodes have no priority only order relevant-->
  1112.     <!-- STRANGE: checked with biorythm.sxc a simple xsl:apply-templates did not recognice the styles. Maybe caused by the template match order?  -->
  1113.     <xsl:template name="apply-styles-and-content">
  1114.         <xsl:param name="collectedGlobalData"/>
  1115.  
  1116.         <xsl:apply-templates select="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name -->
  1117.             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1118.         </xsl:apply-templates>
  1119.  
  1120.         <xsl:apply-templates>
  1121.             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1122.         </xsl:apply-templates>
  1123.     </xsl:template>
  1124.  
  1125.  
  1126.     <xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name-->
  1127.         <xsl:param name="collectedGlobalData"/>
  1128.  
  1129.         <xsl:choose>
  1130.             <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
  1131.             <xsl:when test="$outputType = 'CSS_HEADER'">
  1132.                 <xsl:attribute name="class"><xsl:value-of select="translate(., '. %()/\', '')"/></xsl:attribute>
  1133.             </xsl:when>
  1134.  
  1135.             <!--+++++ HTML 4.0 INLINED WAY  +++++-->
  1136.             <xsl:when test="$outputType = 'CSS_INLINED'">
  1137.                 <xsl:attribute name="style"><xsl:value-of select="$collectedGlobalData/allstyles/*[name()=current()/.]"/></xsl:attribute>
  1138.             </xsl:when>
  1139.  
  1140.             <!--+++++ PALM 3.2 SUBSET INLINED WAY  and  WML / WAP   +++++-->
  1141.             <xsl:when test="$outputType = 'PALM' or $outputType = 'WML'">
  1142.                 <!-- getting the css styles for the style name (mapped by style-mapping.xsl) -->
  1143.                 <xsl:variable name="styleProperties" select="$collectedGlobalData/allstyles/*[name()=current()/.]"/>
  1144.                 <!-- changing the context node -->
  1145.                 <xsl:for-each select="parent::*">
  1146.                     <xsl:call-template name="create-nested-format-tags">
  1147.                         <xsl:with-param name="styleProperties" select="$styleProperties"/>
  1148.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1149.                     </xsl:call-template>
  1150.                 </xsl:for-each>
  1151.             </xsl:when>
  1152.         </xsl:choose>
  1153.     </xsl:template>
  1154.  
  1155.  
  1156.     <xsl:template match="text:sequence">
  1157.         <xsl:param name="collectedGlobalData"/>
  1158.  
  1159.         <xsl:apply-templates>
  1160.             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  1161.         </xsl:apply-templates>
  1162.     </xsl:template>
  1163.  
  1164.  
  1165. </xsl:stylesheet>
  1166.