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 [5/5] - /lenya/trunk/src/modules/opendocument/xslt/
Added: lenya/trunk/src/modules/opendocument/xslt/table_cells.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/table_cells.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/table_cells.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/table_cells.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,491 @@
+<!--
+
+ 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">
+
+
+ <!-- *********************************** -->
+ <!-- *** write repeating table cells *** -->
+ <!-- *********************************** -->
+
+
+ <!-- matching cells to give out -> covered table cells are not written out -->
+ <xsl:template match="table:table-cell">
+ <xsl:param name="collectedGlobalData"/>
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="maxRowLength"/>
+
+ <xsl:if test="$isDebugMode">
+ <xsl:message>
+--------------> table:table-cell has been entered with node value: <xsl:value-of select="."/></xsl:message>
+ <xsl:message>table:number-columns-repeated: -<xsl:value-of select="@table:number-columns-repeated"/>-</xsl:message>
+ </xsl:if>
+
+ <xsl:call-template name="create-column-position-variable">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+
+ </xsl:template>
+
+
+
+ <xsl:template name="create-column-position-variable">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="maxRowLength"/>
+
+ <!-- column position needed for styles, esp. for column-hidden-flag -->
+ <xsl:variable name="preceding-columns">
+ <xsl:for-each select="preceding-sibling::*">
+ <xsl:element name="quantity">
+ <xsl:choose>
+ <xsl:when test="string-length(@table:number-columns-repeated) = 0">1</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@table:number-columns-repeated"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-table-cell">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ <xsl:with-param name="column-position" select="sum(xt:node-set($preceding-columns)/quantity) + 1"/>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-table-cell">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ <xsl:with-param name="column-position" select="sum(xalan:nodeset($preceding-columns)/quantity) + 1"/>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="NodeSetFunctionNotAvailable"/>
+ <xsl:call-template name="create-table-cell"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <xsl:template name="create-table-cell">
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="maxRowLength"/>
+ <xsl:param name="column-position"/>
+
+
+ <xsl:if test="$isDebugMode">
+ <xsl:message>NEW VALUE: column-position: -<xsl:value-of select="$column-position"/>-</xsl:message>
+ </xsl:if>
+
+
+ <!-- a hidden column will give out nothing -->
+ <xsl:if test="not($allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag)">
+ <xsl:choose>
+ <!-- when the columns are not repeated the next column-positions raises up to 1, otherwise up to the amount of repeated columns -->
+ <xsl:when test="@table:number-columns-repeated">
+ <!-- writes multiple entries of a cell -->
+ <xsl:call-template name="repeat-write-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="column-position" select="$column-position"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ <xsl:with-param name="number-columns-repeated" select="@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a cell -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="column-position" select="$column-position"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+
+ </xsl:template>
+
+
+
+ <xsl:template name="repeat-write-cell">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="column-position"/>
+ <xsl:param name="maxRowLength"/>
+ <xsl:param name="number-columns-repeated"/>
+
+ <xsl:choose>
+ <!-- 2DO: This is the current workaround against the background simulation by an 'endless' repeating cell -->
+ <xsl:when test="$number-columns-repeated > 1 and $maxRowLength > $column-position">
+
+ <xsl:if test="$isDebugMode">
+ <xsl:message>+++++++++ starting cell writing +++++++++</xsl:message>
+ <xsl:message>number-columns-repeated: -<xsl:value-of select="$number-columns-repeated"/>-</xsl:message>
+ <xsl:message>maxRowLength: -<xsl:value-of select="$maxRowLength"/>-</xsl:message>
+ <xsl:message>column-position: -<xsl:value-of select="$column-position"/>-</xsl:message>
+ </xsl:if>
+
+ <!-- writes an entry of a cell -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="column-position" select="$column-position"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:if test="$isDebugMode">
+ <xsl:message>+++++++++ cell repetition +++++++++</xsl:message>
+ </xsl:if>
+ <xsl:call-template name="repeat-write-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="column-position" select="$column-position + 1"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ <xsl:with-param name="number-columns-repeated" select="$number-columns-repeated - 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- 2DO: This is the current workaround against the background simulation by an 'endless' repeating cell -->
+ <!-- When the maxRowLength is reached a last entry of a cell is written -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="column-position" select="$column-position"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <xsl:template name="write-cell">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="column-position"/>
+ <xsl:param name="maxRowLength"/>
+
+
+ <xsl:if test="$isDebugMode">
+ <xsl:message>WriteTest -> If nothing between '-' write cell -<xsl:value-of select="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag"/>-</xsl:message>
+ </xsl:if>
+
+ <xsl:if test="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag">
+ <xsl:if test="$isDebugMode">
+ <xsl:message>TABLE COLUMN is hidden!</xsl:message>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:choose>
+ <!-- a hidden column will give out nothing -->
+ <xsl:when test="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@column-hidden-flag">
+ <xsl:if test="$isDebugMode">
+ <xsl:message>TABLE COLUMN is hidden!</xsl:message>
+ </xsl:if>
+ </xsl:when>
+
+ <!-- NOT a hidden column -->
+ <xsl:otherwise>
+
+ <!-- a table is a table header, when it has a "table:table-header-rows" ancestor -->
+ <xsl:variable name="tableDataType">
+ <xsl:choose>
+ <xsl:when test="ancestor::table:table-header-rows">
+ <xsl:text>th</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>td</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
+ <xsl:when test="$outputType = 'CSS_HEADER'">
+ <xsl:element name="{$tableDataType}">
+
+ <xsl:if test="$isDebugMode">
+ <xsl:message>
+*****************************************'<xsl:value-of select="$tableDataType"/>' element has been added!</xsl:message>
+ </xsl:if>
+
+ <xsl:if test="@table:number-columns-spanned">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="@table:number-columns-spanned"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-rows-spanned">
+ <xsl:attribute name="rowspan">
+ <xsl:value-of select="@table:number-rows-spanned"/>
+ </xsl:attribute>
+ </xsl:if>
+
+
+
+ <!-- *** the cell-style *** -->
+ <!-- The cell style has no conclusion with the column style, so we switch the order/priorities due to browser issues
+
+ The cell-style depends on two attributes:
+
+ 1) table:style-name - the style properties of cell. When they exist, a default alignement (cp. below) will be added for the
+ case of no alignment in the style exist.
+
+ 2) table:value-type - the value type of the table-cell giving the default alignments.
+ By default a string value is left aligned, all other are aligned:right.
+ -->
+ <xsl:choose>
+ <xsl:when test="@table:style-name">
+ <xsl:attribute name="style">
+
+ <!-- CELL-STYLE: alignment by table:value-type (without existing table:style-name)-->
+ <xsl:variable name="cellStyle" select="$collectedGlobalData/allstyles/*[name()=current()/@table:style-name]"/>
+ <xsl:choose>
+ <xsl:when test="string-length($cellStyle) > 0 and not(contains($cellStyle, 'text-align'))">
+ <!-- CELL-STYLE: alignment by table:value-type -->
+ <!-- no alignment in the cell style, the alignment based on the table:value-type will be added -->
+ <xsl:choose>
+ <xsl:when test="@table:value-type and not(@table:value-type = 'string')">
+ <xsl:value-of select="concat($collectedGlobalData/allstyles/*[name()=current()/@table:style-name], 'text-align:right; ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($collectedGlobalData/allstyles/*[name()=current()/@table:style-name], 'text-align:left; ')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- CELL-STYLE: alignment by table:value-type -->
+ <!-- no CSS style properties exist, only alignment from the table:value-type will be used -->
+ <xsl:choose>
+ <xsl:when test="@table:value-type and not(@table:value-type = 'string')">text-align:right; </xsl:when>
+ <xsl:otherwise>text-align:left; </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- column-style (disjunct of cell style -->
+ <!-- 2DO: only absolut styles are supported, relative styles (i.e. 'style:rel-column-width' e.g. with value "8933*" are ignored.
+ Issue: browsers (not sure if CSS) does not support the '*' relationship, only the '%', where the sum is always '100'!
+ For this, it is easier to work on with the absolute values, instead of calculating the values for 100% -->
+ <xsl:value-of select="$allColumnStyleEntries/column-style-entry[position()=$column-position]"/>
+ </xsl:attribute>
+ <!-- CELL-STYLE: table:style-name -->
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@table:style-name, '. %()/\', '')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style">
+ <!-- CELL-STYLE: alignment by table:value-type (without existing table:style-name)-->
+ <!-- no table:style-name exist, only alignment from the table:value-type will be used -->
+ <xsl:choose>
+ <xsl:when test="@table:value-type and not(@table:value-type = 'string')">
+ text-align:right;
+ </xsl:when>
+ <xsl:otherwise>
+ text-align:left;
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <!-- In case of no cell content a non-breakable space will be inserted
+ to make the browser show the table-cell grid -->
+ <xsl:when test="not(child::text()) and not(child::*)">
+ <xsl:text>  </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- *** the column-style *** -->
+ <!-- the column style has no conclusion with the cell style, so we switch the order/priorities due to browser issues-->
+ <xsl:element name="span">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$allColumnStyleEntries/column-style-entry[position() = $column-position]/@style-name"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+
+ <!--+++++ HTML 4.0 INLINED WAY +++++-->
+ <xsl:when test="$outputType = 'CSS_INLINED'">
+ <xsl:element name="{$tableDataType}">
+
+ <xsl:if test="@table:number-columns-spanned">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="@table:number-columns-spanned"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-rows-spanned">
+ <xsl:attribute name="rowspan">
+ <xsl:value-of select="@table:number-rows-spanned"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:attribute name="style">
+ <!-- cell-style -->
+ <xsl:value-of select="$collectedGlobalData/allstyles/*[name()=current()/@table:style-name]"/>
+ <!-- column-style -->
+ <xsl:value-of select="$allColumnStyleEntries/column-style-entry[position()=$column-position]"/>
+ <!-- TABLE:VALUE-TYPE - the value of a table-cell will be aligned left by default only exlicit non-string is aligned:right-->
+ <xsl:choose>
+ <xsl:when test="@table:value-type and not(@table:value-type = 'string')">
+ <xsl:text>text-align:right;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:left;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <!--   is a non-breakable space, necessary to make to the browser show the table-cell grid -->
+ <xsl:if test="not(child::text()) and not(child::*)">  </xsl:if>
+ <xsl:apply-templates>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <!--+++++ PALM INLINED WAY +++++-->
+ <xsl:when test="$outputType = 'PALM'">
+ <xsl:element name="{$tableDataType}">
+ <xsl:if test="@table:number-columns-spanned">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="@table:number-columns-spanned"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="@table:number-rows-spanned">
+ <xsl:attribute name="rowspan">
+ <xsl:value-of select="@table:number-rows-spanned"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <!--+++++ WML WAY +++++-->
+ <xsl:when test="$outputType = 'WML'">
+ <xsl:choose>
+ <xsl:when test="not($allColumnStyleEntries/column-style-entry[last() = $column-position])">
+ <xsl:apply-templates>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:apply-templates>
+ <xsl:text>, </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:apply-templates>
+ <xsl:text>; </xsl:text>
+ <xsl:element name="br"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
Added: lenya/trunk/src/modules/opendocument/xslt/table_columns.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/table_columns.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/table_columns.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/table_columns.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,222 @@
+<!--
+
+ 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">
+
+
+ <!-- ******************************************** -->
+ <!-- *** Create table columns style variable *** -->
+ <!-- ******************************************** -->
+
+ <xsl:template name="adding-column-styles-entries">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allTableColumns"/>
+
+ <xsl:for-each select="$allTableColumns">
+
+ <xsl:variable name="column-style-entry" select="$collectedGlobalData/allstyles/*[name() = translate(current()/@table:style-name, '. %()/\', '')]"/>
+ <xsl:choose>
+ <xsl:when test="not(@table:number-columns-repeated)">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:call-template name="adding-column-style-entry">
+ <xsl:with-param name="column-style-entry" select="$column-style-entry"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- No higher repetition of cells greater than 4 for the last and second last column -->
+ <!-- a hack for the sample document 'Waehrungsumrechner.sxc having 230 repeated columns in the second last column -->
+ <!-- ??? <xsl:when test="(position() = last() or (position() = (last() - 1)) and @table:number-columns-repeated < 5)"> ???-->
+ <xsl:when test="position() = last() or position() = (last() - 1)">
+ <xsl:if test="@table:number-columns-repeated < 5">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:call-template name="repeat-adding-column-style-entry">
+ <xsl:with-param name="column-style-entry" select="$column-style-entry"/>
+ <xsl:with-param name="number-columns-repeated" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- repeated colums will be written explicit several times in the variable-->
+ <xsl:call-template name="repeat-adding-column-style-entry">
+ <xsl:with-param name="column-style-entry" select="$column-style-entry"/>
+ <xsl:with-param name="number-columns-repeated" select="@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+
+ <!-- WRITES THE REPEATED COLUMN STYLE EXPLICIT AS AN ELEMENT IN THE COLUMNS-VARIABLE -->
+ <xsl:template name="repeat-adding-column-style-entry">
+ <xsl:param name="column-style-entry"/>
+ <xsl:param name="number-columns-repeated"/>
+
+ <xsl:choose>
+ <xsl:when test="$number-columns-repeated > 1">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:call-template name="adding-column-style-entry">
+ <xsl:with-param name="column-style-entry" select="$column-style-entry"/>
+ </xsl:call-template>
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:call-template name="repeat-adding-column-style-entry">
+ <xsl:with-param name="column-style-entry" select="$column-style-entry"/>
+ <xsl:with-param name="number-columns-repeated" select="$number-columns-repeated - 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:call-template name="adding-column-style-entry">
+ <xsl:with-param name="column-style-entry" select="$column-style-entry"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- THE COLUMN-STYLE WRITE-PATTERN FOR EACH COLUMN WRITTEN IN A VARIABLE -->
+ <xsl:template name="adding-column-style-entry">
+ <xsl:param name="column-style-entry"/>
+
+ <xsl:element name="column-style-entry">
+ <xsl:choose>
+ <xsl:when test="@table:visibility = 'collapse' or @table:visibility = 'filter'">
+ <xsl:attribute name="column-hidden-flag">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="table:style-name" select="translate(@table:style-name, '. %()/\', '')"/>
+ <xsl:attribute name="style-name"><xsl:value-of select="$table:style-name"/></xsl:attribute>
+ <xsl:value-of select="$column-style-entry"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+
+
+ <!--isDebugMode-START-->
+ <!-- giving out the 'allColumnStyle' variable:
+ For each 'column-style-entry' of the 'allColumnStyleEntries' variable the style-name is given out.
+ In case of 'column-hidden-flag' attribute the text 'Column is hidden is given out.-->
+ <xsl:template name="table-debug-allColumnStyleEntries">
+ <xsl:param name="allColumnStyleEntries"/>
+
+ <!-- debug output as table summary attribut in html -->
+ <xsl:attribute name="summary">
+ <xsl:call-template name="table-debug-column-out">
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- debug output to console -->
+ <xsl:message>
+ <xsl:call-template name="table-debug-column-out">
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ </xsl:call-template>
+ </xsl:message>
+ </xsl:template>
+
+
+ <xsl:template name="table-debug-column-out">
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:text>
+ DebugInformation: For each 'column-style-entry' of the 'allColumnStyleEntries' variable the style-name is given out.
+ In case of 'column-hidden-flag' attribute the text 'column is hidden' is given out.
+ </xsl:text>
+ <xsl:for-each select="$allColumnStyleEntries/column-style-entry">
+ <xsl:choose>
+ <xsl:when test="@column-hidden-flag">
+ <xsl:text> </xsl:text><xsl:value-of select="@style-name"/><xsl:text>column is hidden</xsl:text><xsl:text>
+ </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text><xsl:value-of select="@style-name"/><xsl:text> = </xsl:text><xsl:value-of select="."/><xsl:text>
+ </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <!--isDebugMode-END-->
+
+</xsl:stylesheet>
Added: lenya/trunk/src/modules/opendocument/xslt/table_rows.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/table_rows.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/table_rows.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/table_rows.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,184 @@
+<!--
+
+ 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">
+
+
+
+ <!-- ********************************************* -->
+ <!-- *** write (explicit) repeating table rows *** -->
+ <!-- ********************************************* -->
+
+ <xsl:template name="repeat-write-row">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="number-rows-repeated" select="1"/>
+ <xsl:param name="maxRowLength"/>
+
+ <xsl:choose>
+ <!-- write an entry of a row and repeat calling this method until all elements are written out -->
+ <xsl:when test="$number-rows-repeated > 1 and (table:table-cell/text() or table:table-cell/*)">
+ <xsl:call-template name="write-row">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+
+ <!-- 2DO: take variable from the output of repeated write-row and iterate giving out the variable -->
+ <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="maxRowLength" select="$maxRowLength"/>
+ <xsl:with-param name="number-rows-repeated" select="$number-rows-repeated - 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- write a single entry of a row -->
+ <xsl:otherwise>
+ <xsl:call-template name="write-row">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <xsl:template name="write-row">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="maxRowLength"/>
+
+
+ <xsl:element name="tr">
+ <!-- writing the style of the row -->
+ <xsl:call-template name='add-style-properties'>
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ </xsl:call-template>
+
+ <xsl:if test="$isDebugMode">
+ <xsl:message>
+*************************'tr' element has been added!</xsl:message>
+ </xsl:if>
+
+ <xsl:apply-templates select="table:table-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:apply-templates>
+
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- **************************** -->
+ <!-- *** HELPER: table styles *** -->
+ <!-- **************************** -->
+
+ <xsl:template name="add-style-properties">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="node-position"/>
+
+ <xsl:choose>
+ <!--+++++ CSS (CASCADING STLYE SHEET) HEADER STYLE WAY +++++-->
+ <xsl:when test="$outputType = 'CSS_HEADER'">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@table:style-name, '. %()/\', '')"/>
+ </xsl:attribute>
+ </xsl:when>
+
+ <!--+++++ HTML 4.0 INLINED WAY +++++-->
+ <xsl:when test="$outputType = 'CSS_INLINED'">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$collectedGlobalData/allstyles/*[name()=current()/@table:style-name]"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
Added: lenya/trunk/src/modules/opendocument/xslt/table_wml.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/table_wml.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/table_wml.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/table_wml.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,170 @@
+<!--
+
+ 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">
+
+
+
+ <!-- *********************************** -->
+ <!-- *** build WML / WAP ASCII TABLE *** -->
+ <!-- *********************************** -->
+
+
+ <!-- templates from table.xsl has been dublicated for wml
+ instead a condition-check for every cell -->
+
+
+ <!-- ********************************************* -->
+ <!-- *** write (explicit) repeating table rows *** -->
+ <!-- ********************************************* -->
+
+ <xsl:template name="wml-repeat-write-row">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="number-rows-repeated" select="1"/>
+ <xsl:param name="maxRowLength"/>
+
+ <!-- soffice bug workaround for not showing empty cell repeated multiple times [not(child::*)]-->
+ <xsl:if test="not(table:table-cell[last()=1])">
+ <xsl:choose>
+ <!-- write an entry of a row and repeat calling this method until all elements are written out -->
+ <xsl:when test="$number-rows-repeated > 1 and (table:table-cell/text() or table:table-cell/*)">
+ <xsl:call-template name="wml-write-row">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+
+ <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="maxRowLength" select="$maxRowLength"/>
+ <xsl:with-param name="number-rows-repeated" select="$number-rows-repeated - 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- write an entry of a row -->
+ <xsl:otherwise>
+ <xsl:call-template name="wml-write-row">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+
+
+ <xsl:template name="wml-write-row">
+ <xsl:param name="collectedGlobalData"/>
+ <xsl:param name="allColumnStyleEntries"/>
+ <xsl:param name="maxRowLength"/>
+
+ <xsl:choose>
+ <xsl:when test="ancestor::*[contains($wap-paragraph-elements-without-table-row, name())]">
+ <!-- the first cell of the row, as a row has only cells <!ELEMENT table:table-row %table-cells;> -->
+ <xsl:apply-templates select="table:table-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="p">
+ <!-- the first cell of the row, as a row has only cells <!ELEMENT table:table-row %table-cells;> -->
+ <xsl:apply-templates select="table:table-cell">
+ <xsl:with-param name="collectedGlobalData" select="$collectedGlobalData"/>
+ <xsl:with-param name="allColumnStyleEntries" select="$allColumnStyleEntries"/>
+ <xsl:with-param name="maxRowLength" select="$maxRowLength"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+</xsl:stylesheet>
+
Added: lenya/trunk/src/modules/opendocument/xslt/unalogrss.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/unalogrss.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/unalogrss.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/unalogrss.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:cinclude="http://apache.org/cocoon/include/1.0">
+
+<!-- unalog.xsl: copy input XML stream and set up cinclude directive
+ @author <a href="http://librarycog.uwindsor.ca">art rhyno</a>
+-->
+
+
+<xsl:template match="/">
+ <retrieval-results>
+ <xsl:apply-templates/>
+<!--
+ <unalog>
+ <cinclude:include src="http://unalog.com/xbel"/>
+ </unalog>
+-->
+ <unalog>
+ <cinclude:include src="http://unalog.com/rss"/>
+ </unalog>
+ </retrieval-results>
+</xsl:template>
+
+
+<xsl:template match="node() | @*">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()"/>
+ </xsl:copy>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
Added: lenya/trunk/src/modules/opendocument/xslt/unalogrss2.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/unalogrss2.xsl?rev=328589&view=auto
==============================================================================
--- lenya/trunk/src/modules/opendocument/xslt/unalogrss2.xsl (added)
+++ lenya/trunk/src/modules/opendocument/xslt/unalogrss2.xsl Wed Oct 26 01:30:13 2005
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:purl="http://purl.org/rss/1.0/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:cinclude="http://apache.org/cocoon/include/1.0">
+
+<!--
+ unalog2.xsl: write out XML stream and change Unalog folder content
+ @author <a href="http://librarycog.uwindsor.ca">art rhyno</a>
+-->
+
+<xsl:template match="/">
+
+<xsl:text disable-output-escaping="yes">
+ <![CDATA[
+<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://pyxml.sourceforge.net/topics/dtds/xbel-1.0.dtd">
+ ]]>
+</xsl:text>
+ <xbel version="1.0">
+ <xsl:apply-templates select="*/xbel/*"/>
+ </xbel>
+</xsl:template>
+
+
+<xsl:template match="node() | @*">
+
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()"/>
+ </xsl:copy>
+
+</xsl:template>
+
+<!-- Pull in info from unalog -->
+<!-- some trouble with XBEL for some reason -->
+<!--
+<xsl:template match="folder[contains(.,'Unalog Bookmarks')]">
+ <folder>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ <xsl:attribute name="folded">
+ <xsl:value-of select="@folded"/>
+ </xsl:attribute>
+ <xsl:copy-of select="/retrieval-results/unalog/xbel/*"/>
+ </folder>
+</xsl:template>
+-->
+
+<!-- Pull in info from unalog RSS feed -->
+<xsl:template match="folder[contains(.,'Unalog Bookmarks')]">
+ <folder>
+ <title>Unalog Bookmarks</title>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ <xsl:attribute name="folded">
+ <xsl:value-of select="@folded"/>
+ </xsl:attribute>
+ <!-- get each entry, also eliminate duplicates
+ and merge comments -->
+ <xsl:for-each select="/retrieval-results/unalog/rdf:RDF/
+ purl:item[not(@rdf:about=following::purl:item/@rdf:about)]">
+ <bookmark>
+ <xsl:variable name="theHref">
+ <xsl:choose>
+ <xsl:when test="string-length(@rdf:about) > 0">
+ <xsl:value-of select="@rdf:about"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>http://unalog.com</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:attribute name="href">
+ <xsl:value-of select="$theHref"/>
+ </xsl:attribute>
+ <xsl:attribute name="visited">
+ <xsl:value-of select="dc:date"/>
+ </xsl:attribute>
+ <title>
+ <xsl:value-of select="purl:title"/>
+ </title>
+ <info>
+ <xsl:attribute name="owner">
+ <xsl:value-of select="dc:contributor"/>
+ </xsl:attribute>
+ </info>
+ <desc>
+ <xsl:for-each select="/retrieval-results/unalog/rdf:RDF/
+ purl:item[@rdf:about=$theHref]">
+ <xsl:text>From: </xsl:text>
+ <xsl:value-of select="dc:contributor"/>
+ <xsl:if test="string-length(purl:description) > 0">
+ <xsl:text>- </xsl:text>
+ <xsl:value-of select="purl:description"/>
+ </xsl:if>
+ <xsl:if test="position() < last()">
+ <xsl:text>/ </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </desc>
+ </bookmark>
+ </xsl:for-each>
+ </folder>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org