You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ed...@apache.org on 2005/10/26 10:30:29 UTC

svn commit: r328589 [3/5] - /lenya/trunk/src/modules/opendocument/xslt/

Added: lenya/trunk/src/modules/opendocument/xslt/main_html.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/main_html.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/main_html.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/main_html.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,474 @@
+<!--
+
+   The Contents of this file are made available subject to the terms of
+   either of the following licenses
+
+          - GNU Lesser General Public License Version 2.1
+          - Sun Industry Standards Source License Version 1.1
+
+   Sun Microsystems Inc., October, 2000
+
+   GNU Lesser General Public License Version 2.1
+   =============================================
+   Copyright 2000 by Sun Microsystems, Inc.
+   901 San Antonio Road, Palo Alto, CA 94303, USA
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License version 2.1, as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+   MA  02111-1307  USA
+
+
+   Sun Industry Standards Source License Version 1.1
+   =================================================
+   The contents of this file are subject to the Sun Industry Standards
+   Source License Version 1.1 (the "License"); You may not use this file
+   except in compliance with the License. You may obtain a copy of the
+   License at http://www.openoffice.org/license.html.
+
+   Software provided under this License is provided on an "AS IS" basis,
+   WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+   WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+   See the License for the specific provisions governing your rights and
+   obligations concerning the Software.
+
+   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+
+   Copyright © 2002 by Sun Microsystems, Inc.
+
+   All Rights Reserved.
+
+   Contributor(s): _______________________________________
+
+-->
+<xsl:stylesheet version="1.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+	xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
+	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
+	xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
+	xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
+	xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+	xmlns:xlink="http://www.w3.org/1999/xlink" 
+	xmlns:dc="http://purl.org/dc/elements/1.1/" 
+	xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
+	xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
+	xmlns:svg="http://www.w3.org/2000/svg" 
+	xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
+	xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
+	xmlns:math="http://www.w3.org/1998/Math/MathML" 
+	xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
+	xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+	xmlns:ooo="http://openoffice.org/2004/office" 
+	xmlns:ooow="http://openoffice.org/2004/writer" 
+	xmlns:oooc="http://openoffice.org/2004/calc" 
+	xmlns:dom="http://www.w3.org/2001/xml-events" 
+	xmlns:xforms="http://www.w3.org/2002/xforms" 
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns:config="http://openoffice.org/2001/config"
+        xmlns:help="http://openoffice.org/2000/help"
+        xmlns:xt="http://www.jclark.com/xt"
+	extension-element-prefixes="xt"
+        xmlns:system="http://www.jclark.com/xt/java/java.lang.System"
+        xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder"
+        xmlns:xalan="http://xml.apache.org/xalan"
+        xmlns:java="http://xml.apache.org/xslt/java"
+        	exclude-result-prefixes="java">
+
+    <xsl:output method      ="xml"
+                encoding    ="UTF-8"
+                indent      ="yes"/>
+
+
+
+    <!--+++++ INCLUDED XSL MODULES +++++-->
+    <!-- inherited style properties will be collected and written in a CSS header (CSS) -->
+    <xsl:include href="style_header.xsl"/>
+
+    <!-- inherited style properties will be collected and written as html properties in a temporary variable (HTML4, PALM) -->
+    <xsl:include href="style_inlined.xsl"/>
+
+    <!-- our xml style properties will be mapped to CSS and HTML4.x properties -->
+    <xsl:include href="style_mapping.xsl"/>
+
+    <!-- common element handling -->
+    <xsl:include href="common.xsl"/>
+
+    <!-- table handling -->
+    <xsl:include href="table.xsl"/>
+
+    <!-- palm handling -->
+    <xsl:include href="palm.xsl"/>
+
+    <!-- global document handling -->
+    <xsl:include href="global_document.xsl"/>
+
+
+
+
+
+
+
+    <!--+++++ PARAMETER FROM THE APPLICATION AND GLOBAL VARIABLES +++++-->
+
+    <!-- MANDATORY: URL of meta stream -->
+    <xsl:param name="metaFileURL"/>
+
+    <!-- MANDATORY: URL of styles stream -->
+    <xsl:param name="stylesFileURL"/>
+
+    <!-- MANDATORY: for resolving relative links
+        For resolving realtive links to the packed SO document, i.e. the path/URL of the jared sxw file (e.g. meta.xml, styles.xml, links to graphics in a relative directory) -->
+    <xsl:param name="absoluteSourceDirRef"/>
+
+    <!-- OPTIONAL (mandatory, when when source is compressed): Necessary for the in the packed OO document embedded files (mostly graphics from the compressed /Picture dir).
+         When the OpenOffice (OO) file has been unpacked the absoluteSoureDirRef can be taken,
+         Otherwise, a JAR URL could be choosen or when working with OpenOffice a so called Package-URL encoded over HTTP can be used to
+         access the jared contents of the the jared document. . -->
+    <xsl:param name="jaredRootURL" select="$absoluteSourceDirRef"/>
+
+    <!-- OPTIONAL (mandatory, when used in session based environment)
+         Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
+         This URL session is used when creating links to graphics by XSLT. Otherwise the user havt to log again in for every graphic he would like to see. -->
+    <xsl:param name="optionalURLSuffix"/>
+
+    <!-- OPTIONAL: DPI (dots per inch) the standard solution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
+    <!-- Although many pictures have the 96 dpi resolution, a higher resoltion give better results for common browsers -->
+    <xsl:param name="dpi" select="96"/>
+
+    <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
+         (i.e. debugging time and encoding chapter names for the content-table as href and anchors ) -->
+    <xsl:param name="disableJava"    select="false"/>
+    <xsl:param name="isJavaDisabled" select="boolean($disableJava)"/>
+
+    <!-- OPTIONAL: user-agent will be differntiated by this parameter given by application (e.g. java servlet)-->
+    <xsl:param name="outputType" select="'CSS_HEADER'"/>
+    <!-- set of possible deviceTyps (WML is set in its own startfile main_wml.xsl):
+    <xsl:param name="outputType" select="'CSS_HEADER'"/>
+    <xsl:param name="outputType" select="'CSS_INLINED'"/>
+    <xsl:param name="outputType" select="'PALM'"/> -->
+
+    <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
+    <xsl:param name="debug"         select="false"/>
+    <xsl:param name="isDebugMode"   select="boolean($debug)"/>
+
+    <!-- passed in by me (art) it has to be here somewhere but fudge for now -->
+    <xsl:param name="document_name"/>
+
+<!-- *************************************************************************
+    OPTIONAL: NEEDED IN CONNECTION WITH A GLOBAL DOCUMENT -->
+
+    <!--SUMMARY:
+         following parameter triggers a (quite time consuming) enabling of bookmarks in the table-of-content.
+        IN DETAIL:
+         Currently some links used in the Office XML (e.g. in the content table as '#7.Some%20Example%20Headline%7Outline')
+         is not a valid URL (cmp. bug id# 102311). No file destination is specified nor exist any anchor element for these
+         links in the Office XML.
+         A workaround for this transformation therefore had to be made. This time-consuming mechanism is disabled by default and
+         can be activated by a parameter (i.e. 'disableLinkedTableOfContent'). A creation of an anchor is made for each header element.
+         All header titles gonna be encoding to be usable in a relative URL.    -->
+    <xsl:param name="disableLinkedTableOfContent" select="false()"/>
+
+    <!-- The chapter numbers of the current document (as a sequence of a global document) is dependent of the number
+        of chapter of the same level in preceding documents. -->
+    <xsl:param name="precedingChapterLevel1"  select="0"/>
+    <xsl:param name="precedingChapterLevel2"  select="0"/>
+    <xsl:param name="precedingChapterLevel3"  select="0"/>
+    <xsl:param name="precedingChapterLevel4"  select="0"/>
+    <xsl:param name="precedingChapterLevel5"  select="0"/>
+    <xsl:param name="precedingChapterLevel6"  select="0"/>
+    <xsl:param name="precedingChapterLevel7"  select="0"/>
+    <xsl:param name="precedingChapterLevel8"  select="0"/>
+    <xsl:param name="precedingChapterLevel9"  select="0"/>
+    <xsl:param name="precedingChapterLevel10" select="0"/>
+
+    <!-- XML documents containing a table of contents,
+        gonna link for usability reason above each chapter to the preceding and following document and the content table -->
+    <xsl:param name="contentTableURL"/>
+
+    <!-- Needed for the bug workaround of missing content table links
+        by this ambigous HTML references from the content table can be evoided-->
+    <xsl:param name="globalDocumentRefToCurrentFile"/>
+
+    <!-- Needed for the bug workaround of missing content table links
+        by this node-set the relation between content-table link and children document header can be unambigous established -->
+    <xsl:param name="contentTableHeadings"/>
+
+
+<!-- END OF GLOBAL DOCUMENT SECTION
+*************************************************************************-->
+
+
+
+    <!-- works for normal separated zipped xml files as for flat filter single xml file format as well -->
+    <xsl:variable name="office:meta-file"           select="document($metaFileURL)"/>
+    <xsl:variable name="office:styles-file"         select="document($stylesFileURL)"/>
+    <xsl:variable name="office:font-decls"          select="$office:styles-file/*/office:font-decls"/>
+    <xsl:variable name="office:styles"              select="$office:styles-file/*/office:styles"/>
+    <!-- office:automatic-styles may occure in two different files (i.d. content.xml and styles.xml). Furthermore the top level tag is different in a flat xml file -->
+    <xsl:variable name="office:automatic-styles"    select="/*/office:automatic-styles"/>
+
+    <!-- simple declaration of WML used to avoid parser errors -->
+    <xsl:variable name="wap-paragraph-elements-without-table-row"/>
+    <xsl:variable name="wap-paragraph-elements"/>
+    <xsl:template name="wml-repeat-write-row"/>
+
+
+    <!-- ************************************* -->
+    <!-- *** build the propriate HTML file *** -->
+    <!-- ************************************* -->
+
+    <xsl:template match="/">
+
+        <!--<xsl:message>
+
+
+        Entered the styleSheets, transformation begins... </xsl:message>-->
+
+        <xsl:choose>
+            <xsl:when test="$isDebugMode">
+                <xsl:call-template name="check-parameter"/>
+
+                <xsl:if test="not($isJavaDisabled)">
+                    <xsl:call-template name="debug-style-collecting-time"/>
+                </xsl:if>
+            </xsl:when>
+            <xsl:otherwise>
+                <!-- to access the variable like a node-set it is necessary to convert it
+                     from a result-tree-fragment (RTF) to a node set using the James Clark extension -->
+                <xsl:variable name="collectedGlobalData-RTF">
+                    <xsl:call-template name='create-all-inline-styles'/>
+                </xsl:variable>
+
+                <xsl:choose>
+                    <xsl:when test="function-available('xt:node-set')">
+                        <xsl:call-template name="start">
+                            <xsl:with-param name="collectedGlobalData" select="xt:node-set($collectedGlobalData-RTF)"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:when test="function-available('xalan:nodeset')">
+                        <xsl:call-template name="start">
+                            <xsl:with-param name="collectedGlobalData" select="xalan:nodeset($collectedGlobalData-RTF)"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:element name="NodeSetFunctionNotAvailable"/>
+                        <xsl:call-template name="start"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template name="start">
+        <xsl:param name="collectedGlobalData"/>
+
+        <xsl:choose>
+            <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
+            <xsl:when test="$outputType = 'CSS_HEADER'">
+                <xsl:element name="html">
+                    <xsl:element name="head">
+			<xsl:element name="title">
+				<xsl:value-of select="$document_name"/>
+			</xsl:element>
+                        <xsl:if test="$isDebugMode"><xsl:message>CSS helper variable will be created....</xsl:message></xsl:if>
+                        <xsl:call-template name='common-header-properties'/>
+                        <xsl:if test="$isDebugMode"><xsl:message>CSS variable ready, header will be created....</xsl:message></xsl:if>
+                        <!-- constructing the css header simulating inheritance of style-families by style order -->
+                        <xsl:call-template name='create-css-styleheader'/>
+                        <xsl:if test="$isDebugMode"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
+                    </xsl:element>
+
+
+
+                    <xsl:variable name="backgroundImageURL" select="$office:automatic-styles/style:page-master/style:properties/style:background-image/@xlink:href"/>
+                    <xsl:element name="body">
+                        <!-- background image -->
+                        <xsl:if test="$backgroundImageURL">
+                            <xsl:attribute name="background">
+                                <xsl:choose>
+                                    <!-- for images jared in open office document -->
+                                    <xsl:when test="contains($backgroundImageURL, '#Pictures/')">
+                                        <!-- creating an absolute http URL to the contained/packed image file -->
+                                        <xsl:value-of select="concat($jaredRootURL, '/Pictures/', substring-after($backgroundImageURL, '#Pictures/'), $optionalURLSuffix)"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:attribute name="src"><xsl:value-of select="concat($jaredRootURL,$backgroundImageURL)"/></xsl:attribute>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:attribute>
+                        </xsl:if>
+
+                        <!-- processing the content of the xml file -->
+                        <xsl:apply-templates select="/*/office:body">
+                            <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                        </xsl:apply-templates>
+                    </xsl:element>
+
+                </xsl:element>
+            </xsl:when>
+
+            <!--+++++ HTML 4.0 INLINING  +++++-->
+            <xsl:when test="$outputType = 'CSS_INLINED'">
+                <xsl:element name="html">
+                    <xsl:element name="head">
+                        <xsl:call-template name='common-header-properties'/>
+                    </xsl:element>
+
+                    <xsl:variable name="backgroundImageURL" select="$office:automatic-styles/style:page-master/style:properties/style:background-image/@xlink:href"/>
+                    <xsl:element name="body">
+                        <!-- background image -->
+                        <xsl:if test="$backgroundImageURL">
+                            <xsl:attribute name="background">
+                                <xsl:choose>
+                                    <!-- for images jared in open office document -->
+                                    <xsl:when test="contains($backgroundImageURL, '#Pictures/')">
+                                        <!-- creating an absolute http URL to the contained/packed image file -->
+                                        <xsl:value-of select="concat($jaredRootURL, '/Pictures/', substring-after($backgroundImageURL, '#Pictures/'), $optionalURLSuffix)"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:attribute name="src"><xsl:value-of select="$backgroundImageURL"/></xsl:attribute>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:attribute>
+                        </xsl:if>
+                        <xsl:apply-templates select="/*/office:body">
+                            <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                        </xsl:apply-templates>
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+
+            <!--+++++ PALM-VII (3.2 HTML SUBSET)  +++++-->
+            <xsl:when test="$outputType = 'PALM'">
+                <!-- the proxy will convert the html file later to PQA -->
+                <xsl:element name="html">
+                    <xsl:element name="head">
+                        <xsl:call-template name='palm-header-properties'/>
+                    </xsl:element>
+
+                    <xsl:element name="body">
+                        <!-- processing the content of the xml file -->
+                        <xsl:apply-templates select="/*/office:body">
+                            <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                        </xsl:apply-templates>
+                    </xsl:element>
+                </xsl:element>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+
+
+
+    <!-- ********************************************* -->
+    <!-- *** Header for CSS_INLINED and CSS_HEADER *** -->
+    <!-- ********************************************* -->
+
+    <xsl:template name='common-header-properties'>
+        <xsl:apply-templates select="$office:meta-file/*/office:meta/dc:title"/>
+        <xsl:apply-templates select="$office:meta-file/*/office:meta/dc:description"/>
+<!--2DO add further header elements..
+        <xsl:apply-templates select="$office:meta-file/*/office:meta/dc:subject"/>
+        <xsl:apply-templates select="$office:meta-file/*/office:meta/meta:keywords[postition()=1]"/>-->
+    </xsl:template>
+
+    <xsl:template match="dc:title">
+        <xsl:element name="title">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+
+    <xsl:template match="dc:description">
+        <xsl:element name="meta">
+            <xsl:attribute name="name">
+                <xsl:text>description</xsl:text>
+            </xsl:attribute>
+            <xsl:attribute name="content">
+                <xsl:value-of select="."/>
+            </xsl:attribute>
+        </xsl:element>
+    </xsl:template>
+
+
+    <!-- ********************************************* -->
+    <!-- *** Measuring the time for style creating *** -->
+    <!-- ********************************************* -->
+
+
+    <xsl:template name="debug-style-collecting-time">
+
+        <xsl:variable name="startTime-RTF">
+            <xsl:choose>
+                <xsl:when test="function-available('system:current-time-millis')">
+                    <xsl:value-of select="system:current-time-millis()"/>
+                </xsl:when>
+                <xsl:when test="function-available('java:java.lang.System.currentTimeMillis')">
+                    <xsl:value-of select="java:java.lang.System.currentTimeMillis()"/>
+                </xsl:when>
+            </xsl:choose>
+        </xsl:variable>
+
+
+
+        <xsl:variable name="collectedGlobalData-RTF">
+            <xsl:call-template name='create-all-inline-styles'/>
+        </xsl:variable>
+
+
+        <xsl:choose>
+            <xsl:when test="function-available('xt:node-set')">
+                <xsl:message>Creating the inline styles....</xsl:message>
+                <xsl:variable name="startTime"              select="number(xt:node-set($startTime-RTF))"/>
+                <xsl:variable name="collectedGlobalData"    select="xt:node-set($collectedGlobalData-RTF)"/>
+                <xsl:variable name="endTime"                select="system:current-time-millis()"/>
+
+                <xsl:message>Time for instantiating style variable: <xsl:value-of select="($endTime - $startTime)"/> ms</xsl:message>
+                <xsl:call-template name="start">
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="function-available('xalan:nodeset')">
+                <xsl:message>Creating the inline styles....</xsl:message>
+                <xsl:variable name="startTime"              select="number(xalan:nodeset($startTime-RTF))"/>
+                <xsl:variable name="endTime"                select="java:java.lang.System.currentTimeMillis()"/>
+                <xsl:variable name="collectedGlobalData"    select="xalan:nodeset($collectedGlobalData-RTF)"/>
+
+                <xsl:message>Time for instantiating style variable: <xsl:value-of select="($endTime - $startTime)"/> ms</xsl:message>
+                <xsl:call-template name="start">
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:call-template>
+            </xsl:when>
+        </xsl:choose>
+
+    </xsl:template>
+
+    <!-- DEBUG purpose only: checking the parameters of this template-->
+    <xsl:template name="check-parameter">
+        <xsl:message>Parameter dpi: <xsl:value-of select="$dpi"/></xsl:message>
+        <xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL"/></xsl:message>
+        <xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL"/></xsl:message>
+        <xsl:message>Parameter absoluteSourceDirRef: <xsl:value-of select="$absoluteSourceDirRef"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel1 : <xsl:value-of select="$precedingChapterLevel1"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel2 : <xsl:value-of select="$precedingChapterLevel2"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel3 : <xsl:value-of select="$precedingChapterLevel3"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel4 : <xsl:value-of select="$precedingChapterLevel4"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel5 : <xsl:value-of select="$precedingChapterLevel5"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel6 : <xsl:value-of select="$precedingChapterLevel6"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel7 : <xsl:value-of select="$precedingChapterLevel7"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel8 : <xsl:value-of select="$precedingChapterLevel8"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel9 : <xsl:value-of select="$precedingChapterLevel9"/></xsl:message>
+        <xsl:message>Parameter precedingChapterLevel10: <xsl:value-of select="$precedingChapterLevel10"/></xsl:message>
+    </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/main_wml.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/main_wml.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/main_wml.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/main_wml.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,233 @@
+<!--
+
+   The Contents of this file are made available subject to the terms of
+   either of the following licenses
+
+          - GNU Lesser General Public License Version 2.1
+          - Sun Industry Standards Source License Version 1.1
+
+   Sun Microsystems Inc., October, 2000
+
+   GNU Lesser General Public License Version 2.1
+   =============================================
+   Copyright 2000 by Sun Microsystems, Inc.
+   901 San Antonio Road, Palo Alto, CA 94303, USA
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License version 2.1, as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+   MA  02111-1307  USA
+
+
+   Sun Industry Standards Source License Version 1.1
+   =================================================
+   The contents of this file are subject to the Sun Industry Standards
+   Source License Version 1.1 (the "License"); You may not use this file
+   except in compliance with the License. You may obtain a copy of the
+   License at http://www.openoffice.org/license.html.
+
+   Software provided under this License is provided on an "AS IS" basis,
+   WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+   WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+   See the License for the specific provisions governing your rights and
+   obligations concerning the Software.
+
+   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+
+   Copyright © 2002 by Sun Microsystems, Inc.
+
+   All Rights Reserved.
+
+   Contributor(s): _______________________________________
+
+-->
+<xsl:stylesheet version="1.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 		xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
+	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
+	xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
+	xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
+	xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+	xmlns:xlink="http://www.w3.org/1999/xlink" 
+	xmlns:dc="http://purl.org/dc/elements/1.1/" 
+	xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
+	xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
+	xmlns:svg="http://www.w3.org/2000/svg" 
+	xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
+	xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
+	xmlns:math="http://www.w3.org/1998/Math/MathML" 
+	xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
+	xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 		xmlns:ooo="http://openoffice.org/2004/office" 
+	xmlns:ooow="http://openoffice.org/2004/writer" 
+	xmlns:oooc="http://openoffice.org/2004/calc" 
+	xmlns:dom="http://www.w3.org/2001/xml-events" 
+	xmlns:xforms="http://www.w3.org/2002/xforms" 
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        office:class="text"
+        office:version="1.0"
+        xmlns:config="http://openoffice.org/2001/config"
+        xmlns:help="http://openoffice.org/2000/help"
+        xmlns:xt="http://www.jclark.com/xt"
+	extension-element-prefixes="xt"
+        xmlns:system="http://www.jclark.com/xt/java/java.lang.System"
+        xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder"
+        xmlns:xalan="http://xml.apache.org/xalan"
+        xmlns:java="http://xml.apache.org/xslt/java"
+        	exclude-result-prefixes="java">
+
+
+    <xsl:output method               = "xml"
+                omit-xml-declaration = "no"
+                media-type           = "text/vnd.wap.wml"
+                encoding             = "UTF-8"
+                indent               = "yes"
+                doctype-public       = "-//WAPFORUM//DTD WML 1.1//EN"
+                doctype-system       = "http://www.wapforum.org/DTD/wml_1.1.xml"/>
+
+
+    <!--+++++ INCLUDED XSL MODULES +++++-->
+
+      <!-- inherited style properties will be collected and written in a CSS header (CSS) -->
+    <xsl:include href="style_header.xsl"/>
+      <!-- inherited style properties will be collected and written as html properties in a temporary variable (HTML4, PALM) -->
+    <xsl:include href="style_inlined.xsl"/>
+      <!-- our xml style properties will be mapped to CSS and HTML4.x properties -->
+    <xsl:include href="style_mapping.xsl"/>
+      <!-- common element handling -->
+    <xsl:include href="common.xsl"/>
+      <!-- table handling -->
+    <xsl:include href="table.xsl"/>
+    <xsl:include href="table_wml.xsl"/>
+      <!-- palm handling -->
+    <xsl:include href="palm.xsl"/>
+
+
+
+    <!--+++++ PARAMETER FROM THE APPLICATION AND GLOBAL VARIABLES +++++-->
+
+   <!--+++++ PARAMETER FROM THE APPLICATION AND GLOBAL VARIABLES +++++-->
+
+    <!-- MANDATORY: URL of meta stream -->
+    <xsl:param name="metaFileURL"/>
+
+    <!-- MANDATORY: URL of styles stream -->
+    <xsl:param name="stylesFileURL"/>
+
+    <!-- MANDATORY: for resolving relative links
+        For resolving realtive links to the packed SO document, i.e. the path/URL of the jared sxw file (e.g. meta.xml, styles.xml, links to graphics in a relative directory) -->
+    <xsl:param name="absoluteSourceDirRef"/>
+
+    <!-- OPTIONAL (mandatory, when when source is compressed): Necessary for the in the packed OO document embedded files (mostly graphics from the compressed /Picture dir).
+         When the OpenOffice (OO) file has been unpacked the absoluteSoureDirRef can be taken,
+         Otherwise, a JAR URL could be choosen or when working with OpenOffice a so called Package-URL encoded over HTTP can be used to
+         access the jared contents of the the jared document. . -->
+    <xsl:param name="jaredRootURL" select="$absoluteSourceDirRef"/>
+
+    <!-- OPTIONAL (mandatory, when used in session based environment)
+         Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
+         This URL session is used when creating links to graphics by XSLT. Otherwise the user havt to log again in for every graphic he would like to see. -->
+    <xsl:param name="optionalURLSuffix"/>
+
+    <!-- OPTIONAL: DPI (dots per inch) the standard solution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
+    <xsl:param name="dpi" select="96"/>
+
+    <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
+         (i.e. debugging time and encoding chapter names for the content-table as href and anchors ) -->
+    <xsl:param name="isJavaDisabled" select="false()"/>
+
+    <!-- OPTIONAL: user-agent will be differntiated by this parameter given by application (e.g. java servlet)-->
+    <xsl:param name="outputType" select="'WML'"/>
+
+    <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
+    <xsl:param name="isDebugMode"   select="false()"/>
+
+    <!-- not tested for WML -->
+    <xsl:param name="disableLinkedTableOfContent" select="true()"/>
+
+    <!-- following variables are not used for WML transformation, but have to be declared -->
+    <xsl:param name="precedingChapterLevel1"  select="0"/>
+    <xsl:param name="precedingChapterLevel2"  select="0"/>
+    <xsl:param name="precedingChapterLevel3"  select="0"/>
+    <xsl:param name="precedingChapterLevel4"  select="0"/>
+    <xsl:param name="precedingChapterLevel5"  select="0"/>
+    <xsl:param name="precedingChapterLevel6"  select="0"/>
+    <xsl:param name="precedingChapterLevel7"  select="0"/>
+    <xsl:param name="precedingChapterLevel8"  select="0"/>
+    <xsl:param name="precedingChapterLevel9"  select="0"/>
+    <xsl:param name="precedingChapterLevel10" select="0"/>
+    <xsl:param name="contentTableURL"/>
+
+
+
+    <!-- works for normal separated zipped xml files as for flat filter single xml file format as well -->
+    <xsl:variable name="office:meta-file"           select="document($metaFileURL)"/>
+    <xsl:variable name="office:styles-file"         select="document($stylesFileURL)"/>
+    <xsl:variable name="office:font-decls"          select="$office:styles-file/*/office:font-decls"/>
+    <xsl:variable name="office:styles"              select="$office:styles-file/*/office:styles"/>
+    <!-- office:automatic-styles may occure in two different files (i.d. content.xml and styles.xml). Furthermore the top level tag is different in a flat xml file -->
+    <xsl:variable name="office:automatic-styles"    select="/*/office:automatic-styles"/>
+
+
+    <!--    AVOID NESTING PARAGRAPHS IN WML:
+            The list of all office tags, which map to a paragraph. This is necessary as no nested
+            paragraph tags are allowed in WML1.1 so a parent check before open has to be done.
+            Checked in a table cell, the table row is ALWAYS an ancestor, so it have to be excluded -->
+    <xsl:variable name="wap-paragraph-elements-without-table-row" select="'text:p text:h text:span text:a text:section text:list-item draw:text-box draw:page table:sub-table'"/>
+    <xsl:variable name="wap-paragraph-elements"                   select="concat($wap-paragraph-elements-without-table-row, ' table:table-row ')"/>
+
+
+
+
+    <!-- ************************************* -->
+    <!-- *** build the propriate HTML file *** -->
+    <!-- ************************************* -->
+
+    <xsl:template match="/">
+        <!--    to access the variable like a node-set it is necessary to convert it
+                from a result-tree-fragment (RTF) to a node set using the James Clark extension-->
+        <xsl:variable name="collectedGlobalData-RTF">
+                <xsl:call-template name='create-all-inline-styles'/>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="function-available('xt:node-set')">
+                <xsl:call-template name="start">
+                    <xsl:with-param name="collectedGlobalData" select="xt:node-set($collectedGlobalData-RTF)"/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="function-available('xalan:nodeset')">
+                <xsl:call-template name="start">
+                    <xsl:with-param name="collectedGlobalData" select="xalan:nodeset($collectedGlobalData-RTF)"/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="NodeSetFunctionNotAvailable"/>
+                <xsl:call-template name="start"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template name="start">
+        <xsl:param name="collectedGlobalData"/>
+
+        <xsl:element name="wml">
+            <xsl:element name="card">
+                <!-- processing the content of the xml file -->
+                <xsl:apply-templates select="/*/office:body">
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:apply-templates>
+            </xsl:element>
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/ns.txt
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/ns.txt?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/ns.txt (added)
+++ lenya/trunk/src/modules/opendocument/xslt/ns.txt Wed Oct 26 01:30:13 2005
@@ -0,0 +1,35 @@
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+        xmlns:xlink="http://www.w3.org/1999/xlink"
+	xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 		xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
+	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
+	xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
+	xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
+	xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+	xmlns:xlink="http://www.w3.org/1999/xlink" 
+	xmlns:dc="http://purl.org/dc/elements/1.1/" 
+	xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
+	xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
+	xmlns:svg="http://www.w3.org/2000/svg" 
+	xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
+	xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
+	xmlns:math="http://www.w3.org/1998/Math/MathML" 
+	xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
+	xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 		xmlns:ooo="http://openoffice.org/2004/office" 
+	xmlns:ooow="http://openoffice.org/2004/writer" 
+	xmlns:oooc="http://openoffice.org/2004/calc" 
+	xmlns:dom="http://www.w3.org/2001/xml-events" 
+	xmlns:xforms="http://www.w3.org/2002/xforms" 
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        office:class="text"
+        office:version="1.0"
+        xmlns:config="http://openoffice.org/2001/config"
+        xmlns:help="http://openoffice.org/2000/help"
+        xmlns:xt="http://www.jclark.com/xt"
+	extension-element-prefixes="xt"
+        xmlns:system="http://www.jclark.com/xt/java/java.lang.System"
+        xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder"
+        xmlns:xalan="http://xml.apache.org/xalan"
+        xmlns:java="http://xml.apache.org/xslt/java"
+        	exclude-result-prefixes="java">
+

Added: lenya/trunk/src/modules/opendocument/xslt/palm.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/palm.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/palm.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/palm.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,411 @@
+<!--
+
+   The Contents of this file are made available subject to the terms of
+   either of the following licenses
+
+          - GNU Lesser General Public License Version 2.1
+          - Sun Industry Standards Source License Version 1.1
+
+   Sun Microsystems Inc., October, 2000
+
+   GNU Lesser General Public License Version 2.1
+   =============================================
+   Copyright 2000 by Sun Microsystems, Inc.
+   901 San Antonio Road, Palo Alto, CA 94303, USA
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License version 2.1, as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+   MA  02111-1307  USA
+
+
+   Sun Industry Standards Source License Version 1.1
+   =================================================
+   The contents of this file are subject to the Sun Industry Standards
+   Source License Version 1.1 (the "License"); You may not use this file
+   except in compliance with the License. You may obtain a copy of the
+   License at http://www.openoffice.org/license.html.
+
+   Software provided under this License is provided on an "AS IS" basis,
+   WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+   WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+   See the License for the specific provisions governing your rights and
+   obligations concerning the Software.
+
+   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+
+   Copyright © 2002 by Sun Microsystems, Inc.
+
+   All Rights Reserved.
+
+   Contributor(s): _______________________________________
+
+-->
+<xsl:stylesheet version="1.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 		xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
+	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
+	xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
+	xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
+	xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+	xmlns:xlink="http://www.w3.org/1999/xlink" 
+	xmlns:dc="http://purl.org/dc/elements/1.1/" 
+	xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
+	xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
+	xmlns:svg="http://www.w3.org/2000/svg" 
+	xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
+	xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
+	xmlns:math="http://www.w3.org/1998/Math/MathML" 
+	xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
+	xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 		xmlns:ooo="http://openoffice.org/2004/office" 
+	xmlns:ooow="http://openoffice.org/2004/writer" 
+	xmlns:oooc="http://openoffice.org/2004/calc" 
+	xmlns:dom="http://www.w3.org/2001/xml-events" 
+	xmlns:xforms="http://www.w3.org/2002/xforms" 
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        office:class="text"
+        office:version="1.0"
+        xmlns:config="http://openoffice.org/2001/config"
+        xmlns:help="http://openoffice.org/2000/help"
+        xmlns:xt="http://www.jclark.com/xt"
+	extension-element-prefixes="xt"
+        xmlns:system="http://www.jclark.com/xt/java/java.lang.System"
+        xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder"
+        xmlns:xalan="http://xml.apache.org/xalan"
+        xmlns:java="http://xml.apache.org/xslt/java"
+        	exclude-result-prefixes="java">
+
+    <xsl:output cdata-section-elements="meta"/>
+
+
+    <!-- **************************** -->
+    <!-- *** specific palm header *** -->
+    <!-- **************************** -->
+
+    <xsl:template name='palm-header-properties'>
+        <xsl:element name="meta">
+            <xsl:attribute name="name">PalmComputingPlatform</xsl:attribute>
+            <xsl:attribute name="content">true</xsl:attribute>
+        </xsl:element>
+        <xsl:element name="meta">
+            <xsl:attribute name="name">HandheldFriendly</xsl:attribute>
+            <xsl:attribute name="content">true</xsl:attribute>
+        </xsl:element>
+        <xsl:element name="meta">
+            <xsl:attribute name="name">HistoryListText</xsl:attribute>
+            <xsl:attribute name="content">Dateimanager&#10;: &amp;date &amp;time</xsl:attribute>
+        </xsl:element>
+        <xsl:element name="meta">
+            <xsl:attribute name="name">description</xsl:attribute>
+            <xsl:attribute name="content">StarPortal</xsl:attribute>
+        </xsl:element>
+        <xsl:element name="meta">
+            <xsl:attribute name="name">keywords</xsl:attribute>
+            <xsl:attribute name="content">starportal, staroffice, software</xsl:attribute>
+        </xsl:element>
+        <xsl:element name="meta">
+            <xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
+            <xsl:attribute name="content">text/html; charset=iso-8859-1</xsl:attribute>
+        </xsl:element>
+    </xsl:template>
+
+
+    <!-- ********************************* -->
+    <!-- *** creating table attributes *** -->
+    <!-- ********************************* -->
+
+    <!-- table data (td) and table header (th) attributes -->
+    <xsl:template name="create-attribute-ALIGN">
+        <xsl:param name="styleProperties"/>
+
+        <xsl:if test="contains($styleProperties, 'align')">
+            <xsl:attribute name="align">
+                 <xsl:choose>
+                    <xsl:when test="contains($styleProperties, 'align:left')">
+                        <xsl:text>left</xsl:text>
+                    </xsl:when>
+                    <xsl:when test="contains($styleProperties, 'align:right')">
+                        <xsl:text>right</xsl:text>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:text>center</xsl:text>
+                    </xsl:otherwise>
+                 </xsl:choose>
+            </xsl:attribute>
+        </xsl:if>
+    </xsl:template>
+
+
+    <!-- ********************************* -->
+    <!-- *** creating List attributes  *** -->
+    <!-- ********************************* -->
+<!--
+    <xsl:template name="create-list-attributes">
+        <xsl:param name="styleProperties"/>
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+2 be implemented
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+    </xsl:template>
+-->
+
+    <!-- ************************************************ -->
+    <!-- *** creating nested format tags (PALM & WML) *** -->
+    <!-- ************************************************ -->
+
+    <!-- Italic -->
+    <xsl:template name="create-nested-format-tags">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="styleProperties"/>
+        <xsl:choose>
+            <xsl:when test="contains($styleProperties, 'italic')">
+                <xsl:element name="i">
+                    <xsl:call-template name="bold">
+                        <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                    </xsl:call-template>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="bold">
+                    <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- Bold -->
+    <xsl:template name="bold">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="styleProperties"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($styleProperties, 'bold')">
+                <xsl:element name="b">
+                    <xsl:call-template name="underline">
+                        <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                    </xsl:call-template>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="underline">
+                    <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- Underline : last format attribute, which is also used from WML - WML ends here! -->
+    <xsl:template name="underline">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="styleProperties"/>
+
+        <xsl:choose>
+            <xsl:when test="$outputType = 'PALM'">
+                <xsl:choose>
+                    <xsl:when test="contains($styleProperties, 'underline')">
+                        <xsl:element name="u">
+                            <xsl:call-template name="strikethrough">
+                                <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                                <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                            </xsl:call-template>
+                        </xsl:element>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="strikethrough">
+                            <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                            <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:choose>
+                    <xsl:when test="contains($styleProperties, 'underline')">
+                        <xsl:element name="u">
+                            <xsl:apply-templates>
+                                <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                            </xsl:apply-templates>
+                        </xsl:element>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:apply-templates>
+                            <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                        </xsl:apply-templates>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- strikethrough -->
+    <xsl:template name="strikethrough">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="styleProperties"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($styleProperties, 'strike')">
+                <xsl:element name="strike">
+                    <xsl:call-template name="align">
+                        <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                    </xsl:call-template>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="align">
+                    <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- Alignment -->
+    <xsl:template name="align">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="styleProperties"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($styleProperties, 'align')">
+                <xsl:element name="div">
+                    <xsl:attribute name="align">
+                         <xsl:choose>
+                            <xsl:when test="contains($styleProperties, 'align:left')">
+                                <xsl:text>left</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="contains($styleProperties, 'align:right')">
+                                <xsl:text>right</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:text>center</xsl:text>
+                            </xsl:otherwise>
+                         </xsl:choose>
+                    </xsl:attribute>
+                    <xsl:call-template name="font_combined">
+                        <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                    </xsl:call-template>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="font_combined">
+                    <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- Both size and Color for font -->
+    <xsl:template name="font_combined">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="styleProperties"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($styleProperties, 'color') and contains($styleProperties, 'size')">
+                <xsl:element name="font">
+
+                    <xsl:attribute name="color">
+                         <xsl:choose>
+                            <xsl:when test="contains($styleProperties, 'color:#000000')">
+                                <xsl:text>#000000</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:text>#FFFFFF</xsl:text>
+                            </xsl:otherwise>
+                         </xsl:choose>
+                    </xsl:attribute>
+
+                    <xsl:attribute name="size">
+                        <xsl:value-of select="substring-after(substring-before($styleProperties ,':size'), 'size:')"/>
+                    </xsl:attribute>
+
+                    <!-- get the embedded content -->
+                    <xsl:apply-templates>
+                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                    </xsl:apply-templates>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="font_simple">
+                    <xsl:with-param name="styleProperties" select="$styleProperties"/>
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- size or Color for font -->
+    <xsl:template name="font_simple">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="styleProperties"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($styleProperties, 'color')">
+                <xsl:element name="font">
+                    <xsl:attribute name="color">
+                         <xsl:choose>
+                            <xsl:when test="contains($styleProperties, 'color:#000000')">
+                                <xsl:text>#000000</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:text>#FFFFFF</xsl:text>
+                            </xsl:otherwise>
+                         </xsl:choose>
+                    </xsl:attribute>
+
+                    <!-- get the embedded content -->
+                    <xsl:apply-templates>
+                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                    </xsl:apply-templates>
+                </xsl:element>
+            </xsl:when>
+
+            <xsl:when test="contains($styleProperties, 'size')">
+                <xsl:element name="font">
+                    <xsl:attribute name="size">
+                        <xsl:value-of select="substring-after(substring-before($styleProperties ,':size'), 'size:')"/>
+                    </xsl:attribute>
+
+                    <!-- get the embedded content -->
+                    <xsl:apply-templates>
+                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                    </xsl:apply-templates>
+                </xsl:element>
+            </xsl:when>
+
+            <xsl:otherwise>
+                <!-- get the embedded content -->
+                <xsl:apply-templates>
+                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                </xsl:apply-templates>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/proppatch2propwrite.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/proppatch2propwrite.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/proppatch2propwrite.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/proppatch2propwrite.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+  xmlns:collection="http://apache.org/cocoon/collection/1.0" 
+  xmlns:source="http://apache.org/cocoon/propwrite/1.0" 
+  xmlns:D="DAV:">
+  
+  <xsl:param name="location" />
+  
+  <xsl:template match="/D:propertyupdate">
+    <proppatch>
+      <source:patch>
+        <source:source><xsl:value-of select="$location" /></source:source>
+        <xsl:apply-templates />
+      </source:patch>
+    </proppatch>
+  </xsl:template>
+  
+  <xsl:template match="D:set/D:prop">
+    <source:set>
+      <xsl:copy-of select="child::node()" />
+    </source:set>
+  </xsl:template>
+  
+  <xsl:template match="D:remove/D:prop">
+    <source:remove>
+      <xsl:copy-of select="child::node()" />
+    </source:remove>
+  </xsl:template>  
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/routeit.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/routeit.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/routeit.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/routeit.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+		xmlns:sql="http://apache.org/cocoon/SQL/2.0">
+
+<!-- routeit.xsl:  set up SQL
+                @author <a href="http://librarycog.uwindsor.ca">art rhyno</a>
+-->
+
+<xsl:template match="/router">
+	<xsl:variable name="quote">
+		<![CDATA[']]>
+	</xsl:variable>
+
+	<xsl:variable name="replace_quote">
+		<![CDATA[%20]]>
+	</xsl:variable>
+
+	<xsl:variable name="clean_url">
+		<xsl:value-of select="translate(url,$quote,$replace_quote)"/>
+	</xsl:variable>
+
+	<xsl:variable name="comments">
+		<xsl:value-of select="translate(htmlstuff,$quote,$replace_quote)"/>
+	</xsl:variable>
+
+	<updates>
+		<sql:execute-query>
+		<sql:query>
+			INSERT INTO resource (uri, blob_val) VALUES
+			('<xsl:value-of select="$clean_url"/>',
+			'<xsl:value-of select="$comments"/>')
+		</sql:query>
+		</sql:execute-query>
+<!--
+		<sql:execute-query>
+		<sql:query>
+		<xsl:for-each select="triples/triple">
+			<xsl:value-of select="value"/><br/>
+		</xsl:for-each>
+		</sql:query>
+		</sql:execute-query>
+
+		<sql:execute-query>
+		<sql:query>
+			SELECT resource.id from resource where 
+				uri='<xsl:value-of select="$clean_url"/>'
+		</sql:query>
+  		<sql:execute-query>
+     			<sql:query>
+				UPDATE rdf SET lockstamp=NOW() WHERE 
+					id = 
+				'<sql:ancestor-value sql:name="resource.id" sql:level="1"/>'
+     			</sql:query>
+  		</sql:execute-query>
+  		</sql:execute-query>
+-->
+	</updates>
+</xsl:template>
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/rss2ics.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/rss2ics.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/rss2ics.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/rss2ics.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,83 @@
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
+		xmlns:purl="http://purl.org/rss/1.0/" 
+		xmlns:dc="http://purl.org/dc/elements/1.1/">
+
+<!-- xbel2ics.xsl: output iCal (ics) format as gleaned from Mozilla calendar 
+                @author <a href="http://librarycog.uwindsor.ca">art rhyno</a>
+-->
+
+<xsl:output method="ics"/>
+<xsl:strip-space elements="*"/>
+<!-- use this for training, for-each -->
+<xsl:template match="/xbel">
+BEGIN:VCALENDAR<text/>
+VERSION
+ :2.0
+PRODID
+ :-//XBEL COnvertor - GPL<text/>
+<xsl:apply-templates/><text/>
+END:VCALENDAR
+</xsl:template>
+
+<xsl:template match="//bookmark">
+BEGIN:VEVENT<text/>
+<xsl:apply-templates/><text/>
+END:VEVENT<text/>
+</xsl:template>
+
+<xsl:template match="title">
+SUMMARY<text/>
+ :Bookmark - <xsl:value-of select="."/>
+UID
+ :<xsl:value-of select="@id"/>
+</xsl:template>
+
+<xsl:template match="sql:row/sql:uid">
+
+</xsl:template>
+
+<xsl:template match="sql:row/sql:shortdesc">
+DESCRIPTION<text/>
+ :<xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template match="sql:row/sql:parstat">
+STATUS<text/>
+<xsl:variable name="status" select="string(.)"/>
+<xsl:choose>
+<xsl:when test="$status='T'">
+ :TENTATIVE<text/>
+</xsl:when>
+<xsl:when test="$status='D'">
+ :DECLINED<text/>
+</xsl:when>
+<xsl:when test="$status='C'">
+ :COMPLETED<text/>
+</xsl:when>
+<xsl:when test="$status='A'">
+ :ACCEPTED<text/>
+</xsl:when>
+<xsl:otherwise>
+ :IN-PROCESS<text/>
+</xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+<xsl:template match="sql:row/sql:bookstart">
+DTSTART
+ :<xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template match="sql:row/sql:bookend">
+DTEND
+ :<xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template match="sql:row/sql:bookstamp">
+DTSTAMP
+ :<xsl:value-of select="."/>
+</xsl:template>
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/style_header.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/style_header.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/style_header.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/style_header.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,397 @@
+<!--
+
+   The Contents of this file are made available subject to the terms of
+   either of the following licenses
+
+          - GNU Lesser General Public License Version 2.1
+          - Sun Industry Standards Source License Version 1.1
+
+   Sun Microsystems Inc., October, 2000
+
+   GNU Lesser General Public License Version 2.1
+   =============================================
+   Copyright 2000 by Sun Microsystems, Inc.
+   901 San Antonio Road, Palo Alto, CA 94303, USA
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License version 2.1, as published by the Free Software Foundation.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+   MA  02111-1307  USA
+
+
+   Sun Industry Standards Source License Version 1.1
+   =================================================
+   The contents of this file are subject to the Sun Industry Standards
+   Source License Version 1.1 (the "License"); You may not use this file
+   except in compliance with the License. You may obtain a copy of the
+   License at http://www.openoffice.org/license.html.
+
+   Software provided under this License is provided on an "AS IS" basis,
+   WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+   WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+   See the License for the specific provisions governing your rights and
+   obligations concerning the Software.
+
+   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+
+   Copyright © 2002 by Sun Microsystems, Inc.
+
+   All Rights Reserved.
+
+   Contributor(s): _______________________________________
+
+-->
+<xsl:stylesheet version="1.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 		xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
+	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
+	xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
+	xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
+	xmlns:fo="http://www.w3.org/1999/XSL/Format" 
+	xmlns:xlink="http://www.w3.org/1999/xlink" 
+	xmlns:dc="http://purl.org/dc/elements/1.1/" 
+	xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
+	xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
+	xmlns:svg="http://www.w3.org/2000/svg" 
+	xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
+	xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
+	xmlns:math="http://www.w3.org/1998/Math/MathML" 
+	xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
+	xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 		xmlns:ooo="http://openoffice.org/2004/office" 
+	xmlns:ooow="http://openoffice.org/2004/writer" 
+	xmlns:oooc="http://openoffice.org/2004/calc" 
+	xmlns:dom="http://www.w3.org/2001/xml-events" 
+	xmlns:xforms="http://www.w3.org/2002/xforms" 
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        office:class="text"
+        office:version="1.0"
+        xmlns:config="http://openoffice.org/2001/config"
+        xmlns:help="http://openoffice.org/2000/help"
+        xmlns:xt="http://www.jclark.com/xt"
+	extension-element-prefixes="xt"
+        xmlns:system="http://www.jclark.com/xt/java/java.lang.System"
+        xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder"
+        xmlns:xalan="http://xml.apache.org/xalan"
+        xmlns:java="http://xml.apache.org/xslt/java"
+        	exclude-result-prefixes="java">
+
+
+
+    <!-- ****************************** -->
+    <!-- *** style sheet processing *** -->
+    <!-- ****************************** -->
+
+
+    <xsl:template name='create-css-styleheader'>
+        <xsl:comment>
+            <xsl:text>The CSS style header method for setting styles</xsl:text>
+        </xsl:comment>
+        <xsl:element name="style">
+            <xsl:attribute name="type">text/css</xsl:attribute>
+            <xsl:comment>
+                <xsl:text>
+
+        </xsl:text>
+                <xsl:call-template name="write-default-styles"/>
+
+                <!-- THE STYLE PROPERTIES OF THE FIRST WRITTEN STYLE (PARENT) IS GIVEN OUT -->
+
+                <!-- 1) styles from office:styles are possible parent from all (itself or office:automatic-styles).
+                     Therefore they are created first.
+                     Beginning with the top-level parents (the styles without any parent). -->
+                <xsl:for-each select="$office:styles/style:style[not(@style:parent-style-name)]">
+
+                    <xsl:call-template name="write-styleproperty-line"/>
+                    <xsl:call-template name="write-styleproperty-lines-for-children"/>
+                </xsl:for-each>
+
+                <xsl:text> </xsl:text>
+
+                <!-- 2) styles from office:automatic-styles can only be parent of styles from the office:automatic-styles section.
+                     Beginning with top-level styles, again, all children style will be recursivly traversed -->
+                <xsl:for-each select="$office:automatic-styles/style:style[not(@style:parent-style-name)]">
+                    <xsl:call-template name="write-styleproperty-line">
+                        <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()"/>
+                    </xsl:call-template>
+                    <xsl:call-template name="write-styleproperty-lines-for-children">
+                        <xsl:with-param name="searchOnlyInAutomaticStyles"/>
+                    </xsl:call-template>
+                </xsl:for-each>
+	<xsl:text>
+	*.P1 {
+		font-family:; font-size:15pt; }
+	*.A1 {
+		margin: 10px;
+		text-indent: 1em;
+		background-color: yellow;
+		border-width: medium;
+		border-style: outset;
+		font-family:arial,sans-serif; font-size:10pt; }
+	</xsl:text>
+            //</xsl:comment>
+        </xsl:element>
+    </xsl:template>
+
+
+    <xsl:template name='write-styleproperty-line'>
+        <xsl:param name="searchOnlyInAutomaticStyles"/>
+
+        <xsl:variable name="styleProperties">
+            <xsl:call-template name="write-style-properties">
+                <xsl:with-param name="styleAttributePath"   select="current()/style:properties/@*"/>
+            </xsl:call-template>
+        </xsl:variable>
+
+        <!-- do not write styles with no css property -->
+        <xsl:if test="not(string-length($styleProperties) = 0)">
+            <!-- write out the name of the current (parent) style in the CSS headersection (e.g. "span.myStyle") -->
+            <xsl:call-template name="write-style-name">
+                <xsl:with-param name="is-parent-style" select="true()"/>
+            </xsl:call-template>
+
+            <!-- the names of all styles children will be written out(office:style AND office:automatic-style) -->
+            <xsl:call-template name="write-children-style-names">
+                <xsl:with-param name="parentStyleName"          select="@style:name"/>
+                <xsl:with-param name="parentStyleFamily"        select="@style:family"/>
+                <xsl:with-param name="searchOnlyInAutomaticStyles"/>
+            </xsl:call-template>
+
+        <!-- the style properties of the first written style (parent) is given out -->
+        <xsl:text> {
+                </xsl:text>
+                <xsl:value-of select="$styleProperties"/>
+        <xsl:text>}
+        </xsl:text>
+
+        </xsl:if>
+
+
+
+    </xsl:template>
+
+
+
+
+    <!-- RECURSION WITH ENDCONDITON: adding style classes for all existing childs -->
+    <xsl:template name='write-styleproperty-lines-for-children'>
+        <xsl:param name="searchOnlyInAutomaticStyles"/>
+
+        <xsl:variable name="parentStyleName"    select="@style:name"/>
+        <xsl:variable name="parentStyleFamily"  select="@style:family"/>
+
+        <xsl:if test="not(searchOnlyInAutomaticStyles)">
+            <xsl:for-each select="../style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+                <xsl:call-template name="write-styleproperty-line"/>
+                <xsl:call-template name="write-styleproperty-lines-for-children"/>
+            </xsl:for-each>
+        </xsl:if>
+        <xsl:for-each select="$office:automatic-styles/style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+            <xsl:call-template name="write-styleproperty-line">
+                <xsl:with-param name="searchOnlyInAutomaticStyles"/>
+            </xsl:call-template>
+            <xsl:call-template name="write-styleproperty-lines-for-children">
+                <xsl:with-param name="searchOnlyInAutomaticStyles"/>
+            </xsl:call-template>
+        </xsl:for-each>
+    </xsl:template>
+
+
+    <xsl:template name="write-default-styles">
+
+        <!-- some default attributes in xml have to be explicitly set in HTML (e.g. margin-top="0") -->
+        <xsl:text>*.OOo_defaults</xsl:text>
+
+                <xsl:for-each select="$office:styles/style:style">
+                    <xsl:text>, </xsl:text>
+                    <xsl:value-of select="concat('*.', translate(@style:name, '. %()/\', ''))"/>
+                </xsl:for-each>
+
+                <xsl:for-each select="$office:automatic-styles/style:style">
+                    <xsl:text>, </xsl:text>
+                    <xsl:value-of select="concat('*.', translate(@style:name, '. %()/\', ''))"/>
+                </xsl:for-each>
+        <!-- 2DO: the defaults might be better collected and written in a separated (XML) file -->
+<xsl:text> {
+                margin-top:0cm; margin-bottom:0cm; }
+        </xsl:text>
+
+        <xsl:for-each select="$office:styles/style:default-style">
+            <xsl:call-template name="write-default-style"/>
+        </xsl:for-each>
+
+        <xsl:for-each select="$office:automatic-styles/style:default-style">
+            <xsl:call-template name="write-default-style"/>
+        </xsl:for-each>
+
+    </xsl:template>
+
+
+
+    <xsl:template name="write-default-style">
+        <xsl:variable name="family-style" select="@style:family"/>
+
+        <!-- some default attributes for format families (e.g. graphics, paragraphs, etc.) written as style:default-style -->
+        <xsl:value-of select="concat('*.', translate($family-style, '. %()/\', ''), '_defaults')"/>
+
+        <xsl:for-each select="$office:styles/style:style[@style:family = $family-style]">
+            <xsl:text>, </xsl:text>
+            <xsl:value-of select="concat('*.', translate(@style:name, '. %()/\', ''))"/>
+        </xsl:for-each>
+
+        <xsl:for-each select="$office:automatic-styles/style:style[@style:family = $family-style]">
+            <xsl:text>, </xsl:text>
+            <xsl:value-of select="concat('*.', translate(@style:name, '. %()/\', ''))"/>
+        </xsl:for-each>
+
+
+        <xsl:variable name="styleProperties">
+            <xsl:call-template name="write-style-properties">
+                <xsl:with-param name="styleAttributePath"   select="current()/style:properties/@*"/>
+            </xsl:call-template>
+        </xsl:variable>
+
+        <!-- do not write styles with no css property -->
+        <xsl:if test="not(string-length($styleProperties) = 0)">
+        <!-- the style properties of the first written style (parent) is given out -->
+        <xsl:text> {
+                </xsl:text>
+                <xsl:value-of select="$styleProperties"/>
+        <xsl:text>}
+        </xsl:text>
+        </xsl:if>
+
+    </xsl:template>
+
+
+    <!--++
+          The parent style will be written out!
+          For each Style:family a prefix must be added
+            <!ENTITY % styleFamily
+            "(paragraph|text|section|table|table-column|table-row|table-cell|table-page|chart|graphics|default|drawing-page|presentation|control)">
+        ++-->
+    <xsl:template name="write-style-name">
+        <xsl:param name="is-parent-style"/>
+
+        <!-- This construct is for list elements. Whenever a paragraph element is being used as child of a list element the name paragraph style is been used for
+            the list item. This can be switched as the paragaph style-name and the list-style-name are in the same element.
+            Otherwise there would be formatting errors (e.g. margin-left will be used for the content in the list elment and not for the list element itself). -->
+        <xsl:variable name="style-name">
+            <xsl:choose>
+                <xsl:when test="@style:list-style-name">
+                    <xsl:value-of select="@style:list-style-name"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="@style:name"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+
+        <xsl:if test="not($is-parent-style)">
+            <xsl:text>, </xsl:text>
+        </xsl:if>
+
+        <xsl:choose>
+            <!-- normally 'p.' would be used as CSS element,
+                 but header (h1, h2,...) are also from the style:family paragraph -->
+            <xsl:when test="@style:family='paragraph'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='text'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='section'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='table'">
+                <xsl:value-of select="concat('table.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='table-column'">
+            <!-- as column styles have to be included as span styles AFTER the table (no two class attributes in TD allowed -->
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='table-row'">
+                <xsl:value-of select="concat('tr.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='table-cell'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='table-page'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='chart'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='graphics'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='default'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='drawing-page'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='presentation'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+            <xsl:when test="@style:family='control'">
+                <xsl:value-of select="concat('*.', translate($style-name, '. %()/\', ''))"/>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- finding all style child of a section and give their styleIdentifier to the output -->
+    <xsl:template name='write-children-style-names'>
+        <xsl:param name="parentStyleName" select="@style:name"/>
+        <xsl:param name="parentStyleFamily" select="@style:family"/>
+        <xsl:param name="searchOnlyInAutomaticStyles"/>
+
+
+        <!--** the names of all office:styles children will be written out
+            ** (a automatic style can only have children in the office:automatic-style section) -->
+
+        <!-- if NOT called from a office:automatic-style parent -->
+        <xsl:if test="not(searchOnlyInAutomaticStyles)">
+            <!-- for all children in the office:style section -->
+            <xsl:for-each select="../style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+                <!-- write the style name in the css header -->
+                <xsl:call-template name="write-style-name"/>
+
+                <!-- search for child styles -->
+                <xsl:call-template name="write-children-style-names">
+                    <xsl:with-param name="parentStyleName" select="@style:name"/>
+                    <xsl:with-param name="parentStyleFamily" select="@style:family"/>
+                </xsl:call-template>
+
+            </xsl:for-each>
+        </xsl:if>
+
+        <!--** the names of all office:automatic-styles children will be written out -->
+
+        <!-- for all children in the office:automatic-style section -->
+        <xsl:for-each select="$office:automatic-styles/style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+            <!-- write the style name in the css header -->
+            <xsl:call-template name="write-style-name"/>
+
+            <!-- search for child styles -->
+            <xsl:call-template name="write-children-style-names">
+                <xsl:with-param name="parentStyleName" select="@style:name"/>
+                <xsl:with-param name="parentStyleFamily" select="@style:family"/>
+                <xsl:with-param name="searchOnlyInAutomaticStyles"/>
+            </xsl:call-template>
+
+        </xsl:for-each>
+    </xsl:template>
+
+</xsl:stylesheet>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org