home *** CD-ROM | disk | FTP | other *** search
/ Freelog 52 / Freelog052.iso / Dossier / OpenOffice / f_0271 / htmlsoff.jar / sofftohtml.xsl < prev   
Extensible Markup Language  |  2002-04-18  |  7KB  |  209 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  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 EXPRESSED 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: 2000 by Sun Microsystems, Inc.
  48.  #
  49.  #  All Rights Reserved.
  50.  #
  51.  #  Contributor(s): _______________________________________
  52.  #
  53.  #
  54.  -->
  55. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:style="http://openoffice.org/2000/style" xmlns:table="http://openoffice.org/2000/table"   xmlns:text="http://openoffice.org/2000/text" xmlns:office="http://openoffice.org/2000/office" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  56. <xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
  57. <!--doctype-system=[<!ENTITY acirc "">] -->
  58.  
  59. <xsl:strip-space elements="tokens"/>
  60.  
  61. <xsl:template match="office:document">
  62.     <html>
  63.     <xsl:apply-templates />
  64.     </html>
  65. </xsl:template>
  66.  
  67. <xsl:template match="office:document-content">
  68.     <html>
  69.     <xsl:apply-templates />
  70.     </html>
  71. </xsl:template>
  72.  
  73. <xsl:template match="office:automatic-styles">
  74.     <style type="text/css">
  75.         p.Table-Heading{font-weight :bold;}
  76.         <xsl:apply-templates />
  77.     </style>
  78. </xsl:template>
  79.  
  80. <xsl:template match="office:styles">    
  81. </xsl:template>
  82.  
  83. <xsl:template match="office:meta">    
  84. </xsl:template>
  85.  
  86. <xsl:template match="office:settings">    
  87. </xsl:template>
  88.  
  89. <xsl:template match="style:style">        
  90.     <xsl:if test="@style:family ='paragraph'">
  91.         p.<xsl:value-of select="@style:name"/>{
  92.         <xsl:apply-templates />}
  93.     </xsl:if>
  94.     <xsl:if test="@style:family ='paragraph'">
  95.         p.<xsl:value-of select="@style:name"/>{
  96.         <xsl:if test="@style:parent-style-name='Table Heading'">
  97.             font-weight :bold;font-style:italic;
  98.         </xsl:if>
  99.         <xsl:apply-templates />}
  100.     </xsl:if>
  101.     <xsl:if test="@style:family ='table-cell'">
  102.         td.<xsl:value-of select="@style:name"/>{
  103.         <xsl:if test="@style:parent-style-name='Table Heading'">
  104.             font-weight :bold;font-style:italic;
  105.         </xsl:if>
  106.         <xsl:apply-templates />}
  107.     </xsl:if>
  108. </xsl:template>
  109.  
  110. <xsl:template match="style:properties">
  111.     <!--<xsl:param name="style" select="@fo:font-weight"/>-->    
  112.      <xsl:if test="@fo:font-weight">    
  113.         font-weight :<xsl:value-of select="@fo:font-weight"/>;
  114.      </xsl:if>
  115.      <xsl:if test="@fo:font-style">
  116.          font-style :<xsl:value-of select="@fo:font-style"/>;
  117.      </xsl:if>
  118.      <xsl:if test="@style:font-name">
  119.          font-family :<xsl:value-of select="@style:font-name"/>;
  120.      </xsl:if>
  121.      <xsl:if test="@fo:font-size">
  122.          font-size : <xsl:value-of select="@fo:font-size"/>;
  123.      </xsl:if>
  124.      <xsl:if test="@style:text-underline='single'">
  125.          text-decoration :underline;
  126.      </xsl:if>
  127.      <xsl:if test="@style:text-crossing-out='single-line'">    
  128.          text-decoration:line-through;
  129.      </xsl:if>
  130.      <xsl:if test="@fo:text-align='start'">
  131.          text-align :left
  132.      </xsl:if>
  133.      <xsl:if test="@fo:text-align='center'">
  134.          text-align :center
  135.      </xsl:if>
  136.      <xsl:if test="@fo:text-align='end'">
  137.          text-align :right
  138.      </xsl:if>
  139.     <!--<xsl:value-of select="$style"/>-->
  140. </xsl:template>
  141.  
  142. <xsl:template match="office:body">
  143.         <xsl:apply-templates />
  144. </xsl:template>
  145.  
  146. <xsl:template match="table:table">
  147.         <table border="1" cellpadding="2" width="100%">
  148.             <xsl:apply-templates />    
  149.         </table>
  150.         
  151. </xsl:template>
  152.  
  153.  
  154. <xsl:template match="table:table-header-rows">
  155.         <th>
  156.             <xsl:apply-templates />    
  157.         </th>
  158. </xsl:template>
  159.  
  160. <xsl:template match="table:table-row">
  161.     <tr>
  162.         <xsl:apply-templates />    
  163.     </tr>
  164. </xsl:template>
  165.  
  166. <xsl:template match="table:table-cell">
  167.         <xsl:text disable-output-escaping="yes"><td class="</xsl:text>
  168.                     <xsl:value-of select="@table:style-name"/>
  169.                             <xsl:text disable-output-escaping="yes">"></xsl:text>
  170.                         <!--<xsl:value-of select="."/>-->
  171.                         <xsl:apply-templates />    
  172.             <xsl:text disable-output-escaping="yes"></td></xsl:text>
  173.         
  174.  
  175.     <!--<td width="20%">
  176.         <xsl:apply-templates />        
  177.     </td>-->
  178. </xsl:template>
  179.  
  180.  
  181. <xsl:template match="text:p">
  182.         <xsl:if test="ancestor-or-self::table:table-cell">
  183.             <xsl:if test=".=''">
  184.                 <br/>
  185.             </xsl:if>
  186.         </xsl:if>
  187.         <xsl:text disable-output-escaping="yes"><p class="</xsl:text>
  188.         <xsl:choose>
  189.             <xsl:when test="@text:style-name ='Table Heading'">
  190.                     Table-Heading
  191.             </xsl:when>                    
  192.             <xsl:otherwise>
  193.                     <xsl:value-of select="@text:style-name"/>
  194.             </xsl:otherwise>
  195.         </xsl:choose>
  196.         <xsl:text disable-output-escaping="yes">"></xsl:text>
  197.             <xsl:apply-templates/>
  198.         <xsl:text disable-output-escaping="yes"></p></xsl:text>
  199.         <!--<xsl:value-of select="."/>-->
  200.         <!--<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>-->
  201.         <!--<br/>-->
  202.             
  203.     
  204. </xsl:template>
  205.     
  206.  
  207.  
  208. </xsl:stylesheet>
  209.