home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2004 April / VPR0404.ISO / OPENOFFICE / INSTALL / f_0384 / palm.xsl
Text File  |  2003-04-04  |  17KB  |  405 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.                 xmlns:system="http://www.jclark.com/xt/java/java.lang.System"
  78.                 xmlns:xalan="http://xml.apache.org/xalan"
  79.                 xmlns:java="http://xml.apache.org/xslt/java"
  80.                 exclude-result-prefixes="java">
  81.  
  82.     <xsl:output cdata-section-elements="meta"/>
  83.  
  84.  
  85.     <!-- **************************** -->
  86.     <!-- *** specific palm header *** -->
  87.     <!-- **************************** -->
  88.  
  89.     <xsl:template name='palm-header-properties'>
  90.         <xsl:element name="meta">
  91.             <xsl:attribute name="name">PalmComputingPlatform</xsl:attribute>
  92.             <xsl:attribute name="content">true</xsl:attribute>
  93.         </xsl:element>
  94.         <xsl:element name="meta">
  95.             <xsl:attribute name="name">HandheldFriendly</xsl:attribute>
  96.             <xsl:attribute name="content">true</xsl:attribute>
  97.         </xsl:element>
  98.         <xsl:element name="meta">
  99.             <xsl:attribute name="name">HistoryListText</xsl:attribute>
  100.             <xsl:attribute name="content">Dateimanager : &date &time</xsl:attribute>
  101.         </xsl:element>
  102.         <xsl:element name="meta">
  103.             <xsl:attribute name="name">description</xsl:attribute>
  104.             <xsl:attribute name="content">StarPortal</xsl:attribute>
  105.         </xsl:element>
  106.         <xsl:element name="meta">
  107.             <xsl:attribute name="name">keywords</xsl:attribute>
  108.             <xsl:attribute name="content">starportal, staroffice, software</xsl:attribute>
  109.         </xsl:element>
  110.         <xsl:element name="meta">
  111.             <xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
  112.             <xsl:attribute name="content">text/html; charset=iso-8859-1</xsl:attribute>
  113.         </xsl:element>
  114.     </xsl:template>
  115.  
  116.  
  117.     <!-- ********************************* -->
  118.     <!-- *** creating table attributes *** -->
  119.     <!-- ********************************* -->
  120.  
  121.     <!-- table data (td) and table header (th) attributes -->
  122.     <xsl:template name="create-attribute-ALIGN">
  123.         <xsl:param name="styleProperties"/>
  124.  
  125.         <xsl:if test="contains($styleProperties, 'align')">
  126.             <xsl:attribute name="align">
  127.                  <xsl:choose>
  128.                     <xsl:when test="contains($styleProperties, 'align:left')">
  129.                         <xsl:text>left</xsl:text>
  130.                     </xsl:when>
  131.                     <xsl:when test="contains($styleProperties, 'align:right')">
  132.                         <xsl:text>right</xsl:text>
  133.                     </xsl:when>
  134.                     <xsl:otherwise>
  135.                         <xsl:text>center</xsl:text>
  136.                     </xsl:otherwise>
  137.                  </xsl:choose>
  138.             </xsl:attribute>
  139.         </xsl:if>
  140.     </xsl:template>
  141.  
  142.  
  143.     <!-- ********************************* -->
  144.     <!-- *** creating List attributes  *** -->
  145.     <!-- ********************************* -->
  146. <!--
  147.     <xsl:template name="create-list-attributes">
  148.         <xsl:param name="styleProperties"/>
  149.  
  150.  
  151. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  152. 2 be implemented
  153. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  154.  
  155.  
  156.     </xsl:template>
  157. -->
  158.  
  159.     <!-- ************************************************ -->
  160.     <!-- *** creating nested format tags (PALM & WML) *** -->
  161.     <!-- ************************************************ -->
  162.  
  163.     <!-- Italic -->
  164.     <xsl:template name="create-nested-format-tags">
  165.         <xsl:param name="collectedGlobalData"/>
  166.         <xsl:param name="styleProperties"/>
  167.         <xsl:choose>
  168.             <xsl:when test="contains($styleProperties, 'italic')">
  169.                 <xsl:element name="i">
  170.                     <xsl:call-template name="bold">
  171.                         <xsl:with-param name="styleProperties" select="$styleProperties"/>
  172.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  173.                     </xsl:call-template>
  174.                 </xsl:element>
  175.             </xsl:when>
  176.             <xsl:otherwise>
  177.                 <xsl:call-template name="bold">
  178.                     <xsl:with-param name="styleProperties" select="$styleProperties"/>
  179.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  180.                 </xsl:call-template>
  181.             </xsl:otherwise>
  182.         </xsl:choose>
  183.     </xsl:template>
  184.  
  185.  
  186.     <!-- Bold -->
  187.     <xsl:template name="bold">
  188.         <xsl:param name="collectedGlobalData"/>
  189.         <xsl:param name="styleProperties"/>
  190.  
  191.         <xsl:choose>
  192.             <xsl:when test="contains($styleProperties, 'bold')">
  193.                 <xsl:element name="b">
  194.                     <xsl:call-template name="underline">
  195.                         <xsl:with-param name="styleProperties" select="$styleProperties"/>
  196.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  197.                     </xsl:call-template>
  198.                 </xsl:element>
  199.             </xsl:when>
  200.             <xsl:otherwise>
  201.                 <xsl:call-template name="underline">
  202.                     <xsl:with-param name="styleProperties" select="$styleProperties"/>
  203.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  204.                 </xsl:call-template>
  205.             </xsl:otherwise>
  206.         </xsl:choose>
  207.     </xsl:template>
  208.  
  209.  
  210.     <!-- Underline : last format attribute, which is also used from WML - WML ends here! -->
  211.     <xsl:template name="underline">
  212.         <xsl:param name="collectedGlobalData"/>
  213.         <xsl:param name="styleProperties"/>
  214.  
  215.         <xsl:choose>
  216.             <xsl:when test="$outputType = 'PALM'">
  217.                 <xsl:choose>
  218.                     <xsl:when test="contains($styleProperties, 'underline')">
  219.                         <xsl:element name="u">
  220.                             <xsl:call-template name="strikethrough">
  221.                                 <xsl:with-param name="styleProperties" select="$styleProperties"/>
  222.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  223.                             </xsl:call-template>
  224.                         </xsl:element>
  225.                     </xsl:when>
  226.                     <xsl:otherwise>
  227.                         <xsl:call-template name="strikethrough">
  228.                             <xsl:with-param name="styleProperties" select="$styleProperties"/>
  229.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  230.                         </xsl:call-template>
  231.                     </xsl:otherwise>
  232.                 </xsl:choose>
  233.             </xsl:when>
  234.             <xsl:otherwise>
  235.                 <xsl:choose>
  236.                     <xsl:when test="contains($styleProperties, 'underline')">
  237.                         <xsl:element name="u">
  238.                             <xsl:apply-templates>
  239.                                 <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  240.                             </xsl:apply-templates>
  241.                         </xsl:element>
  242.                     </xsl:when>
  243.                     <xsl:otherwise>
  244.                         <xsl:apply-templates>
  245.                             <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  246.                         </xsl:apply-templates>
  247.                     </xsl:otherwise>
  248.                 </xsl:choose>
  249.             </xsl:otherwise>
  250.         </xsl:choose>
  251.     </xsl:template>
  252.  
  253.  
  254.     <!-- strikethrough -->
  255.     <xsl:template name="strikethrough">
  256.         <xsl:param name="collectedGlobalData"/>
  257.         <xsl:param name="styleProperties"/>
  258.  
  259.         <xsl:choose>
  260.             <xsl:when test="contains($styleProperties, 'strike')">
  261.                 <xsl:element name="strike">
  262.                     <xsl:call-template name="align">
  263.                         <xsl:with-param name="styleProperties" select="$styleProperties"/>
  264.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  265.                     </xsl:call-template>
  266.                 </xsl:element>
  267.             </xsl:when>
  268.             <xsl:otherwise>
  269.                 <xsl:call-template name="align">
  270.                     <xsl:with-param name="styleProperties" select="$styleProperties"/>
  271.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  272.                 </xsl:call-template>
  273.             </xsl:otherwise>
  274.         </xsl:choose>
  275.     </xsl:template>
  276.  
  277.  
  278.     <!-- Alignment -->
  279.     <xsl:template name="align">
  280.         <xsl:param name="collectedGlobalData"/>
  281.         <xsl:param name="styleProperties"/>
  282.  
  283.         <xsl:choose>
  284.             <xsl:when test="contains($styleProperties, 'align')">
  285.                 <xsl:element name="div">
  286.                     <xsl:attribute name="align">
  287.                          <xsl:choose>
  288.                             <xsl:when test="contains($styleProperties, 'align:left')">
  289.                                 <xsl:text>left</xsl:text>
  290.                             </xsl:when>
  291.                             <xsl:when test="contains($styleProperties, 'align:right')">
  292.                                 <xsl:text>right</xsl:text>
  293.                             </xsl:when>
  294.                             <xsl:otherwise>
  295.                                 <xsl:text>center</xsl:text>
  296.                             </xsl:otherwise>
  297.                          </xsl:choose>
  298.                     </xsl:attribute>
  299.                     <xsl:call-template name="font_combined">
  300.                         <xsl:with-param name="styleProperties" select="$styleProperties"/>
  301.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  302.                     </xsl:call-template>
  303.                 </xsl:element>
  304.             </xsl:when>
  305.             <xsl:otherwise>
  306.                 <xsl:call-template name="font_combined">
  307.                     <xsl:with-param name="styleProperties" select="$styleProperties"/>
  308.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  309.                 </xsl:call-template>
  310.             </xsl:otherwise>
  311.         </xsl:choose>
  312.     </xsl:template>
  313.  
  314.  
  315.     <!-- Both size and Color for font -->
  316.     <xsl:template name="font_combined">
  317.         <xsl:param name="collectedGlobalData"/>
  318.         <xsl:param name="styleProperties"/>
  319.  
  320.         <xsl:choose>
  321.             <xsl:when test="contains($styleProperties, 'color') and contains($styleProperties, 'size')">
  322.                 <xsl:element name="font">
  323.  
  324.                     <xsl:attribute name="color">
  325.                          <xsl:choose>
  326.                             <xsl:when test="contains($styleProperties, 'color:#000000')">
  327.                                 <xsl:text>#000000</xsl:text>
  328.                             </xsl:when>
  329.                             <xsl:otherwise>
  330.                                 <xsl:text>#FFFFFF</xsl:text>
  331.                             </xsl:otherwise>
  332.                          </xsl:choose>
  333.                     </xsl:attribute>
  334.  
  335.                     <xsl:attribute name="size">
  336.                         <xsl:value-of select="substring-after(substring-before($styleProperties ,':size'), 'size:')"/>
  337.                     </xsl:attribute>
  338.  
  339.                     <!-- get the embedded content -->
  340.                     <xsl:apply-templates>
  341.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  342.                     </xsl:apply-templates>
  343.                 </xsl:element>
  344.             </xsl:when>
  345.             <xsl:otherwise>
  346.                 <xsl:call-template name="font_simple">
  347.                     <xsl:with-param name="styleProperties" select="$styleProperties"/>
  348.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  349.                 </xsl:call-template>
  350.             </xsl:otherwise>
  351.         </xsl:choose>
  352.     </xsl:template>
  353.  
  354.  
  355.     <!-- size or Color for font -->
  356.     <xsl:template name="font_simple">
  357.         <xsl:param name="collectedGlobalData"/>
  358.         <xsl:param name="styleProperties"/>
  359.  
  360.         <xsl:choose>
  361.             <xsl:when test="contains($styleProperties, 'color')">
  362.                 <xsl:element name="font">
  363.                     <xsl:attribute name="color">
  364.                          <xsl:choose>
  365.                             <xsl:when test="contains($styleProperties, 'color:#000000')">
  366.                                 <xsl:text>#000000</xsl:text>
  367.                             </xsl:when>
  368.                             <xsl:otherwise>
  369.                                 <xsl:text>#FFFFFF</xsl:text>
  370.                             </xsl:otherwise>
  371.                          </xsl:choose>
  372.                     </xsl:attribute>
  373.  
  374.                     <!-- get the embedded content -->
  375.                     <xsl:apply-templates>
  376.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  377.                     </xsl:apply-templates>
  378.                 </xsl:element>
  379.             </xsl:when>
  380.  
  381.             <xsl:when test="contains($styleProperties, 'size')">
  382.                 <xsl:element name="font">
  383.                     <xsl:attribute name="size">
  384.                         <xsl:value-of select="substring-after(substring-before($styleProperties ,':size'), 'size:')"/>
  385.                     </xsl:attribute>
  386.  
  387.                     <!-- get the embedded content -->
  388.                     <xsl:apply-templates>
  389.                         <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  390.                     </xsl:apply-templates>
  391.                 </xsl:element>
  392.             </xsl:when>
  393.  
  394.             <xsl:otherwise>
  395.                 <!-- get the embedded content -->
  396.                 <xsl:apply-templates>
  397.                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
  398.                 </xsl:apply-templates>
  399.             </xsl:otherwise>
  400.         </xsl:choose>
  401.     </xsl:template>
  402.  
  403.  
  404. </xsl:stylesheet>
  405.