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 [4/5] - /lenya/trunk/src/modules/opendocument/xslt/

Added: lenya/trunk/src/modules/opendocument/xslt/style_inlined.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/style_inlined.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/style_inlined.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/style_inlined.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,405 @@
+<!--
+
+   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">
+
+
+
+    <!-- ********************************************* -->
+    <!-- *** hard attributed (inlined) properties  *** -->
+    <!-- ********************************************* -->
+
+
+    <!-- RESTRICTIONS:
+            1)  As the styles-node-variables are NOT global, the style variables are not global, either!!
+            2)  As a list of elements can only be added to a variable as a result tree fragment the
+                extension is neccessary!!
+    -->
+
+    <!-- 2DO: Inline styles do not inherit from XML office defaults nor font:family defaults as the style header does
+              (cp. stylesheet 'style_header.xsl' and the 'write-default-styles' template) -->
+
+    <xsl:template name='create-all-inline-styles'>
+
+        <!--** traversee all style trees and their branches collecting style properties **-->
+        <xsl:element name="allstyles">
+        <!--** traversee all office:styles trees beginning with the top-level styles**-->
+            <xsl:for-each select="$office:styles/style:style[not(@style:parent-style-name)]">
+
+                <!--** give out the style properties of the parent node **-->
+                <xsl:call-template name='write-current-and-inherited-style-properties'>
+                    <xsl:with-param name="styles-node"                  select="$office:styles"/>
+                    <xsl:with-param name="style-family"                 select="@style:family"/>
+                    <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+                </xsl:call-template>
+
+                <!--** all office:styles children of the current top-level office:styles **-->
+                <xsl:call-template name='for-all-templates-child-styles'>
+                    <xsl:with-param name="parentStyleName"              select="@style:name"/>
+                    <xsl:with-param name="parentStyleFamily"            select="@style:family"/>
+                    <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+                </xsl:call-template>
+
+                <!--** all office:automatic-styles children of the current top-level style **-->
+                <xsl:call-template name='for-all-automatic-child-styles'>
+                    <xsl:with-param name="parentStyleName"              select="@style:name"/>
+                    <xsl:with-param name="parentStyleFamily"            select="@style:family"/>
+                    <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+                </xsl:call-template>
+            </xsl:for-each>
+
+        <!--** traversee all office:automatic-styles trees beginning with the top-level styles **-->
+            <xsl:for-each select="$office:automatic-styles/style:style[not(@style:parent-style-name)]">
+                <!--** give out the style properties of the parent node **-->
+                <xsl:call-template name='write-current-and-inherited-style-properties'>
+                    <xsl:with-param name="styles-node"                  select="$office:automatic-styles"/>
+                    <xsl:with-param name="style-family"                 select="@style:family"/>
+                    <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+                </xsl:call-template>
+
+                <!--** all children of the top-level office:automatic-styless  **-->
+                <xsl:call-template name='for-all-automatic-child-styles'>
+                    <xsl:with-param name="parentStyleName"              select="@style:name"/>
+                    <xsl:with-param name="parentStyleFamily"            select="@style:family"/>
+                    <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+                </xsl:call-template>
+            </xsl:for-each>
+        </xsl:element>
+    </xsl:template>
+
+
+
+    <xsl:template name='for-all-templates-child-styles'>
+        <xsl:param name="parentStyleName"/>
+        <xsl:param name="parentStyleFamily"/>
+        <xsl:param name="style-name-tokenized"/>
+
+        <xsl:for-each select="../style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+            <!--** give out the style properties of the current node **-->
+            <xsl:element name="{$style-name-tokenized}">
+                <xsl:call-template name='write-current-and-inherited-style-properties'>
+                    <xsl:with-param name="styles-node"                  select="$office:styles"/>
+                    <xsl:with-param name="style-family"                 select="@style:family"/>
+                    <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+                </xsl:call-template>
+            </xsl:element>
+
+            <!--** for all template-children of the current office:styles  **-->
+            <xsl:call-template name='for-all-templates-child-styles'>
+                <xsl:with-param name="styles-node"                  select="$office:styles"/>
+                <xsl:with-param name="parentStyleName"              select="@style:name"/>
+                <xsl:with-param name="parentStyleFamily"            select="@style:family"/>
+                <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+            </xsl:call-template>
+
+            <!--** for all automatic-children of the current office:styles  **-->
+            <xsl:call-template name='for-all-automatic-child-styles'>
+                <xsl:with-param name="styles-node"                  select="$office:automatic-styles"/>
+                <xsl:with-param name="parentStyleName"              select="@style:name"/>
+                <xsl:with-param name="parentStyleFamily"            select="@style:family"/>
+                <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+            </xsl:call-template>
+
+        </xsl:for-each>
+    </xsl:template>
+
+
+
+    <xsl:template name='for-all-automatic-child-styles'>
+        <xsl:param name="styles-node"/>
+        <xsl:param name="parentStyleName"/>
+        <xsl:param name="parentStyleFamily"/>
+        <xsl:param name="style-name-tokenized"/>
+
+        <xsl:for-each select="$office:automatic-styles/style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+            <!--** give out the style properties of the current node **-->
+            <xsl:element name="{$style-name-tokenized}">
+                <xsl:call-template name='write-current-and-inherited-style-properties'>
+                    <xsl:with-param name="styles-node"                  select="$office:automatic-styles"/>
+                    <xsl:with-param name="style-family"                 select="@style:family"/>
+                    <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+                </xsl:call-template>
+            </xsl:element>
+
+            <!--** for all automatic-children of the current office:automatic-styles  **-->
+            <xsl:call-template name='for-all-automatic-child-styles'>
+                <xsl:with-param name="styles-node"                  select="$office:automatic-styles"/>
+                <xsl:with-param name="parentStyleName"              select="@style:name"/>
+                <xsl:with-param name="parentStyleFamily"            select="@style:family"/>
+                <xsl:with-param name="style-name-tokenized"         select="translate(@style:name, '. %()/\', '')"/>
+            </xsl:call-template>
+        </xsl:for-each>
+    </xsl:template>
+
+
+    <xsl:template name='write-current-and-inherited-style-properties'>
+        <xsl:param name="style-family"/>
+        <xsl:param name="styles-node"/>
+        <xsl:param name="style-name-tokenized"/>
+
+        <xsl:element name="{$style-name-tokenized}">
+            <xsl:variable name="current-style-name" select="@style:name"/>
+            <xsl:variable name="parent-style-name" select="@style:parent-style-name"/>
+
+            <xsl:variable name="new-property-list">
+                <!--*** COLLECT STYLE ATTRIBUTES (only toplevel) ***-->
+                <xsl:call-template name="write-style-properties">
+                    <xsl:with-param name="styleAttributePath"   select="$styles-node/style:style[@style:family=$style-family and @style:name=$current-style-name]/style:properties/@*"/>
+                </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+                <!--*** @End: GIVE OUT All COLLECTED STYLE ATTRIBUTES (only toplevel) ***-->
+                <xsl:when test="string-length($parent-style-name)=0">
+                <!--** if no styleParent is given, the properties are given out at once **-->
+                    <xsl:value-of select="normalize-space($new-property-list)"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:variable name="new-property-names">
+                        <xsl:for-each select="$styles-node/style:style[@style:family=$style-family and @style:name=$current-style-name]/style:properties/@*">
+                            <xsl:value-of select="name()"/>
+                        </xsl:for-each>
+                    </xsl:variable>
+                    <!--** further attributes of the parent style must be collected **-->
+                    <xsl:call-template name="add-parent-style-attributes">
+                        <xsl:with-param name="property-name-list"       select="$new-property-names"/>
+                        <xsl:with-param name="complete-property-list"   select="normalize-space($new-property-list)"/>
+                        <xsl:with-param name="current-style-name"       select="$current-style-name"/>
+                        <xsl:with-param name="parent-style-name"        select="$parent-style-name"/>
+                        <xsl:with-param name="style-family"             select="$style-family"/>
+                    </xsl:call-template>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:element>
+    </xsl:template>
+
+
+
+    <xsl:template name="add-parent-style-attributes">
+        <xsl:param name="property-name-list"/>
+        <xsl:param name="complete-property-list"/>
+        <xsl:param name="current-style-name"/>
+        <xsl:param name="parent-style-name"/>
+        <xsl:param name="style-family"/>
+
+        <!--*** New two be added property names will be collected (only one variable per template) ***-->
+        <xsl:variable name="new-property-names">
+            <xsl:call-template name="get-new-style-names">
+                <xsl:with-param name="property-name-list"       select="$property-name-list"/>
+                <xsl:with-param name="parent-style-name"        select="$parent-style-name"/>
+                <xsl:with-param name="current-style-name"       select="$current-style-name"/>
+            </xsl:call-template>
+        </xsl:variable>
+
+        <xsl:choose>
+            <!--*** check if the new parent style exist in the office:automatic-styles section (defined by name and family) ***-->
+            <xsl:when test="$office:automatic-styles/style:style[@style:family='paragraph' and @style:name=$current-style-name]">
+                <!--*** RECURSION: adding new parent style attributes to the current style ***-->
+                <xsl:variable name="new-property-attributes">
+                    <xsl:call-template name="get-new-style-attributes">
+                        <xsl:with-param name="new-property-names"           select="$new-property-names"/>
+                        <xsl:with-param name="current-style-name"           select="$current-style-name"/>
+                        <xsl:with-param name="parent-style-name"            select="$parent-style-name"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <!--*** End CONDITION: the last style parent has already been executed ***-->
+                <xsl:variable name="new-parent-style-name"  select="$office:automatic-styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]/@style:parent-style-name"/>
+                <xsl:choose>
+                    <xsl:when test="string-length($new-parent-style-name)=0">
+                    <!--** no further parent is found, the given parameter property-node is the final style -->
+                        <xsl:value-of select="concat($complete-property-list,$new-property-attributes)"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                    <!--** further attributes of the parent style must be collected **-->
+                        <xsl:call-template name="add-parent-style-attributes">
+                            <xsl:with-param name="property-name-list"       select="concat($property-name-list, $new-property-names)"/>
+                            <xsl:with-param name="complete-property-list"   select="concat($complete-property-list,$new-property-attributes)"/>
+                            <xsl:with-param name="current-style-name"       select="$parent-style-name"/>
+                            <xsl:with-param name="parent-style-name"        select="$new-parent-style-name"/>
+                            <xsl:with-param name="style-family"             select="$style-family"/>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+
+            <!--** the specific style (defined by name and family) must be found in the office:styles section -->
+            <xsl:otherwise>
+                <!--*** RECURSION: adding new parent style attributes to the current style ***-->
+                <!--*** adding new parent style attributes to the current style ***-->
+                <xsl:variable name="new-property-attributes">
+                    <xsl:call-template name="get-new-style-attributes">
+                        <xsl:with-param name="new-property-names"           select="$new-property-names"/>
+                        <xsl:with-param name="current-style-name"           select="$current-style-name"/>
+                        <xsl:with-param name="parent-style-name"            select="$parent-style-name"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <!--*** End CONDITION: the last style parent has already been executed ***-->
+                <xsl:variable name="new-parent-style-name"  select="$office:styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]/@style:parent-style-name"/>
+                <xsl:choose>
+                    <xsl:when test="string-length($new-parent-style-name)=0">
+                    <!--** no further parent is found, the given parameter property-node is the final style -->
+                        <xsl:value-of select="concat($complete-property-list,$new-property-attributes)"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                    <!--** further attributes of the parent style must be collected **  -->
+                        <xsl:call-template name="add-parent-style-attributes">
+                            <xsl:with-param name="property-name-list"       select="concat($property-name-list, $new-property-names)"/>
+                            <xsl:with-param name="complete-property-list"   select="concat($complete-property-list,$new-property-attributes)"/>
+                            <xsl:with-param name="current-style-name"       select="$parent-style-name"/>
+                            <xsl:with-param name="parent-style-name"        select="$new-parent-style-name"/>
+                            <xsl:with-param name="style-family"             select="$style-family"/>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+
+    <xsl:template name="get-new-style-names">
+        <xsl:param name="property-name-list"/>
+        <xsl:param name="parent-style-name"/>
+        <xsl:param name="current-style-name"/>
+        <!--** where to find the specific style (defined by name and family) wheter in office:automatic-styles or office:styles section -->
+        <xsl:choose>
+            <!--** if the specific style (defined by name and family) can be found in the office:automatic-styles section -->
+            <xsl:when test="$office:automatic-styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]">
+                <xsl:variable name="parent-property-node" select="$office:automatic-styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]/style:properties"/>
+
+                <xsl:variable name="new-property-name-list">
+                    <xsl:for-each select="$parent-property-node/@*[not(contains($property-name-list, name()))]">
+                        <xsl:value-of select="name()"/>
+                    </xsl:for-each>
+                </xsl:variable>
+                <xsl:value-of select="$new-property-name-list"/>
+            </xsl:when>
+            <!--** the specific style (defined by name and family) should be found in the office:styles section -->
+            <xsl:otherwise>
+                <xsl:variable name="parent-property-node" select="$office:styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]/style:properties"/>
+                <xsl:variable name="new-property-name-list">
+                    <xsl:for-each select="$parent-property-node/@*[not(contains($property-name-list, name()))]">
+                        <xsl:value-of select="name()"/>
+                    </xsl:for-each>
+                </xsl:variable>
+                <xsl:value-of select="$new-property-name-list"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+
+    <xsl:template name="get-new-style-attributes">
+        <xsl:param name="new-property-names"/>
+        <xsl:param name="current-style-name"/>
+        <xsl:param name="parent-style-name"/>
+
+        <!--** where to find the specific style (defined by name and family) whether in office:automatic-styles or office:styles section -->
+        <xsl:choose>
+            <!--** if the specific style (defined by name and family) can be found in the office:automatic-styles section -->
+            <xsl:when test="$office:automatic-styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]">
+                <xsl:variable name="parent-property-node" select="$office:automatic-styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]/style:properties"/>
+                <xsl:variable name="new-property-name-list">
+                    <xsl:call-template name="write-style-properties">
+                        <xsl:with-param name="styleAttributePath"   select="$parent-property-node/@*[contains($new-property-names, name())]"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:value-of select="normalize-space($new-property-name-list)"/>
+            </xsl:when>
+            <!--** otherwise the specific style (defined by name and family) should be found in the office:styles section -->
+            <xsl:otherwise>
+                <xsl:variable name="parent-property-node" select="$office:styles/style:style[@style:family='paragraph' and @style:name=$parent-style-name]/style:properties"/>
+                <xsl:variable name="new-property-name-list">
+                    <xsl:call-template name="write-style-properties">
+                        <xsl:with-param name="styleAttributePath"   select="$parent-property-node/@*[contains($new-property-names, name())]"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:value-of select="normalize-space($new-property-name-list)"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/style_mapping.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/style_mapping.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/style_mapping.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/style_mapping.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,667 @@
+<!--
+
+   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:template name="write-style-properties">
+        <xsl:param name="styleAttributePath"/>
+
+        <xsl:choose>
+            <!--+++++ CSS PROPERTIES  +++++-->
+            <xsl:when test="$outputType = 'CSS_HEADER' or $outputType = 'CSS_INLINED'">
+
+                <xsl:for-each select="$styleAttributePath">
+                <!-- isDebugModeMESSAGE:
+                    <xsl:message> Name:<xsl:value-of select="name()"/> Value:<xsl:value-of select="."/></xsl:message>      -->
+
+
+                    <!-- <!ATTLIST style:properties style:horizontal-pos (from-left|left|center|right|from-inside|inside|outside)#IMPLIED>-->
+                    <!-- 2DO: is inside/from-inside also better showable ? -->
+                    <!-- !!!! 2DO: Still there have to be placed a <br clear='all'/> to disable the flow!!!!-->
+                    <!--           The OOo attribute 'style:number-wrapped-paragraphs' is currently ignored -->
+                    <xsl:choose>
+                        <xsl:when test='name(.)="style:wrap"'>
+                            <xsl:choose>
+                                <xsl:when test='.="left"'>
+                                    <xsl:text>float: right; </xsl:text>
+                                </xsl:when>
+                                <xsl:when test='.="right"'>
+                                    <xsl:text>float: left; </xsl:text>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:when>
+
+                        <xsl:when test='name(.) = "style:horizontal-pos"'>
+                            <xsl:choose>
+                                <xsl:when test='.="left"'>
+                                    <xsl:text>align: left; </xsl:text>
+                                </xsl:when>
+                                <xsl:when test='.="right"'>
+                                    <xsl:text>align: right; </xsl:text>
+                                </xsl:when>
+                                <xsl:when test='.="center"'>
+                                    <xsl:text>align: center; </xsl:text>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:when>
+<!-- results into a bad view (overlapped) in Mozilla 1.0
+                        <xsl:when test='name(.) = "table:align"'>
+                            <xsl:choose>
+                                <xsl:when test='.="left"'>
+                                    <xsl:text>float: right; </xsl:text>
+                                </xsl:when>
+                                <xsl:when test='.="right"'>
+                                    <xsl:text>float: left; </xsl:text>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:when>
+-->
+
+                        <!-- PADDING for all variations: fo:padding, fo:padding-top, fo:padding-bottom, fo:padding-left, fo:padding-right -->
+                        <xsl:when test='contains(name(.),"fo:padding")'>
+                            <xsl:text>padding: </xsl:text>
+                            <xsl:value-of select="."/>
+                            <xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <!--
+                        fo:border
+                        fo:border-top
+                        fo:border-bottom
+                        fo:border-left
+                        fo:border-right
+
+                            At present, all four borders must be set simultaneously by using either
+                            the fo:border property or by attaching all four of the other border
+                            properties to an item set element. In the latter case, if one or more
+                            of the properties is missing their values are assumed to be none. The
+                            only border styles supported are none or hidden, solid, and double. Any
+                            other border style specified is displayed as solid. Transparent borders
+                            are not supported and the border widths thin, medium, and thick are
+                            mapped to lengths. In addition, only some distinct border widths are
+                            supported. Unsupported widths are rounded up to the next supported
+                            width.
+                            If there are no padding properties specified within the same
+                            item set element, a default padding is used for sides that have a
+                            border. A value of 0cm is used for sides without a border.
+                            (cp. wd-so-xml-text.sdw)
+                        -->
+
+<!--2DO START: change measurement equally -->
+                        <xsl:when test='name(.)="fo:border"'>
+                            <xsl:choose>
+                                <!-- changing the distance measure: inch to in -->
+                                <xsl:when test="contains(., 'ch')">
+                                    <xsl:text>border-width:</xsl:text><xsl:value-of select="substring-before(.,'ch ')"/><xsl:text>; </xsl:text>
+                                    <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'ch '), ' ')"/><xsl:text>; </xsl:text>
+                                    <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'ch '), ' ')"/><xsl:text>; </xsl:text>
+                                </xsl:when>
+                                <xsl:when test="contains(., 'cm')">
+                                    <xsl:text>border-width:</xsl:text><xsl:value-of select="substring-before(.,' ')"/><xsl:text>; </xsl:text>
+                                    <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'cm '), ' ')"/><xsl:text>; </xsl:text>
+                                    <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'cm '), ' ')"/><xsl:text>; </xsl:text>
+                                </xsl:when>
+                                <xsl:when test="contains(., 'pt')">
+                                    <xsl:text>border-width:</xsl:text><xsl:value-of select="substring-before(.,' ')"/><xsl:text>; </xsl:text>
+                                    <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'pt '), ' ')"/><xsl:text>; </xsl:text>
+                                    <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'pt '), ' ')"/><xsl:text>; </xsl:text>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:border-top"'>
+                            <xsl:text>border-top: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:border-bottom"'>
+                            <xsl:text>border-bottom: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:border-left"'>
+                            <xsl:text>border-left: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:border-right"'>
+                            <xsl:text>border-right: </xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:column-width"'>
+                            <xsl:choose>
+                                <!-- changing the distance measure: inch to in -->
+                                <xsl:when test="contains(., 'ch')">
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>; </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:row-height"'>
+                            <xsl:choose>
+                                <!-- changing the distance measure: inch to in -->
+                                <xsl:when test="contains(., 'ch')">
+                                    <xsl:text>height:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>; </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>height:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:width"'>
+                            <xsl:choose>
+                                <!-- changing the distance measure: inch to in -->
+                                <xsl:when test="contains(., 'ch')">
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>; </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+<!--2DO END: change measurement equally -->
+                        <xsl:when test='name(.)="fo:font-style"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:font-name"'>
+                            <xsl:text>font-family:</xsl:text>
+                                <xsl:variable name="content" select="."/>
+                                <xsl:value-of select="$office:font-decls/style:font-decl[@style:name=$content]/@fo:font-family"/>
+                            <xsl:text>; </xsl:text>
+                            <xsl:if test="contains($office:font-decls/style:font-decl[@style:name=$content]/@style:font-style-name, 'Italic')">
+                                <xsl:text>font-style:italic; </xsl:text>
+                            </xsl:if>
+                            <xsl:if test="contains($office:font-decls/style:font-decl[@style:name=$content]/@style:font-style-name, 'Bold')">
+                                <xsl:text>font-weight:bold; </xsl:text>
+                            </xsl:if>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:font-weight"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:font-size"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:font-family"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:color"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:margin-left"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:margin-right"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:margin-top"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:margin-bottom"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:line-height"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:text-align"'>
+                            <!-- IMPORTANT is necessary as table cell value alignment is decided by runtime over the valuetype
+                                 Otherwise a table cell style-class will ALWAYS be overwritten by the run-time value -->
+                             <xsl:choose>
+                                <xsl:when test="contains(., 'start')">
+                                    <xsl:text>text-align:left ! important; </xsl:text>
+                                </xsl:when>
+                                <xsl:when test="contains(., 'end')">
+                                    <xsl:text>text-align:right ! important; </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>text-align:</xsl:text><xsl:value-of select='.'/><xsl:text> ! important; </xsl:text>
+                                </xsl:otherwise>
+                             </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:text-indent"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:text-background-color"'>
+                            <xsl:text>background-color:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="fo:background-color"'>
+                            <xsl:text>background-color:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:background-image"'>
+                            <xsl:text>background-image:url(</xsl:text><xsl:value-of select="@xlink:href"/><xsl:text>); </xsl:text>
+                            <xsl:choose>
+                                <xsl:when test="@style:repeat = 'repeat'">
+                                    <xsl:text>background-repeat:repeat; </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>background-repeat:no-repeat; </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
+                        <xsl:when test='name(.)="fo:text-shadow"'>
+                            <xsl:value-of select="substring-after(name(.), ':')"/><xsl:text>:</xsl:text><xsl:value-of select="."/><xsl:text>; </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:text-crossing-out"'>
+                            <xsl:if test='not(.="none")'>
+                                <xsl:text>text-decoration:line-through; </xsl:text>
+                            </xsl:if>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:text-underline"'>
+                            <xsl:if test='not(.="none")'>
+                                <xsl:text>text-decoration:underline; </xsl:text>
+                            </xsl:if>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:text-position"'>
+                            <xsl:if test='contains(., "sub")'>
+                                <xsl:text>vertical-align:sub; </xsl:text>
+                            </xsl:if>
+                            <xsl:if test='contains(., "sup")'>
+                                <xsl:text>vertical-align:sup; </xsl:text>
+                            </xsl:if>
+                        </xsl:when>
+                        <!-- isDebugModeMESSAGE:
+                        <xsl:otherwise>
+                                <xsl:message>No transformation implemented for attribute-typ <xsl:value-of select="name(.)"/></xsl:message>
+                        </xsl:otherwise>-->
+                    </xsl:choose>
+                </xsl:for-each>
+            </xsl:when>
+            <!--+++++ PALM 3.2 SUBSET AND WAP PROPERTIES  +++++-->
+            <xsl:otherwise>
+                <xsl:for-each select="$styleAttributePath">
+                    <!-- isDebugModeMESSAGE:
+                    <xsl:message> Name:<xsl:value-of select="name()"/> Value:<xsl:value-of select="."/></xsl:message>      -->
+
+                    <!-- BUG WORK AROUND:
+                    Due to a bug in the XT Processor, it is not possible to create serveral elements in variable and search over them,
+                    after explicit conversion to nodeset
+                    This generated sting identifier shall be later changed back to a set of elements
+                    -->
+                    <xsl:choose>
+                        <!--*** FORMAT ATTRIBUTES ***-->
+
+                        <!-- Italic -->
+                        <xsl:when test='name(.)="fo:font-style"'>
+                            <xsl:if test="contains(., 'italic') or contains(., 'oblique')">
+                                <xsl:text>italic, </xsl:text>
+                            </xsl:if>
+                        </xsl:when>
+
+                        <!-- Boldface -->
+                        <xsl:when test='name(.)="fo:font-weight"'>
+                            <xsl:if test="contains(., 'bold') or contains(., 'bolder')">
+                                <xsl:text>bold, </xsl:text>
+                            </xsl:if>
+                        </xsl:when>
+
+                        <!-- Underline -->
+                        <xsl:when test='name(.)="style:text-underline"'>
+                            <xsl:text>underline, </xsl:text>
+                        </xsl:when>
+
+                        <!-- Alignment -->
+                        <xsl:when test='name(.)="fo:text-align"'>
+                             <xsl:choose>
+                                <xsl:when test="contains(., 'start')">
+                                    <xsl:text>align:left, </xsl:text>
+                                </xsl:when>
+                                <xsl:when test="contains(., 'end')">
+                                    <xsl:text>align:right, </xsl:text>
+                                </xsl:when>
+                                <xsl:when test="contains(., 'center')">
+                                    <xsl:text>align:center, </xsl:text>
+                                </xsl:when>
+                             </xsl:choose>
+                        </xsl:when>
+
+                        <!-- strikethrough -->
+                        <xsl:when test='name(.)="style:text-crossing-out"'>
+                            <xsl:text>strike, </xsl:text>
+                        </xsl:when>
+
+                        <!-- Font - size (Palm: emulator transformed sizes to available set (e.g. 30 to (probably) 9)-->
+                        <xsl:when test='name(.)="fo:font-size"'>
+                            <xsl:text>size:</xsl:text><xsl:value-of select="."/><xsl:text>:size, </xsl:text>
+                        </xsl:when>
+
+                        <!-- Font - Color (PALM: but mostly only 2 available)
+                            black (#000000)
+                            gray (#808080)(rendered as dark gray)
+                            silver (#C0C0C0)(rendered as light gray)
+                            white (#FFFFFF)-->
+                        <xsl:when test='name(.)="fo:color"'>
+                            <xsl:choose>
+                                <xsl:when test="contains(. , '#FFFFFF') or contains(. , '#ffffff') or contains(. , 'white') or contains(. , 'WHITE')">
+                                    <xsl:text>color:#FFFFFF, </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>color:#000000, </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+
+
+                        <!--*** TABLE ATTRIBUTES ***-->
+                        <xsl:when test='name(.)="fo:font-size"'>
+                            <xsl:text>size:</xsl:text><xsl:value-of select="."/><xsl:text>:size, </xsl:text>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:column-width"'>
+                            <xsl:choose>
+                                <!-- changing the distance measure: inch to in -->
+                                <xsl:when test="contains(., 'ch')">
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>:width, </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>:width; </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:row-height"'>
+                            <xsl:choose>
+                                <!-- changing the distance measure: inch to in -->
+                                <xsl:when test="contains(., 'ch')">
+                                    <xsl:text>height:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>:height; </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>height:</xsl:text><xsl:value-of select="."/><xsl:text>:height; </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test='name(.)="style:width"'> <!--earlier fo:width-->
+                            <xsl:choose>
+                                <!-- changing the distance measure: inch to in -->
+                                <xsl:when test="contains(., 'ch')">
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="substring-before(.,'ch')"/><xsl:text>:width; </xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>width:</xsl:text><xsl:value-of select="."/><xsl:text>:width; </xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                    </xsl:choose>
+                </xsl:for-each>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+
+<!-- 2DO: NAMING CONVENTION variable are written with '-' instead of case-sensitive writing -->
+
+
+
+    <!-- ***** MEASUREMENT CONVERSIONS *****
+
+     * 1 centimeter = 10 mm
+
+     * 1 inch = 25.4 mm
+        While the English have already seen the light (read: the metric system), the US
+        remains loyal to this medieval system.
+
+     * 1 didot point = 0.376065 mm
+            The didot system originated in France but was used in most of Europe
+
+     * 1 pica point = 0.35146 mm
+            The Pica points system was developed in England and is used in Great-Britain and the US.
+
+     * 1 PostScript point = 0.35277138 mm
+            When Adobe created PostScript, they added their own system of points.
+            There are exactly 72 PostScript points in 1 inch.
+
+     * 1 pixel = 0.26458333.. mm   (by 96 dpi)
+            Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+    -->
+
+
+    <!-- changing measure to mm -->
+    <xsl:template name="convert2mm">
+        <xsl:param name="value"/>
+
+        <xsl:param name="centimeter-in-mm"          select="10"/>
+        <xsl:param name="inch-in-mm"                select="25.4"/>
+        <xsl:param name="didot-point-in-mm"         select="0.376065"/>
+        <xsl:param name="pica-point-in-mm"          select="0.35146"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round(number(substring-before($value,'cm' )) * $centimeter-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round(number(substring-before($value,'in' )) * $inch-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round(number(substring-before($value,'dpt')) * $didot-point-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'ppt')">
+                <xsl:value-of select="round(number(substring-before($value,'ppt')) * $pica-point-in-mm)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- changing measure to cm -->
+    <xsl:template name="convert2cm">
+        <xsl:param name="value"/>
+
+        <xsl:param name="centimeter-in-mm"          select="10"/>
+        <xsl:param name="inch-in-mm"                select="25.4"/>
+        <xsl:param name="didot-point-in-mm"         select="0.376065"/>
+        <xsl:param name="pica-point-in-mm"          select="0.35146"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round(number(substring-before($value, 'mm')) div $centimeter-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round(number(substring-before($value, 'in')) div $centimeter-in-mm * $inch-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round(number(substring-before($value,'dpt')) div $centimeter-in-mm * $didot-point-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'ppt')">
+                <xsl:value-of select="round(number(substring-before($value,'ppt')) div $centimeter-in-mm * $pica-point-in-mm)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <!-- changing measure to inch (cp. section comment) -->
+    <xsl:template name="convert2inch">
+        <xsl:param name="value"/>
+
+        <xsl:param name="centimeter-in-mm"          select="10"/>
+        <xsl:param name="inch-in-mm"                select="25.4"/>
+        <xsl:param name="didot-point-in-mm"         select="0.376065"/>
+        <xsl:param name="pica-point-in-mm"          select="0.35146"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round(number(substring-before($value, 'mm')) div $inch-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round(number(substring-before($value, 'cm')) div $inch-in-mm * $centimeter-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round(number(substring-before($value,'dpt')) div $inch-in-mm * $didot-point-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'ppt')">
+                <xsl:value-of select="round(number(substring-before($value,'ppt')) div $inch-in-mm * $pica-point-in-mm)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- changing measure to dpt (cp. section comment) -->
+    <xsl:template name="convert2dpt">
+        <xsl:param name="value"/>
+
+        <xsl:param name="centimeter-in-mm"          select="10"/>
+        <xsl:param name="inch-in-mm"                select="25.4"/>
+        <xsl:param name="didot-point-in-mm"         select="0.376065"/>
+        <xsl:param name="pica-point-in-mm"          select="0.35146"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round(number(substring-before($value, 'mm')) div $didot-point-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round(number(substring-before($value, 'cm')) div $didot-point-in-mm * $centimeter-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round(number(substring-before($value, 'in')) div $didot-point-in-mm * $inch-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'ppt')">
+                <xsl:value-of select="round(number(substring-before($value,'ppt')) div $didot-point-in-mm * $pica-point-in-mm)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+
+    </xsl:template>
+
+
+    <!-- changing measure to ppt (cp. section comment) -->
+    <xsl:template name="convert2ppt">
+        <xsl:param name="value"/>
+
+        <xsl:param name="centimeter-in-mm"          select="10"/>
+        <xsl:param name="inch-in-mm"                select="25.4"/>
+        <xsl:param name="didot-point-in-mm"         select="0.376065"/>
+        <xsl:param name="pica-point-in-mm"          select="0.35146"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pica-point-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pica-point-in-mm * $centimeter-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round(number(substring-before($value, 'in')) div $pica-point-in-mm * $inch-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round(number(substring-before($value,'dpt')) div $pica-point-in-mm * $didot-point-in-mm)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
+    <xsl:template name="convert2pixel">
+        <xsl:param name="value"/>
+
+        <xsl:param name="centimeter-in-mm"          select="10"/>
+        <xsl:param name="inch-in-mm"                select="25.4"/>
+        <xsl:param name="didot-point-in-mm"         select="0.376065"/>
+        <xsl:param name="pica-point-in-mm"          select="0.35146"/>
+        <xsl:param name="pixel-in-mm"               select="$inch-in-mm div $dpi"/>
+
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round(number(substring-before($value,'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/trunk/src/modules/opendocument/xslt/table.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/table.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/table.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/table.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,335 @@
+<!--
+
+   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">
+
+
+    <!-- table row handling -->
+    <xsl:include href="table_rows.xsl"/>
+    <!-- table column handling -->
+    <xsl:include href="table_columns.xsl"/>
+    <!-- table cell handling -->
+    <xsl:include href="table_cells.xsl"/>
+
+
+
+    <!-- ******************* -->
+    <!-- *** main table  *** -->
+    <!-- ******************* -->
+
+    <xsl:template match="table:table | table:sub-table">
+        <xsl:param name="collectedGlobalData"/>
+
+        <!-- a table will only be created if the "scenario" is active -->
+        <xsl:if test="string-length(table:scenario/@table:is-active) = 0">
+            <!-- collecting all visible "table:table-row" elements of the table -->
+            <xsl:variable name="allVisibleTableRows" select="table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]
+                    |    table:table-header-rows/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]
+                    |    table:table-row-group/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]"/>
+            <xsl:choose>
+                <!-- for all but WAP/WML devices a table border check is done (cp. "check-for-table-border") -->
+                <xsl:when test="not($outputType = 'WML')">
+
+                    <!-- As the alignment of a table is by 'align' attribut is deprecated and as the CSS 'float' attribute not well displayed,
+                         we do a little trick by encapsulating the table with a aligned 'div' element-->
+                    <xsl:variable name="table-alignment" select="$office:automatic-styles/style:style[@style:name = current()/@table:style-name]/style:properties/@table:align"/>
+
+                    <xsl:choose>
+                        <xsl:when test="string-length($table-alignment) != 0">
+                            <xsl:element name="div">
+                                <xsl:attribute name="align">
+                                    <xsl:choose>
+                                        <xsl:when test='$table-alignment="left" or $table-alignment="margins"'>
+                                                <xsl:text>left</xsl:text>
+                                        </xsl:when>
+                                        <xsl:when test='$table-alignment="right"'>
+                                            <xsl:text>right</xsl:text>
+                                        </xsl:when>
+                                        <xsl:when test='$table-alignment="center"'>
+                                            <xsl:text>center</xsl:text>
+                                        </xsl:when>
+                                    </xsl:choose>
+                                </xsl:attribute>
+                                <xsl:element name="table">
+
+                                    <xsl:apply-templates select="@table:style-name">
+                                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                                    </xsl:apply-templates>
+
+                                    <!-- workaround, set table border attribut if any cell-border exists
+                                    <xsl:call-template name="check-for-table-border">
+                                        <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows"/>
+                                    </xsl:call-template> -->
+                                    <xsl:call-template name="create-column-style-variable">
+                                        <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows"/>
+                                        <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                                    </xsl:call-template>
+                                </xsl:element>
+                            </xsl:element>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:element name="table">
+                                <xsl:apply-templates select="@table:style-name">
+                                    <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                                </xsl:apply-templates>
+
+                                <!-- workaround, set table border attribut if any cell-border exists
+                                <xsl:call-template name="check-for-table-border">
+                                    <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows"/>
+                                </xsl:call-template>  -->
+                                <xsl:call-template name="create-column-style-variable">
+                                    <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows"/>
+                                     <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+                                </xsl:call-template>
+                            </xsl:element>
+                        </xsl:otherwise>
+                    </xsl:choose>
+
+                </xsl:when>
+                <xsl:otherwise>
+                <!-- for WML devices only ASCII table are written as tables are not implemented widley.
+                     Beginning from 'repeat-write-row' the templates are handled by the table_wml.xsl stylesheet -->
+                    <xsl:call-template name="create-column-style-variable">
+                        <xsl:with-param name="collectedGlobalData"   select="$collectedGlobalData"/>
+                        <xsl:with-param name="allVisibleTableRows"  select="$allVisibleTableRows"/>
+                    </xsl:call-template>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:if>
+    </xsl:template>
+
+
+
+    <xsl:template name="create-column-style-variable">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="allVisibleTableRows"/>
+
+        <!-- all columns of the table -->
+        <xsl:variable name="allTableColumns" select="table:table-column |
+                                                     table:table-column-group/descendant::table:table-column |
+                                                     table:table-header-columns/descendant::table:table-column"/>
+        <!-- allColumnStyleEntries: Containing all columns of the table, hidden and viewed.
+            - if a column is hidden, it contains the hidden attribute, otherwise the style-properties will be stored
+            - if a column is being repeated, each repeated column is explicitly written as entry in this variable.
+              Later (during template "write-cell") the style of the column will be mixed with the cell-style by using
+              the position() of the column entry and comparing it with the iterating cell number. -->
+        <xsl:variable name="allColumnStyleEntries-RTF">
+            <xsl:call-template name="adding-column-styles-entries">
+                <xsl:with-param name="collectedGlobalData"   select="$collectedGlobalData"/>
+                <xsl:with-param name="allTableColumns"      select="$allTableColumns"/>
+            </xsl:call-template>
+        </xsl:variable>
+
+        <xsl:choose>
+            <xsl:when test="function-available('xt:node-set')">
+                <xsl:call-template name="create-table">
+                    <xsl:with-param name="collectedGlobalData"       select="$collectedGlobalData"/>
+                    <xsl:with-param name="allVisibleTableRows"      select="$allVisibleTableRows"/>
+                    <xsl:with-param name="allColumnStyleEntries"    select="xt:node-set($allColumnStyleEntries-RTF)"/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:when test="function-available('xalan:nodeset')">
+                <xsl:call-template name="create-table">
+                    <xsl:with-param name="collectedGlobalData"       select="$collectedGlobalData"/>
+                    <xsl:with-param name="allVisibleTableRows"      select="$allVisibleTableRows"/>
+                    <xsl:with-param name="allColumnStyleEntries"    select="xalan:nodeset($allColumnStyleEntries-RTF)"/>
+                </xsl:call-template>
+            </xsl:when>
+        </xsl:choose>
+
+    </xsl:template>
+
+
+
+    <xsl:template name="create-table">
+        <xsl:param name="collectedGlobalData"/>
+        <xsl:param name="allVisibleTableRows"/>
+        <xsl:param name="allColumnStyleEntries"/>
+
+
+        <!-- Some Office Calc documents simulate a background by repeating the last cell until end of space
+             (The value of "table:number-columns-repeated" is enourmous). Writing out all these cells would be fatal.
+             Therefore, this global variable shows us the longest row with content.
+
+        Earlier only the viewable columns were listed, but it is easier to handle with all columns:
+        <xsl:variable name="maxRowLength" select="count($allColumnStyleEntries/column-style-entry[not(@column-hidden-flag)])"/> -->
+        <xsl:variable name="maxRowLength" select="count($allColumnStyleEntries/column-style-entry)"/>
+
+
+        <!--isDebugMode-START-->
+        <xsl:if test="$isDebugMode">
+            <xsl:message>maxRowLength: <xsl:value-of select="$maxRowLength"/></xsl:message>
+            <xsl:variable name="numberOfHiddenColumns" select="count($allColumnStyleEntries/column-style-entry[@column-hidden-flag])"/>
+            <xsl:message>numberOfHiddenColumns: <xsl:value-of select="$numberOfHiddenColumns"/></xsl:message>
+            <xsl:call-template name="table-debug-allColumnStyleEntries">
+                <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+            </xsl:call-template>
+        </xsl:if>
+        <!--isDebugMode-END-->
+        <xsl:choose>
+            <xsl:when test="$outputType = 'WML'">
+                <!-- matching all rows - we can not use xsl:apply-template with a node-set parameter as by a bug in XT (James Clark)
+                     (here: allColumnStyleEntries) will be interpreted as a result tree fragment, where no search expression (XPath) can be used
+                     2DO:CHECK WITH XALAN-->
+                <xsl:for-each select="$allVisibleTableRows">
+                    <xsl:call-template name="wml-repeat-write-row">
+                        <xsl:with-param name="collectedGlobalData"       select="$collectedGlobalData"/>
+                        <xsl:with-param name="allColumnStyleEntries"    select="$allColumnStyleEntries"/>
+                        <xsl:with-param name="number-rows-repeated"     select="@table:number-rows-repeated"/>
+                        <xsl:with-param name="maxRowLength"             select="$maxRowLength"/>
+                    </xsl:call-template>
+                </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+                <!-- matching all rows - we can not use xsl:apply-template with a node-set parameter as by a bug in XT (James Clark)
+                     (here: allColumnStyleEntries) will be interpreted as a result tree fragment, where no search expression (XPath) can be used
+                     2DO:CHECK WITH XALAN -->
+                <xsl:for-each select="$allVisibleTableRows">
+                    <xsl:call-template name="repeat-write-row">
+                        <xsl:with-param name="collectedGlobalData"       select="$collectedGlobalData"/>
+                        <xsl:with-param name="allColumnStyleEntries"    select="$allColumnStyleEntries"/>
+                        <xsl:with-param name="number-rows-repeated"     select="@table:number-rows-repeated"/>
+                        <xsl:with-param name="maxRowLength"             select="$maxRowLength"/>
+                    </xsl:call-template>
+                </xsl:for-each>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+
+
+
+    <!-- **************************** -->
+    <!-- *** HELPER: table border *** -->
+    <!-- **************************** -->
+
+    <!-- only one table border for HTML4 or CSS devices which contain one or more 'fo:border-top' attributes (pars pro toto, if one exist the other usually exist, too) -->
+    <!-- this was a work-around for the netscape 4.xx but not longer necessary for Mozilla -->
+    <xsl:template name="check-for-table-border">
+        <xsl:param name="allVisibleTableRows"/>
+
+        <xsl:variable name="startTime">
+            <xsl:if test="$isDebugMode and not($isJavaDisabled)">
+                <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:if>
+        </xsl:variable>
+
+        <!-- checks if one cell (table:table-cell) of the rows of this table (allVisibleTableRows) contains a border style (i.e. fo:border-top)
+             If only one single border element exist, the whole table will gets pre-defined borders (simple heuristic for better browser display) -->
+        <xsl:if test="$allVisibleTableRows/table:table-cell[@table:style-name=/*/*/style:style[style:properties/@fo:border-top]/@style:name]">
+            <xsl:attribute name="border">1</xsl:attribute>
+            <xsl:attribute name="bordercolor">#000000</xsl:attribute>
+            <xsl:attribute name="cellpadding">2</xsl:attribute>
+            <xsl:attribute name="cellspacing">0</xsl:attribute>
+            <xsl:attribute name="page-break-inside">page-break-inside:avoid</xsl:attribute>
+        </xsl:if>
+
+
+        <!-- check the time for borderchecking (debug)-->
+        <xsl:if test="$isDebugMode and not($isJavaDisabled)">
+            <xsl:variable name="endTime">
+                <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:message>Time for checking BorderStyle: <xsl:value-of select="($endTime - $startTime)"/> ms</xsl:message>
+        </xsl:if>
+    </xsl:template>
+
+</xsl:stylesheet>



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