summaryrefslogtreecommitdiff
path: root/filter/source/xslt
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/xslt')
-rw-r--r--filter/source/xslt/common/copy.xsl9
-rw-r--r--filter/source/xslt/common/math.xsl593
-rw-r--r--filter/source/xslt/common/measure_conversion.xsl391
-rw-r--r--filter/source/xslt/export/common/ooo2ms_docpr.xsl141
-rw-r--r--filter/source/xslt/export/spreadsheetml/formular.xsl644
-rw-r--r--filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl243
-rw-r--r--filter/source/xslt/export/spreadsheetml/style_mapping.xsl394
-rw-r--r--filter/source/xslt/export/spreadsheetml/styles.xsl699
-rw-r--r--filter/source/xslt/export/spreadsheetml/table.xsl941
-rw-r--r--filter/source/xslt/export/uof/odf2uof_presentation.xsl3375
-rw-r--r--filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl6194
-rw-r--r--filter/source/xslt/export/uof/odf2uof_text.xsl4445
-rw-r--r--filter/source/xslt/export/wiki/mediawiki.ottbin0 -> 6304 bytes
-rwxr-xr-xfilter/source/xslt/export/wiki/odt2mediawiki.xsl1567
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml.xsl222
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_border.xsl157
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl288
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_draw.xsl1889
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_field.xsl737
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_list.xsl344
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_page.xsl405
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_path.xsl862
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_settings.xsl316
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_table.xsl420
-rw-r--r--filter/source/xslt/export/wordml/ooo2wordml_text.xsl1283
-rw-r--r--filter/source/xslt/import/common/ms2ooo_docpr.xsl105
-rw-r--r--filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl8962
-rw-r--r--filter/source/xslt/import/uof/uof2odf_presentation.xsl3478
-rw-r--r--filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl9054
-rw-r--r--filter/source/xslt/import/uof/uof2odf_text.xsl4650
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo.xsl352
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl288
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_draw.xsl2217
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_field.xsl1591
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_list.xsl661
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_page.xsl391
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_path.xsl1822
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_props.xsl107
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_settings.xsl73
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_table.xsl1290
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_text.xsl1062
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/body.xsl426
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl832
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl359
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table.xsl168
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl283
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl247
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl216
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl558
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/body.xsl2841
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/header.xsl488
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl187
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/table.xsl226
53 files changed, 69493 insertions, 0 deletions
diff --git a/filter/source/xslt/common/copy.xsl b/filter/source/xslt/common/copy.xsl
new file mode 100644
index 000000000000..a608e2cc6925
--- /dev/null
+++ b/filter/source/xslt/common/copy.xsl
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="xml" encoding="UTF-8"/>
+
+ <xsl:template match="/">
+ <xsl:copy-of select="."/>
+ </xsl:template>
+</xsl:stylesheet>
+
diff --git a/filter/source/xslt/common/math.xsl b/filter/source/xslt/common/math.xsl
new file mode 100644
index 000000000000..166e715d5d96
--- /dev/null
+++ b/filter/source/xslt/common/math.xsl
@@ -0,0 +1,593 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: math.xsl,v $
+
+ $Revision: 1.8 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ -->
+<!--
+ xslt math lib by Wind Li
+Public Functions
+ sin(x,rounding-factor=100)
+ cos(x,rounding-factor=100)
+ tan(x,rounding-factor=100)
+ ctan(x,rounding-factor=100)
+ atan2(x, y ,rounding-factor=100)
+ atan(x,rounding-factor=100)
+ acos(x,rounding-factor=100)
+ asin(x,rounding-factor=100)
+ abs(x)
+ max(x1,x2)
+ min(x1,x2)
+ power(x,power(interger only), rounding-factor=100)
+ sqrt(x, rounding-factor=100)
+ convert2radian(x,rounding-factor=100)
+ convert2degree(x,rounding-factor=100)
+ convert2fd(x,rounding-factor=100)
+ -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:text="http://openoffice.org/2000/text" xmlns:style="http://openoffice.org/2000/style" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:office="http://openoffice.org/2000/office" exclude-result-prefixes="draw svg style office fo text">
+ <xsl:variable name="pi" select="3.1416"/>
+ <xsl:template name="math-test">
+ sin(34.8)
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="34.8"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ cos(34.8)
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="34.8"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ atan(2.74)
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select="2.74"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ acos(0.5)
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="0.5"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ asin(0.5)
+ <xsl:call-template name="asin">
+ <xsl:with-param name="x" select="0.5"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ sqrt(1328.3414)
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="1328.3414"/>
+ <xsl:with-param name="rounding-factor" select="100000"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!-- public functions start -->
+ <xsl:template name="sin">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="angle" select="$x * 180 div $pi "/>
+ <xsl:variable name="mod-angle" select="$angle mod 360"/>
+ <xsl:variable name="sinx">
+ <xsl:call-template name="sin-private">
+ <xsl:with-param name="x" select=" ( $angle mod 360 ) * $pi div 180 "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round ( number($sinx) * $rounding-factor ) div $rounding-factor"/>
+ </xsl:template>
+ <xsl:template name="cos">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="angle" select="$x * 180 div $pi "/>
+ <xsl:variable name="mod-angle" select="$angle mod 360"/>
+ <xsl:variable name="cosx">
+ <xsl:call-template name="cos-private">
+ <xsl:with-param name="x" select=" ( $angle mod 360 ) * $pi div 180 "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round ( number($cosx) * $rounding-factor ) div $rounding-factor"/>
+ </xsl:template>
+ <xsl:template name="tan">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="sinx">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cosx">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test=" $cosx = 0 ">
+ <xsl:message>tan error : tan(<xsl:value-of select="$x"/>) is infinite!</xsl:message>
+ <xsl:value-of select="63535"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" round( $sinx div $cosx * $rounding-factor) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="ctan">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="sinx">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cosx">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor * 10"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test=" $sinx = 0 ">
+ <xsl:message>tan error : tan(<xsl:value-of select="$x"/>) is infinite!</xsl:message>
+ <xsl:value-of select="63535"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" round( $cosx div $sinx * $rounding-factor) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="atan">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="$x = 0">
+ <xsl:value-of select="0"/>
+ </xsl:when>
+ <xsl:when test="$x &lt; 0">
+ <xsl:variable name="atan-x">
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select=" -1 * $x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="-1 * $atan-x"/>
+ </xsl:when>
+ <xsl:when test="$x &gt; 1">
+ <xsl:variable name="atan-div-x">
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select="1 div $x "/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" $pi div 2 - $atan-div-x"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="arctanx">
+ <xsl:call-template name="atan-private">
+ <xsl:with-param name="x" select=" $x "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round ( number($arctanx) * $rounding-factor ) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="atan2">
+ <xsl:param name="x"/>
+ <xsl:param name="y"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="$x = 0">
+ <xsl:value-of select=" $pi div 2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="atan">
+ <xsl:with-param name="x" select="$y div $x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="acos">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="abs-x">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$abs-x &gt; 1">
+ <xsl:message>acos error : abs(<xsl:value-of select="$x"/>) greate then 1 !</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="atan2">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="y">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="1 - $x * $x"/>
+ <xsl:with-param name="rounding-factor" select=" concat($rounding-factor,'0') "/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="asin">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="abs-x">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$abs-x &gt; 1">
+ <xsl:message>asin error : abs(<xsl:value-of select="$x"/>) greate then 1 !</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="atan2">
+ <xsl:with-param name="y" select="$x"/>
+ <xsl:with-param name="x">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="1 - $x * $x"/>
+ <xsl:with-param name="rounding-factor" select=" concat($rounding-factor,'0') "/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="abs">
+ <xsl:param name="x"/>
+ <xsl:choose>
+ <xsl:when test="$x &gt; 0">
+ <xsl:value-of select="$x"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$x * -1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="max">
+ <xsl:param name="x1"/>
+ <xsl:param name="x2"/>
+ <xsl:choose>
+ <xsl:when test="$x1 &gt; $x2">
+ <xsl:value-of select="$x1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$x2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="min">
+ <xsl:param name="x1"/>
+ <xsl:param name="x2"/>
+ <xsl:choose>
+ <xsl:when test="$x1 &lt; $x2">
+ <xsl:value-of select="$x1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$x2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="power">
+ <xsl:param name="x"/>
+ <xsl:param name="y" select="1"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <!-- z is a private param -->
+ <xsl:param name="z" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$y &gt; 0">
+ <xsl:call-template name="power">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="y" select="$y - 1"/>
+ <xsl:with-param name="z" select="$z * $x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" round( $z * $rounding-factor) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="sqrt">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="$x = 0">0</xsl:when>
+ <xsl:when test="$x &lt; 0">
+ <xsl:message>sqrt error : <xsl:value-of select="$x"/> less then 0!</xsl:message>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="sqrt-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="rounding-factor" select="$rounding-factor"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- public functions end -->
+ <!--
+Private functions:
+sin-private
+cos-private
+atan-private
+sqrt-private
+integer-sqrt
+Sqrt-GetOneDigit
+-->
+ <xsl:template name="sin-private">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="n" select="0"/>
+ <xsl:param name="nx" select="1"/>
+ <xsl:param name="sign" select="1"/>
+ <xsl:param name="max-n" select="20"/>
+ <xsl:param name="sinx" select="0"/>
+ <xsl:choose>
+ <xsl:when test="not ($max-n &gt; $n) or $nx = 0 ">
+ <xsl:value-of select="$sinx"/>
+ </xsl:when>
+ <xsl:when test="$n = 0">
+ <xsl:call-template name="sin-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select="$x "/>
+ <xsl:with-param name="sinx" select="$sinx + $x"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-nx" select="($nx * $x * $x) div ( 2 * $n ) div ( 2 * $n + 1) "/>
+ <xsl:call-template name="sin-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" $new-nx "/>
+ <xsl:with-param name="sinx" select="$sinx + $new-nx * $sign"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="cos-private">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="n" select="0"/>
+ <xsl:param name="nx" select="1"/>
+ <xsl:param name="sign" select="1"/>
+ <xsl:param name="max-n" select="20"/>
+ <xsl:param name="cosx" select="0"/>
+ <xsl:choose>
+ <xsl:when test="not ($max-n &gt; $n) or $nx = 0 ">
+ <xsl:value-of select="$cosx"/>
+ </xsl:when>
+ <xsl:when test="$n = 0">
+ <xsl:call-template name="cos-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" 1 "/>
+ <xsl:with-param name="cosx" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-nx" select="($nx * $x * $x) div ( 2 * $n -1 ) div ( 2 * $n ) "/>
+ <xsl:call-template name="cos-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" $new-nx "/>
+ <xsl:with-param name="cosx" select="$cosx + $new-nx * $sign"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="atan-private">
+ <xsl:param name="x" select="0"/>
+ <xsl:param name="n" select="0"/>
+ <xsl:param name="nx" select="1"/>
+ <xsl:param name="sign" select="1"/>
+ <xsl:param name="max-n" select="40"/>
+ <xsl:param name="arctanx" select="0"/>
+ <xsl:choose>
+ <xsl:when test="not ($max-n &gt; $n) or $nx = 0 ">
+ <xsl:value-of select="$arctanx"/>
+ </xsl:when>
+ <xsl:when test="$n = 0">
+ <xsl:call-template name="atan-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select="$x "/>
+ <xsl:with-param name="arctanx" select="$arctanx + $x"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-nx" select=" $nx * $x * $x "/>
+ <xsl:call-template name="atan-private">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="sign" select="$sign * -1"/>
+ <xsl:with-param name="max-n" select="$max-n"/>
+ <xsl:with-param name="nx" select=" $new-nx "/>
+ <xsl:with-param name="arctanx" select="$arctanx + $new-nx div (2 * $n +1) * $sign"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="sqrt-private">
+ <xsl:param name="x"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:variable name="shift" select="string-length( $rounding-factor)"/>
+ <xsl:variable name="power">
+ <xsl:call-template name="power">
+ <xsl:with-param name="x" select="100"/>
+ <xsl:with-param name="y" select="$shift"/>
+ <xsl:with-param name="rounding-factor" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="integer-x" select=" round( $power * $x )"/>
+ <xsl:variable name="integer-quotient">
+ <xsl:call-template name="integer-sqrt">
+ <xsl:with-param name="x" select="$integer-x"/>
+ <xsl:with-param name="length" select=" string-length( $integer-x ) "/>
+ <xsl:with-param name="curr-pos" select=" 2 - (round (string-length( $integer-x ) div 2 ) * 2 - string-length( $integer-x ) ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="power-10">
+ <xsl:call-template name="power">
+ <xsl:with-param name="x" select="10"/>
+ <xsl:with-param name="y" select="$shift - 1"/>
+ <xsl:with-param name="rounding-factor" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select=" round( $integer-quotient div 10) div $power-10 "/>
+ </xsl:template>
+ <xsl:template name="integer-sqrt">
+ <xsl:param name="x"/>
+ <xsl:param name="length"/>
+ <xsl:param name="curr-pos"/>
+ <xsl:param name="last-quotient" select="0"/>
+ <xsl:choose>
+ <xsl:when test="$curr-pos &gt; $length">
+ <xsl:value-of select="$last-quotient"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-x" select="substring( $x, 1, $curr-pos )"/>
+ <xsl:variable name="new-quotient">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$curr-x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="5"/>
+ <xsl:with-param name="direct" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="integer-sqrt">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="length" select="$length"/>
+ <xsl:with-param name="curr-pos" select="$curr-pos + 2"/>
+ <xsl:with-param name="last-quotient" select="number($new-quotient)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-one-sqrt-digit">
+ <xsl:param name="x"/>
+ <xsl:param name="last-quotient"/>
+ <xsl:param name="n"/>
+ <xsl:param name="direct" select="1"/>
+ <xsl:variable name="quotient" select=" concat( $last-quotient, $n) "/>
+ <xsl:variable name="accumulate" select="$quotient * $quotient "/>
+ <xsl:choose>
+ <xsl:when test="$accumulate = $x">
+ <xsl:value-of select="concat($last-quotient , $n )"/>
+ </xsl:when>
+ <xsl:when test="$direct = 0 and $accumulate &lt; $x">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="$n + 1"/>
+ <xsl:with-param name="direct" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$direct = 0 and $accumulate &gt; $x">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="$n - 1"/>
+ <xsl:with-param name="direct" select="-1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" $accumulate * $direct &lt; $x * $direct ">
+ <xsl:call-template name="get-one-sqrt-digit">
+ <xsl:with-param name="x" select="$x"/>
+ <xsl:with-param name="last-quotient" select="$last-quotient"/>
+ <xsl:with-param name="n" select="$n+ $direct"/>
+ <xsl:with-param name="direct" select="$direct"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not($n &lt; 9) or $n = -1">
+ <xsl:value-of select="concat($last-quotient , $n - $direct) "/>
+ </xsl:when>
+ <xsl:when test="$direct = 1">
+ <xsl:value-of select="concat($last-quotient , $n - 1) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last-quotient , $n) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2redian">
+ <xsl:param name="x" select="'0'"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="contains($x,'deg')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'deg') div 180 * $pi)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($x,'fd')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'fd') div 180 div 65536 * $pi)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round($rounding-factor * number($x) div 180 * $pi) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2degree">
+ <xsl:param name="x" select="'0'"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="contains($x,'deg')">
+ <xsl:value-of select="round($rounding-factor * substring-before($x,'deg')) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($x,'fd')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'fd')) div 65536 ) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round($rounding-factor * number($x) * 180 div $pi) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2fd">
+ <xsl:param name="x" select="'0'"/>
+ <xsl:param name="rounding-factor" select="100"/>
+ <xsl:choose>
+ <xsl:when test="contains($x,'deg')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'deg') * 65535)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($x,'fd')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($x, 'fd'))) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round($rounding-factor * number($x) * 180 div $pi * 65535) div $rounding-factor"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/common/measure_conversion.xsl b/filter/source/xslt/common/measure_conversion.xsl
new file mode 100644
index 000000000000..8de5fa1ac034
--- /dev/null
+++ b/filter/source/xslt/common/measure_conversion.xsl
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: measure_conversion.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <!-- DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')
+ Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
+ <xsl:param name="dpi" select="111"/>
+ <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-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to twip (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <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="convert2px">
+ <xsl:param name="value"/>
+ <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, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-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:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/common/ooo2ms_docpr.xsl b/filter/source/xslt/export/common/ooo2ms_docpr.xsl
new file mode 100644
index 000000000000..d90c11297817
--- /dev/null
+++ b/filter/source/xslt/export/common/ooo2ms_docpr.xsl
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2ms_docpr.xsl,v $
+
+ $Revision: 1.10 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template match="office:meta">
+ <o:DocumentProperties>
+ <o:Title>
+ <xsl:value-of select="dc:title"/>
+ </o:Title>
+ <o:Subject>
+ <xsl:value-of select="dc:subject"/>
+ </o:Subject>
+ <o:Keywords>
+ <xsl:for-each select="meta:keywords/meta:keyword">
+ <xsl:value-of select="."/>
+ <xsl:if test="position()!=last()">, </xsl:if>
+ </xsl:for-each>
+ </o:Keywords>
+ <o:Description>
+ <xsl:value-of select="dc:description"/>
+ </o:Description>
+ <o:Category>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'Category']"/>
+ </o:Category>
+ <o:Author>
+ <xsl:value-of select="meta:initial-creator"/>
+ </o:Author>
+ <o:LastAuthor>
+ <xsl:value-of select="dc:creator"/>
+ </o:LastAuthor>
+ <o:Manager>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'Manager']"/>
+ </o:Manager>
+ <o:Company>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'Company']"/>
+ </o:Company>
+ <o:HyperlinkBase>
+ <xsl:value-of select="meta:user-defined[@meta:name = 'HyperlinkBase']"/>
+ </o:HyperlinkBase>
+ <o:Revision>
+ <xsl:value-of select="meta:editing-cycles"/>
+ </o:Revision>
+ <!-- PresentationFormat, Guid, AppName, Version -->
+ <o:TotalTime>
+ <xsl:if test="meta:editing-duration">
+ <xsl:variable name="hours">
+ <xsl:choose>
+ <xsl:when test="contains(meta:editing-duration, 'H')">
+ <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'H')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="minutes">
+ <xsl:choose>
+ <xsl:when test="contains(meta:editing-duration, 'M') and contains(meta:editing-duration, 'H')">
+ <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'H'), 'M')"/>
+ </xsl:when>
+ <xsl:when test="contains(meta:editing-duration, 'M')">
+ <xsl:value-of select="substring-before( substring-after( meta:editing-duration, 'PT'), 'M')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$hours * 60 + $minutes"/>
+ </xsl:if>
+ </o:TotalTime>
+ <o:LastPrinted>
+ <xsl:if test="meta:print-date">
+ <xsl:value-of select="concat( meta:print-date, 'Z')"/>
+ </xsl:if>
+ </o:LastPrinted>
+ <o:Created>
+ <xsl:if test="meta:creation-date">
+ <xsl:value-of select="concat( meta:creation-date, 'Z')"/>
+ </xsl:if>
+ </o:Created>
+ <o:LastSaved>
+ <xsl:if test="dc:date">
+ <xsl:value-of select="concat( dc:date, 'Z')"/>
+ </xsl:if>
+ </o:LastSaved>
+ <o:Pages>
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </o:Pages>
+ <o:Words>
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </o:Words>
+ <o:Characters>
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </o:Characters>
+ <!-- CharactersWithSpaces, Bytes, Lines -->
+ <o:Paragraphs>
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </o:Paragraphs>
+ </o:DocumentProperties>
+ <o:CustomDocumentProperties>
+ <o:Editor dt:dt="string">
+ <xsl:value-of select="meta:generator"/>
+ </o:Editor>
+ <o:Language dt:dt="string">
+ <xsl:value-of select="dc:language"/>
+ </o:Language>
+ <xsl:for-each select="meta:user-defined">
+ <!-- transfer strings to XML QName, necessary to convert several characters -->
+ <xsl:element name="{concat( 'o:', translate(@meta:name,'.,| ~`!@#$%^&amp;&lt;&gt;*()+=[]{};:&quot;/\?','_'))}">
+ <xsl:attribute name="dt:dt">string</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:for-each>
+ </o:CustomDocumentProperties>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/formular.xsl b/filter/source/xslt/export/spreadsheetml/formular.xsl
new file mode 100644
index 000000000000..859ef29c2e99
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/formular.xsl
@@ -0,0 +1,644 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: formular.xsl,v $
+
+ $Revision: 1.5 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+
+ <!-- Mapping @table:formula to @ss:Formula translating the expression syntax -->
+ <xsl:template match="@table:formula">
+ <xsl:param name="calculatedCellPosition" />
+ <xsl:param name="calculatedRowPosition" />
+
+ <xsl:attribute name="ss:Formula">
+ <xsl:call-template name="translate-formular-expression">
+ <xsl:with-param name="rowPos" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnPos" select="$calculatedCellPosition" />
+ <xsl:with-param name="expression" select="." />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <!-- Translate OOOC formula expressions of table cells to spreadsheetml expression
+
+ For example:
+ "oooc:=ROUNDDOWN(123.321;2)"
+ to "=ROUNDDOWN(123.321,2)"
+ "oooc:=([.B2]-[.C2])"
+ to "=(RC[-2]-RC[-1])"
+ "oooc:=DCOUNTA([.E14:.F21];[.F14];[.H14:.I15])"
+ to "=DCOUNTA(R[-17]C[3]:R[-10]C[4],R[-17]C[4],R[-17]C[6]:R[-16]C[7])" -->
+ <xsl:template name="translate-formular-expression">
+ <!-- return position or range for formula or other -->
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical) of cell -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <xsl:param name="expression" /> <!-- the expression string to be converted -->
+
+ <xsl:choose>
+ <xsl:when test="$expression != ''">
+ <xsl:choose>
+ <!-- OASIS Open Document XML formular expressions -->
+ <xsl:when test="starts-with($expression,'oooc:')">
+ <!-- giving out the '=', which will be removed with 'oooc:=' to enable recursive string parsing -->
+ <xsl:text>=</xsl:text>
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <!-- 1) remove 'oooc:=' prefix and exchange ';' with ',' -->
+ <xsl:with-param name="expression" select="translate(substring($expression,7),';',',')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expression" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expression" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- As the function API of our Office and MS Office show differences in the argumentlists,
+ - sometimes the last parameter have to be neglected
+ - sometimes a default have to be added
+ these exchanges have to be done as well -->
+ <xsl:template name="function-parameter-mapping">
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <xsl:param name="expression" /> <!-- expression to be exchanged -->
+
+ <!-- Choose if the expression contains one of the function, which might need changes -->
+ <xsl:choose>
+ <!-- if not contain one of the functions, which need parameter mapping -->
+ <xsl:when test="not(contains($expression, 'ADDRESS(') or
+ contains($expression, 'CEILING(') or
+ contains($expression, 'FLOOR(') or
+ contains($expression, 'IF(') or
+ contains($expression, 'ROUND('))">
+ <!-- simply translate possily exisiting column & row references -->
+ <xsl:call-template name="translate-oooc-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$expression"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- functions to be mapped -->
+ <xsl:otherwise>
+ <xsl:variable name="functionPrefix" select="substring-before($expression, '(')" />
+ <xsl:variable name="expressionSuffix" select="substring-after($expression, '(')" />
+
+ <!-- translate in case the expression contains row/cell references aside of the function name -->
+ <xsl:call-template name="translate-oooc-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$functionPrefix"/>
+ </xsl:call-template>
+ <!-- Prefix do not include the bracket -->
+ <xsl:text>(</xsl:text>
+ <xsl:choose>
+ <xsl:when test="not(contains($functionPrefix, 'ADDRESS') or
+ contains($functionPrefix, 'CEILING') or
+ contains($functionPrefix, 'FLOOR') or
+ (contains($functionPrefix, 'IF') and not(
+ contains($functionPrefix, 'COUNTIF') or
+ contains($functionPrefix, 'SUMIF'))) or
+ contains($functionPrefix, 'ROUND'))">
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains($functionPrefix, 'ADDRESS')">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterRemoval" select="4" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($functionPrefix, 'CEILING') or
+ contains($functionPrefix, 'FLOOR')">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterRemoval" select="3" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($functionPrefix, 'IF')">
+ <xsl:if test="not(contains($functionPrefix, 'COUNTIF') or
+ contains($functionPrefix, 'SUMIF'))">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterAddition" select="'true'" />
+ <xsl:with-param name="additonAfterLastParameter" select="2" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="contains($functionPrefix, 'ROUND')">
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ <xsl:with-param name="parameterAddition" select="'null'" />
+ <xsl:with-param name="additonAfterLastParameter" select="1" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Each parameter of the argumentlist have to be determined.
+ Due to the low level string functionlity in XSLT it becomes a clumsy task -->
+ <xsl:template name="find-parameters">
+ <!-- used for mapping of row/column reference -->
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <!-- used for mapping of parameter -->
+ <xsl:param name="parameterRemoval" />
+ <xsl:param name="parameterAddition" />
+ <xsl:param name="additonAfterLastParameter" />
+ <!-- used as helper to find a parameter -->
+ <xsl:param name="expressionSuffix" />
+ <xsl:param name="parameterNumber" select="1" />
+
+ <xsl:variable name="parameter">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <!-- if it is not the last parameter -->
+ <xsl:when test="starts-with(substring-after($expressionSuffix, $parameter), ',')">
+ <!-- searches the argument for functions to be mapped -->
+ <xsl:if test="not($parameterRemoval = $parameterNumber)">
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression">
+ <xsl:choose>
+ <!-- in case a character will be removed the preceding won't make a comma -->
+ <xsl:when test="$parameterRemoval = ($parameterNumber + 1)">
+ <xsl:value-of select="$parameter" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($parameter, ',')" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- searches for the next parameter -->
+ <xsl:call-template name="find-parameters">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expressionSuffix" select="substring-after(substring-after($expressionSuffix, $parameter),',')"/>
+ <xsl:with-param name="parameterAddition" select="$parameterAddition" />
+ <xsl:with-param name="parameterRemoval" select="$parameterRemoval" />
+ <xsl:with-param name="additonAfterLastParameter" select="$additonAfterLastParameter" />
+ <xsl:with-param name="parameterNumber" select="$parameterNumber + 1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- the last parameter -->
+ <xsl:choose>
+ <xsl:when test="$parameterRemoval = $parameterNumber">
+ <!-- searches the rest of the expression for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($expressionSuffix, $parameter)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$parameterAddition and ($parameterNumber = $additonAfterLastParameter)">
+ <!-- searches the rest of the expression for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$parameter" />
+ </xsl:call-template>
+ <!-- searches last parameter and additional parameters for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <!-- for the final parameter the latter substring is the ')' -->
+ <xsl:with-param name="expression" select="concat(',', $parameterAddition, substring-after($expressionSuffix, $parameter))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- searches the argument for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="$parameter" />
+ </xsl:call-template>
+ <!-- searches the rest of the expression for functions to be mapped -->
+ <xsl:call-template name="function-parameter-mapping">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($expressionSuffix, $parameter)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="getParameter">
+ <xsl:param name="closingBracketCount" select="0" />
+ <xsl:param name="openingBracketCount" select="0" />
+ <xsl:param name="expressionSuffix" />
+ <xsl:param name="parameterCandidate">
+ <xsl:choose>
+ <!-- if there are multiple parameter -->
+ <xsl:when test="contains(substring-before($expressionSuffix, ')'), ',')">
+ <xsl:value-of select="substring-before($expressionSuffix, ',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($expressionSuffix, ')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:param name="earlierCandidate" select="$parameterCandidate" />
+
+ <xsl:choose>
+ <xsl:when test="contains($parameterCandidate, '(') or contains($parameterCandidate, ')')">
+ <xsl:choose>
+ <!-- contains only closing bracket(s) -->
+ <xsl:when test="contains($parameterCandidate, '(') and not(contains($parameterCandidate, ')'))">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount + 1" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, '(')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- contains only opening bracket(s) -->
+ <xsl:when test="not(contains($parameterCandidate, '(')) and contains($parameterCandidate, ')')">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount + 1" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, ')')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="string-length(substring-before($parameterCandidate, '(')) &lt;
+ string-length(substring-before($parameterCandidate, ')'))">
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount + 1" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, '(')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount" />
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount + 1" />
+ <xsl:with-param name="parameterCandidate" select="substring-after($parameterCandidate, ')')" />
+ <xsl:with-param name="earlierCandidate" select="$earlierCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$openingBracketCount = $closingBracketCount">
+ <xsl:value-of select="$earlierCandidate" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierCandidate" />
+ <xsl:variable name="parameterCandidate">
+ <xsl:variable name="formularAfterCandidate" select="substring-after($expressionSuffix, $earlierCandidate)" />
+ <xsl:variable name="parameterTillBracket" select="concat(substring-before($formularAfterCandidate,')'),')')" />
+ <xsl:variable name="parameterTillComma" select="substring-before(substring-after($expressionSuffix, $parameterTillBracket),',')" />
+ <xsl:choose>
+ <xsl:when test="string-length($parameterTillComma) &gt; 0 and
+ not(contains($parameterTillComma, '('))">
+ <xsl:choose>
+ <xsl:when test="starts-with($formularAfterCandidate, ',')">
+ <xsl:value-of select="concat(',',substring-before(substring-after($formularAfterCandidate,','),','))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($formularAfterCandidate,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$parameterTillBracket"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="getParameter">
+ <xsl:with-param name="closingBracketCount" select="$closingBracketCount" />
+ <xsl:with-param name="openingBracketCount" select="$openingBracketCount" />
+ <xsl:with-param name="parameterCandidate" select="$parameterCandidate" />
+ <xsl:with-param name="earlierCandidate" select="$parameterCandidate" />
+ <xsl:with-param name="expressionSuffix" select="$expressionSuffix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Mapping table-cell definitions by exchangomg all table cell definitions:
+ a) a pair of cells e.g. "[.E14:.F21]" to "R[-17]C[3]:R[-10]C[4]"
+ b) a single cell e.g. "[.F14]" to "R[-17]"-->
+ <xsl:template name="translate-oooc-expression">
+ <xsl:param name="rowPos" /> <!-- the position in row (vertical of cell) -->
+ <xsl:param name="columnPos" /> <!-- the position in column (horizontal of cell) -->
+ <xsl:param name="expression" /> <!-- expression to be exchanged -->
+
+ <xsl:choose>
+ <xsl:when test="contains($expression, '[')">
+
+ <!-- Giving out the part before '[.' -->
+ <xsl:value-of select="substring-before($expression, '[')" />
+
+ <!-- Mapping cell definitions
+ 1) a pair of cells e.g. "[.E14:.F21]" to "R[-17]C[3]:R[-10]C[4]"
+ 2) a single cell e.g. "[.F14]" to "R[-17]"-->
+ <xsl:variable name="remainingExpression" select="substring-after($expression, '[')"/>
+ <xsl:choose>
+ <xsl:when test="contains(substring-before($remainingExpression, ']'), ':')">
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-before($remainingExpression, ':')" />
+ </xsl:call-template>
+ <xsl:value-of select="':'" />
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after(substring-before($remainingExpression, ']'), ':')" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-before($remainingExpression, ']')" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="translate-oooc-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($remainingExpression,']')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Giving out the remaining part -->
+ <xsl:value-of select="$expression" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- A cell expression has usually starts with a '.' otherwise it references to a sheet -->
+ <xsl:template name="translate-cell-expression">
+ <xsl:param name="rowPos" /> <!-- the vertical position of the current cell -->
+ <xsl:param name="columnPos" /> <!-- the horizontal position of the current cell -->
+ <xsl:param name="targetRowPos" select="0"/> <!-- the vertical position of the target cell -->
+ <xsl:param name="targetColumnPos" select="0"/> <!-- the horizontal position of the target cell -->
+ <xsl:param name="charPos" select="0"/> <!-- current column position (needed for multiplying) -->
+ <xsl:param name="digitPos" select="0"/> <!-- current row position (needed for multiplying) -->
+ <xsl:param name="expression" /> <!-- expression to be parsed by character -->
+ <xsl:param name="isRow" select="true()"/> <!-- the string (e.g. $D39 is parsed character per character from the back,
+ first the row, later the column is parsed -->
+
+ <xsl:choose>
+ <xsl:when test="starts-with($expression, '.')">
+ <xsl:variable name="expLength" select="string-length($expression)" />
+ <xsl:choose>
+ <!-- parsing from the end, till only the '.' remains -->
+ <xsl:when test="$expLength != 1">
+ <xsl:variable name="token" select="substring($expression, $expLength)" />
+ <xsl:choose>
+ <xsl:when test="$token='0' or $token='1' or $token='2' or $token='3' or $token='4' or $token='5' or $token='6' or $token='7' or $token='8' or $token='9'">
+ <xsl:variable name="multiplier">
+ <xsl:call-template name="calculate-square-numbers">
+ <xsl:with-param name="base" select="10" />
+ <xsl:with-param name="exponent" select="$digitPos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="targetColumnPos" select="$targetColumnPos" />
+ <xsl:with-param name="targetRowPos" select="$targetRowPos + $multiplier * $token" />
+ <xsl:with-param name="digitPos" select="$digitPos + 1" />
+ <xsl:with-param name="charPos" select="$charPos" />
+ <!-- removing the last character-->
+ <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" />
+ <xsl:with-param name="isRow" select="true()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$token = '$'">
+ <xsl:choose>
+ <!-- if this is the first '$' after '.' (column-->
+ <xsl:when test="$expLength = 2">
+ <xsl:text>C</xsl:text><xsl:value-of select="$targetColumnPos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>R</xsl:text><xsl:value-of select="$targetRowPos"/>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="targetColumnPos" select="$targetColumnPos" />
+ <xsl:with-param name="targetRowPos" select="$targetRowPos" />
+ <xsl:with-param name="charPos" select="$charPos" />
+ <!-- removing the last character-->
+ <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" />
+ <xsl:with-param name="isRow" select="false()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- in case of a letter -->
+ <xsl:otherwise>
+ <xsl:if test="$isRow">
+ <xsl:text>R</xsl:text>
+ <xsl:if test="$targetRowPos != $rowPos">
+ <xsl:text>[</xsl:text><xsl:value-of select="$targetRowPos - $rowPos"/><xsl:text>]</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ <xsl:variable name="multiplier">
+ <xsl:call-template name="calculate-square-numbers">
+ <xsl:with-param name="base" select="26" />
+ <xsl:with-param name="exponent" select="$charPos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="tokenNumber">
+ <xsl:call-template name="character-to-number">
+ <xsl:with-param name="character" select="$token" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="targetColumnPos" select="$targetColumnPos + $multiplier * $tokenNumber" />
+ <xsl:with-param name="targetRowPos" select="$targetRowPos" />
+ <xsl:with-param name="digitPos" select="$digitPos" />
+ <xsl:with-param name="charPos" select="$charPos + 1" />
+ <!-- removing the last character-->
+ <xsl:with-param name="expression" select="substring($expression, 1, $expLength - 1)" />
+ <xsl:with-param name="isRow" select="false()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>C</xsl:text>
+ <xsl:if test="$targetColumnPos != $columnPos">
+ <xsl:text>[</xsl:text><xsl:value-of select="$targetColumnPos - $columnPos"/><xsl:text>]</xsl:text>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="sheetName" select="substring-before($expression, '.')" />
+ <xsl:value-of select="$sheetName"/><xsl:text>!</xsl:text>
+ <xsl:call-template name="translate-cell-expression">
+ <xsl:with-param name="rowPos" select="$rowPos" />
+ <xsl:with-param name="columnPos" select="$columnPos" />
+ <xsl:with-param name="expression" select="substring-after($expression, $sheetName)" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="calculate-square-numbers">
+ <xsl:param name="base" />
+ <xsl:param name="exponent" />
+ <xsl:param name="return" select="1" />
+
+ <xsl:choose>
+ <xsl:when test="$exponent > '1'">
+ <xsl:call-template name="calculate-square-numbers">
+ <xsl:with-param name="base" select="$base" />
+ <xsl:with-param name="exponent" select="$exponent - 1"/>
+ <xsl:with-param name="return" select="$return * $base" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$exponent = '1'">
+ <xsl:value-of select="$return * $base"/>
+ </xsl:when>
+ <!-- if exponent is equal '0' -->
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="character-to-number">
+ <xsl:param name="character" />
+ <xsl:choose>
+ <xsl:when test="$character = 'A'">1</xsl:when>
+ <xsl:when test="$character = 'B'">2</xsl:when>
+ <xsl:when test="$character = 'C'">3</xsl:when>
+ <xsl:when test="$character = 'D'">4</xsl:when>
+ <xsl:when test="$character = 'E'">5</xsl:when>
+ <xsl:when test="$character = 'F'">6</xsl:when>
+ <xsl:when test="$character = 'G'">7</xsl:when>
+ <xsl:when test="$character = 'H'">8</xsl:when>
+ <xsl:when test="$character = 'I'">9</xsl:when>
+ <xsl:when test="$character = 'J'">10</xsl:when>
+ <xsl:when test="$character = 'K'">11</xsl:when>
+ <xsl:when test="$character = 'L'">12</xsl:when>
+ <xsl:when test="$character = 'M'">13</xsl:when>
+ <xsl:when test="$character = 'N'">14</xsl:when>
+ <xsl:when test="$character = 'O'">15</xsl:when>
+ <xsl:when test="$character = 'P'">16</xsl:when>
+ <xsl:when test="$character = 'Q'">17</xsl:when>
+ <xsl:when test="$character = 'R'">18</xsl:when>
+ <xsl:when test="$character = 'S'">19</xsl:when>
+ <xsl:when test="$character = 'T'">20</xsl:when>
+ <xsl:when test="$character = 'U'">21</xsl:when>
+ <xsl:when test="$character = 'V'">22</xsl:when>
+ <xsl:when test="$character = 'W'">23</xsl:when>
+ <xsl:when test="$character = 'X'">24</xsl:when>
+ <xsl:when test="$character = 'Y'">25</xsl:when>
+ <xsl:when test="$character = 'Z'">26</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl b/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl
new file mode 100644
index 000000000000..e91fff273245
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/ooo2spreadsheetml.xsl
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2spreadsheetml.xsl,v $
+
+ $Revision: 1.6 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink">
+
+
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+
+ <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
+ <xsl:import href="../../common/measure_conversion.xsl" />
+
+ <!-- excel table handling -->
+ <xsl:include href="table.xsl" />
+
+ <!-- mapping rules of office style properties to Excel style properties -->
+ <xsl:include href="style_mapping.xsl" />
+
+ <!-- creating the Excel styles element -->
+ <xsl:include href="styles.xsl" />
+
+ <!-- mapping formalar Expressions -->
+ <xsl:include href="formular.xsl" />
+
+ <xsl:output method = "xml"
+ indent = "no"
+ encoding = "UTF-8"
+ omit-xml-declaration = "no" />
+
+ <xsl:strip-space elements="ss:Data html:Data" />
+
+
+ <!-- common table handling -->
+ <xsl:variable name="namespace" select="'urn:schemas-microsoft-com:office:spreadsheet'" />
+
+ <!--+++++ PARAMETER SECTION +++++-->
+
+ <!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a (relative) URL to the target directory.
+ Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
+ <xsl:param name="targetBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
+ To access contents of a office file (content like the meta.xml, styles.xml file or graphics) a URL could be choosen.
+ This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
+ "jar:file:/C:/temp/Test.sxw!/" for example.
+ When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
+ <xsl:param name="sourceBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
+ Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
+ This URL session is used for example when links to graphics are created by XSLT. Otherwise the user havt to log again in for every graphic he liks to see. -->
+ <xsl:param name="optionalURLSuffix" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="metaFileURL" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="stylesFileURL" />
+
+ <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
+ (e.g. encoding chapter names for the content-table as href and anchors ) -->
+ <xsl:param name="java" select="true()" />
+ <xsl:param name="javaEnabled" select="boolean($java)" />
+
+ <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
+ <xsl:param name="debug" select="false()" />
+ <xsl:param name="debugEnabled" select="boolean($debug)" />
+
+ <!-- matching configuration entries -->
+ <xsl:key name="config" use="@config:name"
+ match="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item |
+ /*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item-map-named/config:config-item-map-entry/config:config-item" />
+
+ <xsl:key name="colors" match="/*/office:styles//@*[name() = 'fo:background-color' or name() = 'fo:color'] |
+ /*/office:automatic-styles//@*[name() = 'fo:background-color' or name() = 'fo:color']" use="/" />
+ <xsl:key name="colorRGB" match="@fo:background-color | @fo:color" use="." />
+ <!-- *************************** -->
+ <!-- *** Built up Excel file *** -->
+ <!-- *************************** -->
+ <xsl:template match="/">
+ <xsl:processing-instruction name="mso-application">progid="Excel.Sheet"</xsl:processing-instruction>
+ <!-- Note: for debugging purpose include schema location
+ <Workbook xsi:schemaLocation="urn:schemas-microsoft-com:office:spreadsheet <YOUR_SCHEMA_URL>/excelss.xsd"> -->
+ <Workbook>
+ <!-- adding some default settings -->
+ <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
+ <Colors>
+ <xsl:for-each select="key('colors', /)
+ [generate-id(.) =
+ generate-id(key('colorRGB', .)[1]) and starts-with(., '#')] ">
+ <xsl:sort select="." />
+ <Color>
+ <Index><xsl:value-of select="position() + 2" /></Index>
+ <RGB><xsl:value-of select="." /></RGB>
+ </Color>
+ </xsl:for-each>
+ </Colors>
+ </OfficeDocumentSettings>
+ <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
+ <xsl:if test="key('config', 'HasSheetTabs') = 'false'">
+ <xsl:element name="HideWorkbookTabs" />
+ </xsl:if>
+ <WindowHeight>9000</WindowHeight>
+ <WindowWidth>13860</WindowWidth>
+ <WindowTopX>240</WindowTopX>
+ <WindowTopY>75</WindowTopY>
+ <ProtectStructure>False</ProtectStructure>
+ <ProtectWindows>False</ProtectWindows>
+ </ExcelWorkbook>
+ <!-- Note: the following handling will exchange the default, later
+ <x:ExcelWorkbook>
+ <xsl:apply-templates select="table:calculation-settings" />
+ </x:ExcelWorkbook>
+ -->
+ <xsl:element name="Styles">
+ <!-- our application default will not be used for export to Excel
+ <xsl:apply-templates select="/*/office:styles/style:default-style" mode="styles" />-->
+ <xsl:apply-templates select="/*/office:styles/style:style" mode="styles" />
+ <xsl:apply-templates select="/*/office:automatic-styles/style:style" mode="styles" >
+ <xsl:with-param name="isAutomatic" select="true()" />
+ </xsl:apply-templates>
+ </xsl:element>
+ <xsl:apply-templates select="/*/office:body" />
+ </Workbook>
+ </xsl:template>
+
+ <xsl:template match="office:body">
+ <!-- office:body table:table children are spreadsheets -->
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="office:spreadsheet">
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <!-- office:body table:table children are spreadsheets -->
+ <xsl:template match="office:spreadsheet/table:table">
+ <xsl:element name="ss:Worksheet">
+ <xsl:attribute name="ss:Name">
+ <xsl:value-of select="@table:name" />
+ </xsl:attribute>
+ <xsl:call-template name="table:table" />
+ <xsl:element name="x:WorksheetOptions">
+ <xsl:if test="key('config', 'ShowGrid') = 'false'">
+ <xsl:element name="x:DoNotDisplayGridlines" />
+ </xsl:if>
+ <xsl:if test="key('config', 'HasColumnRowHeaders') = 'false'">
+ <xsl:element name="x:DoNotDisplayHeadings" />
+ </xsl:if>
+ <xsl:if test="key('config', 'IsOutlineSymbolsSet') = 'false'">
+ <xsl:element name="x:DoNotDisplayOutline" />
+ </xsl:if>
+ <xsl:if test="key('config', 'ShowZeroValues') = 'false'">
+ <xsl:element name="x:DoNotDisplayZeros" />
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="table:decls" mode="ExcelWorkbook">
+ <xsl:apply-templates mode="ExcelWorkbook" />
+ </xsl:template>
+
+ <xsl:template match="table:calculation-settings" mode="ExcelWorkbook">
+ <xsl:if test="table:precision-as-shown">
+ <x:PrecisionAsDisplayed/>
+ </xsl:if>
+ <xsl:if test="table:null-date/@office:date-value='1904-01-01'">
+ <x:Date1904/>
+ </xsl:if>
+ <xsl:apply-templates select="table:iteration" />
+ </xsl:template>
+
+ <xsl:template match="table:iteration" mode="ExcelWorkbook">
+ <xsl:element name="x:ExcelWorkbook">
+ <xsl:if test="@table:status = 'enable'">
+ <x:Iteration/>
+ </xsl:if>
+ <xsl:if test="@table:steps">
+ <xsl:element name="x:MaxIterations">
+ <xsl:value-of select="@table:steps" />
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@table:maximum-difference">
+ <xsl:element name="x:MaxChange">
+ <xsl:value-of select="@table:maximum-difference" />
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/style_mapping.xsl b/filter/source/xslt/export/spreadsheetml/style_mapping.xsl
new file mode 100644
index 000000000000..70c10aa798cf
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/style_mapping.xsl
@@ -0,0 +1,394 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: style_mapping.xsl,v $
+
+ $Revision: 1.6 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+ <xsl:variable name="namespace-html" select="'http://www.w3.org/TR/REC-html40'" />
+
+ <xsl:template match="@table:style-name | @table:default-cell-style-name">
+ <xsl:if test="not(name() = 'Default')">
+ <xsl:attribute name="ss:StyleID">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:key match="table:table-cell" name="getCellByStyle" use="@table:style-name"/>
+ <xsl:template match="@table:style-name" mode="table-row">
+ <!-- only row styles used by cells are exported,
+ as usual row style properties are already written as row attributes -->
+ <xsl:if test="key('getCellByStyle', '.')">
+ <xsl:attribute name="ss:StyleID">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="style-and-contents">
+ <xsl:param name="cellStyleName" />
+
+ <!-- WorkAround of Excel2003 issue:
+ Styles from the CellStyle will not be inherited to HTML content (e.g. Colour style).
+ -->
+ <xsl:choose>
+ <xsl:when test="@text:style-name">
+ <xsl:variable name="styles">
+ <xsl:copy-of select="key('styles', @text:style-name)/*" />
+ <xsl:copy-of select="key('styles', $cellStyleName)/*" />
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xalan:nodeset($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xt:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="common:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@table:style-name">
+ <xsl:variable name="styles">
+ <xsl:copy-of select="key('styles', @text:style-name)/*" />
+ <xsl:copy-of select="key('styles', $cellStyleName)/*" />
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xalan:nodeset($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="xt:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-nested-format-tags">
+ <xsl:with-param name="styles" select="common:node-set($styles)" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- *********************************** -->
+ <!-- *** creating nested format tags *** -->
+ <!-- *********************************** -->
+
+ <!-- Bold -->
+ <xsl:template name="create-nested-format-tags">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-weight = 'bold' or $styles/*/@fo:font-weight = 'bolder'">
+ <xsl:element namespace="{$namespace-html}" name="B">
+ <xsl:call-template name="italic">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="italic">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Italic -->
+ <xsl:template name="italic">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-style = 'italic' or $styles/*/@fo:font-style = 'oblique'">
+ <xsl:element namespace="{$namespace-html}" name="I">
+ <xsl:call-template name="underline">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="underline">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Underline -->
+ <xsl:template name="underline">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:text-underline-type and not($styles/*/@style:text-underline-type = 'none')">
+ <xsl:element namespace="{$namespace-html}" name="U">
+ <xsl:call-template name="strikethrough">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="strikethrough">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+
+ <!-- strikethrough -->
+ <xsl:template name="strikethrough">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:text-line-through-style and not($styles/*/@style:text-line-through-style = 'none')">
+ <xsl:element namespace="{$namespace-html}" name="S">
+ <xsl:call-template name="super-subscript">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="super-subscript">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- superscript & subscript -->
+ <xsl:template name="super-subscript">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:text-position">
+ <xsl:variable name="textPosition" select="number(substring-before($styles/*/@style:text-position, '% '))" />
+ <xsl:choose>
+ <xsl:when test="$textPosition &gt; 0">
+ <xsl:element namespace="{$namespace-html}" name="Sup">
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$textPosition &lt; 0">
+ <xsl:element namespace="{$namespace-html}" name="Sub">
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="align">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Alignment - normally called by strikethrough, but no DIV elements in HTML -->
+ <xsl:template name="align">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-align">
+ <xsl:element namespace="{$namespace-html}" name="DIV">
+ <xsl:attribute name="html:style">
+ <xsl:choose>
+ <xsl:when test="$styles/*/@fo:font-align = 'start'">
+ <xsl:text>text-align:left;</xsl:text>
+ </xsl:when>
+ <xsl:when test="$styles/*/@fo:font-align = 'end'">
+ <xsl:text>text-align:right;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:center;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="font">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="font">
+ <xsl:with-param name="styles" select="$styles" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Font (size and color) -->
+ <xsl:template name="font">
+ <xsl:param name="styles" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="$styles/*/@style:font-name or
+ $styles/*/@fo:font-size or
+ $styles/*/@fo:color">
+ <xsl:element namespace="{$namespace-html}" name="Font">
+ <xsl:if test="$styles/*/@style:font-name">
+ <xsl:attribute name="html:Face">
+ <xsl:value-of select="$styles/*/@style:font-name" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styles/*/@fo:color">
+ <xsl:attribute name="html:Color">
+ <xsl:value-of select="$styles/*/@fo:color" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styles/*/@fo:font-size">
+ <!-- WORKAROUND TO EXCEL2003 issue where nested FONT elements with size attributes result in unloadable documents -->
+ <!-- Only create size attribute if parent do not have already one -->
+
+ <!--<xsl:choose>
+ <xsl:when test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)"> -->
+ <xsl:if test="not(key('styles', parent::*/@text:style-name)/*/@fo:font-size)">
+ <xsl:attribute name="html:Size">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$styles/*/@fo:font-size" />
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <!--</xsl:when>
+ <xsl:otherwise>
+ <xsl:message>Due Excel issue we have to neglect size from @text:style-name '<xsl:value-of select="@text:style-name"/>'!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>-->
+ </xsl:if>
+ <!-- get the embedded content -->
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- get the embedded content -->
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/styles.xsl b/filter/source/xslt/export/spreadsheetml/styles.xsl
new file mode 100644
index 000000000000..fdacf07c7133
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/styles.xsl
@@ -0,0 +1,699 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: styles.xsl,v $
+
+ $Revision: 1.6 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+ <!-- Used in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name" />
+ <!--
+ Mapping of OOo style:name and style:family to excel ss:ID
+ Styles form style:style map from style:name to ss:Name
+ style:parent-style map to ss:Parent
+ -->
+ <!-- default styles of the application
+ <xsl:template match="style:default-style" mode="styles" >
+ <xsl:call-template name="style:style">
+ <xsl:with-param name="styleName" select="'Default'" />
+ </xsl:call-template>
+ </xsl:template>
+ -->
+
+ <xsl:template match="style:style" mode="styles">
+ <xsl:param name="isAutomatic" />
+ <xsl:param name="styleName" select="@style:name" />
+ <xsl:param name="styleParentName" select="@style:parent-style-name" />
+
+ <!-- only row styles used by cells are exported,
+ as usual row style properties are already exported as row attributes -->
+ <xsl:if test="not(@style:family='table-row') or @style:family='table-row' and key('getCellByStyle', '.')">
+ <xsl:element name="Style">
+ <xsl:attribute name="ss:ID">
+ <!-- neglecting that a style is only unique in conjunction with it's family name -->
+ <xsl:value-of select="@style:name" />
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="not($isAutomatic)">
+ <xsl:choose>
+ <xsl:when test="@style:display-name">
+ <xsl:attribute name="ss:Name"><xsl:value-of select="@style:display-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="ss:Name"><xsl:value-of select="@style:name" /></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <!-- when a non-allowed parent style is found
+ (in spreadsheetml no style with ss:Name is able to have a ss:Parent) -->
+ <xsl:when test="@style:parent-style-name">
+ <!-- styles have to be merged (flatting heritance tree) -->
+ <xsl:variable name="stylePropertiesContainer">
+ <xsl:call-template name="merge-all-parent-styles">
+ <xsl:with-param name="currentStyle" select="." />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="write-style-properties">
+ <xsl:with-param name="styleProperties" select="xalan:nodeset($stylePropertiesContainer)/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="write-style-properties">
+ <xsl:with-param name="styleProperties" select="common:node-set($stylePropertiesContainer)/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="write-style-properties">
+ <xsl:with-param name="styleProperties" select="xt:node-set($stylePropertiesContainer)/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">WARNING: The required node set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-style-properties" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- automatic styles are implicit inherting from a style called 'Default',
+ furthermore nor in spreadsheetml nor in OpenDocument automatic styles are able to inherit from each other -->
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name and not(@style:parent-style-name = 'Default')">
+ <xsl:attribute name="ss:Parent"><xsl:value-of select="@style:parent-style-name" /></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:call-template name="write-style-properties" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- resolving the style inheritance by starting from uppermost parent and
+ overriding exisiting style properties by new found child properties -->
+ <xsl:template name="merge-all-parent-styles">
+ <xsl:param name="currentStyle" />
+
+ <xsl:choose>
+ <!-- in case of a parent, styles have to be merged (flatting heritance tree) -->
+ <xsl:when test="$currentStyle/@style:parent-style-name">
+ <!-- collect parent style properties -->
+ <xsl:variable name="parentStyleContainer">
+ <!-- take a look if the parent style has a parent himself -->
+ <xsl:call-template name="merge-all-parent-styles" >
+ <xsl:with-param name="currentStyle" select="key('styles', $currentStyle/@style:parent-style-name)" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="merge-style-properties">
+ <xsl:with-param name="childStyleContainer" select="$currentStyle" />
+ <xsl:with-param name="parentStyleContainer" select="xalan:nodeset($parentStyleContainer)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="merge-style-properties">
+ <xsl:with-param name="childStyleContainer" select="$currentStyle" />
+ <xsl:with-param name="parentStyleContainer" select="common:node-set($parentStyleContainer)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="merge-style-properties">
+ <xsl:with-param name="childStyleContainer" select="$currentStyle" />
+ <xsl:with-param name="parentStyleContainer" select="xt:node-set($parentStyleContainer)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">WARNING: The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- called for top parents (or styles without parents) -->
+ <xsl:otherwise>
+ <xsl:copy-of select="$currentStyle/*"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="merge-style-properties">
+ <xsl:param name="childStyleContainer" />
+ <xsl:param name="parentStyleContainer" />
+
+ <xsl:choose>
+ <xsl:when test="$parentStyleContainer/*">
+ <xsl:apply-templates select="$parentStyleContainer/*" mode="inheritance">
+ <xsl:with-param name="childStyleContainer" select="$childStyleContainer" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$childStyleContainer/*"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="*" mode="inheritance">
+ <xsl:param name="childStyleContainer" />
+
+ <!-- create an element named equal to the current properties parent element (e.g. style:table-cell-properties) -->
+ <xsl:element name="{name()}" namespace="urn:oasis:names:tc:opendocument:xmlns:style:1.0">
+ <!-- attributes will be automatically replaced -->
+ <xsl:copy-of select="@*" />
+ <xsl:copy-of select="$childStyleContainer/*[name() = name(current() )]/@*"/>
+
+ <!-- elements are not needed yet, will be neglected for simplicity reasons -->
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:key match="/*/office:styles/number:date-style |
+ /*/office:styles/number:time-style |
+ /*/office:styles/number:number-style |
+ /*/office:styles/number:percentage-style |
+ /*/office:styles/number:currency-style |
+ /*/office:automatic-styles/number:date-style |
+ /*/office:automatic-styles/number:time-style |
+ /*/office:automatic-styles/number:number-style |
+ /*/office:automatic-styles/number:percentage-style |
+ /*/office:automatic-styles/number:currency-style" name="number-style" use="@style:name" />
+
+
+ <xsl:template name="write-style-properties">
+ <xsl:param name="styleProperties" select="key('styles', @style:name)/*" />
+
+ <xsl:call-template name="Alignment">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="Border">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="Font">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ <xsl:with-param name="styleParentName" select="@style:parent-style-name" />
+ </xsl:call-template>
+ <xsl:call-template name="Interior">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="NumberFormat">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- context is element 'style:style' -->
+ <xsl:template name="NumberFormat">
+ <xsl:if test="@style:data-style-name">
+ <xsl:variable name="numberStyleName" select="@style:data-style-name" />
+ <xsl:variable name="numberStyle" select="key('number-style', $numberStyleName)" />
+
+ <xsl:element name="NumberFormat">
+ <xsl:attribute name="ss:Format">
+ <xsl:choose>
+ <xsl:when test="not($numberStyle/node())">
+ <!-- Excel2003sp1 issue: 'General' and 'General Number' is not supported -->
+ <xsl:text>General</xsl:text>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:number-style'">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:scientific-number">
+ <xsl:text>Scientific</xsl:text>
+ </xsl:when>
+ <!-- Excel2003sp1 issue: 'General Number' not supported -->
+ <xsl:when test="$numberStyle/number:number/@number:decimal-places and
+ $numberStyle/number:number/@number:decimal-places='0'">
+ <xsl:text>General</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:text">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:text = 'No' or $numberStyle/number:text = 'Nein'">
+ <xsl:text>Yes/No</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:text = 'False' or $numberStyle/number:text = 'Falsch'">
+ <xsl:text>True/False</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:text = 'Off' or $numberStyle/number:text = 'Aus'">
+ <xsl:text>On/Off</xsl:text>
+ </xsl:when>
+ <!-- Excel2003sp1 issue: currency is saved as 'float' -->
+ <xsl:when test="$numberStyle/number:currency-symbol">
+ <xsl:choose>
+ <xsl:when test="contains($numberStyle/number:currency-symbol, '€')">
+ <xsl:text>Euro Currency</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Currency</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- Excel2003sp1 issue: 'Currency' is saved as 'float' -->
+ <xsl:when test="contains($numberStyle/number:text, '$')">
+ <xsl:text>Currency</xsl:text>
+ </xsl:when>
+ <!-- OASIS XML adapation -->
+ <xsl:otherwise>
+ <xsl:text>General</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:grouping">
+ <xsl:text>Standard</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Fixed</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:time-style'">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:am-pm">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:seconds">
+ <xsl:text>Long Time</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Medium Time</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Short Time</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:percentage-style'">
+ <xsl:text>Percent</xsl:text>
+ </xsl:when>
+ <xsl:when test="name($numberStyle) = 'number:currency-style'">
+ <xsl:choose>
+ <xsl:when test="contains($numberStyle/number:currency-symbol, '€')">
+ <xsl:text>Euro Currency</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Currency</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:month">
+ <xsl:choose>
+ <xsl:when test="$numberStyle/number:month/@number:textual and
+ $numberStyle/number:month/@number:textual=true()">
+ <xsl:text>Medium Date</xsl:text>
+ <!-- Excel2003 sp1 issue: No difference between 'Long Date' and 'Medium Date' -->
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:hours">
+ <xsl:text>General Date</xsl:text>
+ </xsl:when>
+ <xsl:when test="$numberStyle/number:year/@number:style and
+ $numberStyle/number:year/@number:style='long'">
+ <xsl:text>Short Date</xsl:text>
+ </xsl:when>
+ <!-- OASIS XML adapation -->
+ <xsl:otherwise>
+ <xsl:text>Short Date</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- OASIS XML adapation -->
+ <xsl:otherwise>
+ <xsl:text>General</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="Alignment">
+ <xsl:param name="styleProperties" />
+
+ <!-- An empty Alignment element, might overwrite parents setting by
+ the default attributes -->
+ <xsl:if test="$styleProperties/@fo:text-align or
+ $styleProperties/@style:vertical-align or
+ $styleProperties/@fo:wrap-option or
+ $styleProperties/@fo:margin-left or
+ $styleProperties/@style:rotation-angle or
+ $styleProperties/@style:direction">
+ <xsl:element name="Alignment">
+ <xsl:if test="$styleProperties/@fo:text-align">
+ <xsl:attribute name="ss:Horizontal">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:text-align = 'center'">Center</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'end'">Right</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'justify'">Justify</xsl:when>
+ <xsl:otherwise>Left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:vertical-align">
+ <xsl:attribute name="ss:Vertical">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:vertical-align = 'top'">Top</xsl:when>
+ <xsl:when test="$styleProperties/@style:vertical-align = 'bottom'">Bottom</xsl:when>
+ <xsl:when test="$styleProperties/@style:vertical-align = 'middle'">Center</xsl:when>
+ <xsl:otherwise>Automatic</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:wrap-option = 'wrap'">
+ <xsl:attribute name="ss:WrapText">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:margin-left">
+ <xsl:attribute name="ss:Indent">
+ <xsl:variable name="margin">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$styleProperties/@fo:margin-left" />
+ <xsl:with-param name="rounding-factor" select="1" />
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- one ss:Indent is equal to 10 points -->
+ <xsl:value-of select="number($margin) div 10"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- Excel is only able to rotate between 90 and -90 degree (inclusive).
+ Other degrees will be mapped by 180 degrees -->
+ <xsl:if test="$styleProperties/@style:rotation-angle">
+ <xsl:attribute name="ss:Rotate">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt; 90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt;= 270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 360" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 180" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt; -90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt;= -270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 360" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 180" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:direction = 'ttb'">
+ <xsl:attribute name="ss:VerticalText">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="Border">
+ <xsl:param name="styleProperties" />
+
+ <!-- An empty border element, might overwrite parents setting by
+ the default attributes -->
+ <xsl:if test="$styleProperties/@fo:border or
+ $styleProperties/@fo:border-bottom or
+ $styleProperties/@fo:border-left or
+ $styleProperties/@fo:border-right or
+ $styleProperties/@fo:border-top">
+ <xsl:element name="Borders">
+ <xsl:if test="$styleProperties/@fo:border-bottom and not($styleProperties/@fo:border-bottom = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Bottom</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-bottom" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:border-left and not($styleProperties/@fo:border-left = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Left</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-left" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:border-right and not($styleProperties/@fo:border-right = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Right</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-right" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:border-top and not($styleProperties/@fo:border-top = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Top</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border-top" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <!-- write out all table border -->
+ <xsl:if test="$styleProperties/@fo:border and not($styleProperties/@fo:border = 'none')">
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Bottom</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Left</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Right</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="Border">
+ <xsl:attribute name="ss:Position">Top</xsl:attribute>
+ <xsl:call-template name="border-attributes">
+ <xsl:with-param name="border_properties" select="$styleProperties/@fo:border" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="border-attributes">
+ <xsl:param name="border_properties" />
+
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($border_properties, ' ')" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($border_properties, ' '), ' ')" />
+ <xsl:variable name="border-color" select="substring-after(substring-after($border_properties, ' '), ' ')" />
+<!--
+ <xsl:message>border-width:<xsl:value-of select="$border-width" /></xsl:message>
+ <xsl:message>border-style:<xsl:value-of select="$border-style" /></xsl:message>
+ <xsl:message>border-color:<xsl:value-of select="$border-color" /></xsl:message>
+ -->
+
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:attribute name="ss:LineStyle">
+ <xsl:choose>
+ <xsl:when test="$border-style = 'none'">None</xsl:when>
+ <xsl:when test="$border-style = 'double'">Double</xsl:when>
+ <xsl:otherwise>Continuous</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="ss:Weight">
+ <xsl:choose>
+ <!-- 0: Hairline -->
+ <xsl:when test="$border-width &lt;= 0.002">0</xsl:when>
+ <!-- 1: Thin -->
+ <xsl:when test="$border-width &lt;= 0.035">1</xsl:when>
+ <!-- 2: Medium -->
+ <xsl:when test="$border-width &lt;= 0.088">2</xsl:when>
+ <!-- 3: Thick -->
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="ss:Color">
+ <xsl:choose>
+ <xsl:when test="$border-color"><xsl:value-of select="$border-color" /></xsl:when>
+ <xsl:otherwise>Automatic</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <xsl:template name="Font">
+ <xsl:param name="styleProperties" />
+ <xsl:param name="styleParentName" />
+
+ <!-- An empty font element, might overwrite parents setting by
+ the default attributes -->
+ <xsl:if test="$styleProperties/@style:font-weight or
+ $styleProperties/@fo:color or
+ $styleProperties/@style:font-name or
+ $styleProperties/@fo:font-style or
+ $styleProperties/@style:text-outline or
+ $styleProperties/@style:text-shadow or
+ $styleProperties/@style:font-size or
+ $styleProperties/@style:text-line-through-style or
+ $styleProperties/@style:text-underline-type or
+ $styleProperties/@style:text-underline-style or
+ $styleProperties/@style:text-position">
+
+
+ <xsl:element name="Font">
+ <xsl:call-template name="getParentBold">
+ <xsl:with-param name="styleProperties" select="$styleProperties" />
+ <xsl:with-param name="styleParentName" select="$styleParentName" />
+ </xsl:call-template>
+ <xsl:if test="$styleProperties/@fo:color">
+ <xsl:attribute name="ss:Color"><xsl:value-of select="$styleProperties/@fo:color" /></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:font-name">
+ <xsl:attribute name="ss:FontName"><xsl:value-of select="$styleProperties/@style:font-name" /></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:font-style = 'italic'">
+ <xsl:attribute name="ss:Italic">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-outline = 'true'">
+ <xsl:attribute name="ss:Outline">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-shadow = 'shadow'">
+ <xsl:attribute name="ss:Shadow">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:font-size">
+ <xsl:attribute name="ss:Size">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$styleProperties/@fo:font-size" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-line-through-style and $styleProperties/@style:text-line-through-style != 'none'">
+ <xsl:attribute name="ss:StrikeThrough">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="($styleProperties/@style:text-underline-type and $styleProperties/@style:text-underline-type != 'none') or
+ ($styleProperties/@style:text-underline-style and $styleProperties/@style:text-underline-style != 'none')">
+ <xsl:attribute name="ss:Underline">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:text-underline-type = 'double'">Double</xsl:when>
+ <xsl:otherwise>Single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-position">
+ <xsl:attribute name="ss:VerticalAlign">
+ <xsl:choose>
+ <xsl:when test="substring-before($styleProperties/@style:text-position, '% ') &gt; 0">Superscript</xsl:when>
+ <xsl:otherwise>Subscript</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="Interior">
+ <xsl:param name="styleProperties" />
+ <xsl:if test="$styleProperties/@fo:background-color and not($styleProperties/@fo:background-color = 'transparent')">
+ <xsl:element name="Interior">
+ <xsl:attribute name="ss:Color">
+ <xsl:value-of select="$styleProperties/@fo:background-color" />
+ </xsl:attribute>
+ <!-- Background color (i.e. Interior/ss:Color) not shown without ss:Pattern (or with 'none')
+ Therefore a default is set -->
+ <xsl:attribute name="ss:Pattern">Solid</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Excel issue workaround: <Font ss:Bold="1"> is not inherited -->
+ <xsl:template name="getParentBold">
+ <xsl:param name="styleProperties" />
+ <xsl:param name="styleParentName" />
+ <xsl:param name="styleName" />
+
+ <xsl:if test="$styleParentName and $styleParentName != $styleName">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:font-weight = 'bold'">
+ <xsl:attribute name="ss:Bold">1</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getParentBold">
+ <xsl:with-param name="styleProperties" select="key('styles', $styleParentName)/*" />
+ <xsl:with-param name="styleParentName" select="key('styles', $styleParentName)/@style:parent-style-name" />
+ <xsl:with-param name="styleName" select="$styleParentName" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/spreadsheetml/table.xsl b/filter/source/xslt/export/spreadsheetml/table.xsl
new file mode 100644
index 000000000000..b9952f8f65cc
--- /dev/null
+++ b/filter/source/xslt/export/spreadsheetml/table.xsl
@@ -0,0 +1,941 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: table.xsl,v $
+
+ $Revision: 1.8 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink xt common xalan">
+
+
+ <!-- ************** -->
+ <!-- *** Table *** -->
+ <!-- ************** -->
+
+ <!-- check existence of default cell style -->
+ <xsl:variable name="firstDefaultCellStyle" select="descendant::table:table-column/@table:default-cell-style-name" />
+
+
+ <xsl:template match="table:table" name="table:table">
+ <xsl:element name="Table">
+ <xsl:apply-templates select="@table:style-name" />
+
+ <!-- find all columns in the table -->
+ <xsl:variable name="columnNodes" select="descendant::table:table-column" />
+ <!-- calculate the overall column amount -->
+ <xsl:variable name="maxColumnNo">
+ <xsl:choose>
+ <xsl:when test="$columnNodes/@table:number-columns-repeated">
+ <xsl:value-of select="count($columnNodes)
+ + number(sum($columnNodes/@table:number-columns-repeated))
+ - count($columnNodes/@table:number-columns-repeated)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count($columnNodes)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- create columns -->
+ <xsl:apply-templates select="$columnNodes[1]">
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ <xsl:with-param name="maxColumnNo" select="$maxColumnNo" />
+ </xsl:apply-templates>
+
+ <!-- create rows -->
+ <xsl:choose>
+ <xsl:when test="not($columnNodes/@table:number-columns-repeated)">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- To be able to match from a cell to the corresponding column to match @table:default-cell-style-name,
+ the repeated columns are being resolved by copying them in a helper variable -->
+ <xsl:variable name="columnNodes-RTF">
+ <xsl:for-each select="$columnNodes">
+ <xsl:call-template name="adding-column-styles-entries" />
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="xalan:nodeset($columnNodes-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="common:node-set($columnNodes-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="descendant::table:table-row" />
+ <xsl:with-param name="columnNodes" select="xt:node-set($columnNodes-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- **************** -->
+ <!-- *** Columns *** -->
+ <!-- **************** -->
+
+ <xsl:template match="table:table-column">
+ <xsl:param name="columnNodes" />
+ <xsl:param name="currentColumnNumber" select="1" />
+ <xsl:param name="setIndex" select="false()" />
+ <xsl:param name="maxColumnNo" />
+
+ <xsl:element name="Column">
+ <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'">
+ <xsl:attribute name="ss:Hidden">1</xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="@table:number-columns-repeated">
+ <xsl:attribute name="ss:Span">
+ <xsl:value-of select="@table:number-columns-repeated - 1" />
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:if test="$setIndex">
+ <xsl:attribute name="ss:Index">
+ <xsl:value-of select="$currentColumnNumber" />
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:choose>
+ <xsl:when test="@style:use-optimal-column-width = 'true'">
+ <xsl:attribute name="ss:AutoFitWidth">1</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="width" select="key('styles', @table:style-name)/style:table-column-properties/@style:column-width" />
+ <xsl:if test="$width">
+ <xsl:attribute name="ss:Width">
+ <!-- using the absolute width in point -->
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$width" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="@table:number-columns-repeated">
+ <xsl:attribute name="ss:Span">
+ <xsl:value-of select="@table:number-columns-repeated - 1" />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+
+ <xsl:variable name="columnNumber">
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:value-of select="$currentColumnNumber + @table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$currentColumnNumber"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$columnNumber &lt; $maxColumnNo">
+ <xsl:variable name="nextColumnNodes" select="$columnNodes[position() != 1]" />
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:apply-templates select="$nextColumnNodes[1]">
+ <xsl:with-param name="columnNodes" select="$nextColumnNodes" />
+ <xsl:with-param name="currentColumnNumber" select="$columnNumber" />
+ <xsl:with-param name="maxColumnNo" select="$maxColumnNo" />
+ <xsl:with-param name="setIndex" select="true()" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextColumnNodes[1]">
+ <xsl:with-param name="columnNodes" select="$nextColumnNodes" />
+ <xsl:with-param name="currentColumnNumber" select="$columnNumber + 1" />
+ <xsl:with-param name="maxColumnNo" select="$maxColumnNo" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- current node is a table:table-column -->
+ <xsl:template name="adding-column-styles-entries">
+ <xsl:choose>
+ <xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- repeated colums will be written explicit several times in the variable-->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- current node is a table:table-column -->
+ <!-- dublicates column elements in case of column-repeated attribute -->
+ <xsl:template name="repeat-adding-table-column">
+ <xsl:param name="table:table-column" />
+ <xsl:param name="numberColumnsRepeated" />
+
+ <xsl:choose>
+ <xsl:when test="$numberColumnsRepeated > 1">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- ************* -->
+ <!-- *** Rows *** -->
+ <!-- ************* -->
+
+
+ <!-- Recursions are much faster when the stack size is small -->
+ <xsl:template name="optimized-row-handling">
+ <xsl:param name="rowNodes" />
+ <xsl:param name="columnNodes" />
+ <xsl:param name="offset" select="0"/>
+ <xsl:param name="threshold" select="10"/>
+
+ <xsl:variable name="rowCount" select="count($rowNodes)"/>
+ <xsl:choose>
+ <xsl:when test="$rowCount &lt;= $threshold">
+ <xsl:apply-templates select="$rowNodes[1]">
+ <xsl:with-param name="rowNodes" select="$rowNodes" />
+ <xsl:with-param name="offset" select="$offset" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="rowCountHalf" select="floor($rowCount div 2)"/>
+ <xsl:variable name="rowNodesSetA" select="$rowNodes[position() &lt;= $rowCountHalf]"/>
+ <xsl:variable name="rowNodesSetB" select="$rowNodes[position() &gt; $rowCountHalf]"/>
+ <!-- to keep track of the rownumber, the repeteated rows have to kept into accounts -->
+ <xsl:variable name="rowsCreatedByRepetition">
+ <xsl:choose>
+ <xsl:when test="$rowNodesSetA/@table:number-rows-repeated">
+ <xsl:value-of select="number(sum($rowNodesSetA/@table:number-rows-repeated))
+ - count($rowNodesSetA/@table:number-rows-repeated)" />
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$rowCountHalf &gt; $threshold">
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetA"/>
+ <xsl:with-param name="offset" select="$offset" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:call-template name="optimized-row-handling">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetB"/>
+ <xsl:with-param name="offset" select="$offset + $rowCountHalf + $rowsCreatedByRepetition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$rowNodesSetA[1]">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetA"/>
+ <xsl:with-param name="offset" select="$offset" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ <xsl:apply-templates select="$rowNodesSetB[1]">
+ <xsl:with-param name="rowNodes" select="$rowNodesSetB" />
+ <xsl:with-param name="offset" select="$offset + $rowCountHalf + $rowsCreatedByRepetition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ Rows as "table:table-row" might be grouped in
+ "table:table-header-rows" or "table:table-row-group"
+ This row-tree will be traversed providing each Row with it's
+ calculatedRowPosition and earlierRowNumber.
+ By this repeated empty rows might be neglected in the spreadsheetml output,
+ as the following row will notice the 'gap' and provide @ss:Index,
+ which results in filling up the gap by a row without style and content.
+
+ In Excel created rows by ss:Index are 'default' rows.
+ -->
+ <xsl:template match="table:table-row">
+ <xsl:param name="earlierRowNumber" select="0" />
+ <xsl:param name="offset" />
+ <xsl:param name="calculatedRowPosition" select="$offset + 1" />
+ <xsl:param name="rowNodes" />
+ <xsl:param name="columnNodes" />
+
+ <xsl:choose>
+ <xsl:when test="@table:number-rows-repeated &gt; 1">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="earlierRowNumber" select="$earlierRowNumber" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:if test="@table:number-rows-repeated &gt; 2 and (table:table-cell/@office:value-type or $firstDefaultCellStyle != '')">
+ <!-- In case a cell is being repeated, the cell will be created
+ in a variabel, which is as many times given out, as being repeated -->
+ <xsl:variable name="tableRow">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ <xsl:with-param name="repetition" select="@table:number-rows-repeated - 1" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="earlierRowNumber" select="$earlierRowNumber" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:variable name="nextRowNodes" select="$rowNodes[position()!=1]" />
+ <xsl:choose>
+ <xsl:when test="@table:number-rows-repeated &gt; 1">
+ <xsl:apply-templates select="$nextRowNodes[1]">
+ <xsl:with-param name="earlierRowNumber" select="$calculatedRowPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition + @table:number-rows-repeated" />
+ <xsl:with-param name="rowNodes" select="$nextRowNodes" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextRowNodes[1]">
+ <xsl:with-param name="earlierRowNumber" select="$calculatedRowPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition + 1" />
+ <xsl:with-param name="rowNodes" select="$nextRowNodes" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="write-table-row">
+ <xsl:param name="earlierRowNumber" select="0" />
+ <xsl:param name="calculatedRowPosition" select="1" />
+ <xsl:param name="columnNodes" />
+
+ <xsl:element name="Row">
+ <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'">
+ <xsl:attribute name="ss:Hidden">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not($earlierRowNumber + 1 = $calculatedRowPosition)">
+ <xsl:attribute name="ss:Index"><xsl:value-of select="$calculatedRowPosition" /></xsl:attribute>
+ </xsl:if>
+
+ <!-- writing the style of the row -->
+ <xsl:apply-templates select="@table:style-name" mode="table-row" />
+
+ <xsl:variable name="rowProperties" select="key('styles', @table:style-name)/*" />
+ <xsl:if test="$rowProperties/@style:use-optimal-row-height = 'false'">
+ <!-- default is '1', therefore write only '0' -->
+ <xsl:attribute name="ss:AutoFitHeight">0</xsl:attribute>
+ </xsl:if>
+
+ <xsl:variable name="height" select="$rowProperties/@style:row-height" />
+ <xsl:if test="$height">
+ <xsl:attribute name="ss:Height">
+ <!-- using the absolute height in point -->
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$height" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="table:table-cell[1]">
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="table:table-cell" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- Recursions are much faster when the stack size is small -->
+ <xsl:template name="optimized-row-repeating">
+ <xsl:param name="tableRow" />
+ <xsl:param name="repetition" />
+ <!-- resource optimation: instead of '1' it will be '1000' and the column is not full -->
+ <xsl:param name="thresholdmax" select="512"/>
+ <xsl:param name="thresholdmin" select="256"/>
+
+ <xsl:choose>
+ <xsl:when test="$repetition &lt;= $thresholdmax">
+ <xsl:copy-of select="$tableRow" />
+ <xsl:if test="$repetition &lt;= $thresholdmin">
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$repetition mod 2 = 1">
+ <xsl:copy-of select="$tableRow" />
+ </xsl:if>
+ <xsl:variable name="repetitionHalf" select="floor($repetition div 2)"/>
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="repetition" select="$repetitionHalf"/>
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ </xsl:call-template>
+ <xsl:call-template name="optimized-row-repeating">
+ <xsl:with-param name="repetition" select="$repetitionHalf"/>
+ <xsl:with-param name="tableRow" select="$tableRow" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- ************** -->
+ <!-- *** Cells *** -->
+ <!-- ************** -->
+
+ <!-- Table cells are able to be repeated by attribute in StarOffice,
+ but not in Excel. If more cells are repeated -->
+ <xsl:template name="table:table-cell" match="table:table-cell">
+ <xsl:param name="calculatedCellPosition" select="1" /><!-- the later table position of the current cell -->
+ <xsl:param name="calculatedRowPosition" /><!-- the later table position of the current row -->
+ <xsl:param name="setIndex" select="false()" /> <!-- if not '0' @ss:Index used for neglecting repeteated empty cells -->
+ <xsl:param name="repetition" select="@table:number-columns-repeated" /> <!-- used for explicit writen out cells -->
+ <xsl:param name="repetitionCellPosition" select="$calculatedCellPosition" /><!-- during repetition formula needs exact cell positioning -->
+ <xsl:param name="nextMatchedCellPosition"><!-- the later table position of the next cell -->
+ <xsl:choose>
+ <xsl:when test="not(@table:number-columns-repeated) and not(@table:number-columns-spanned)">
+ <xsl:value-of select="$calculatedCellPosition + 1" />
+ </xsl:when>
+ <xsl:when test="not(@table:number-columns-spanned)">
+ <xsl:value-of select="$calculatedCellPosition + @table:number-columns-repeated" />
+ </xsl:when>
+ <xsl:when test="not(@table:number-columns-repeated)">
+ <xsl:value-of select="$calculatedCellPosition + @table:number-columns-spanned" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$calculatedCellPosition + @table:number-columns-spanned * @table:number-columns-repeated" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:param name="cellNodes" /><!-- cells to be handled -->
+ <xsl:param name="columnNodes" />
+
+ <xsl:choose>
+ <!-- in case a repetition took place -->
+ <xsl:when test="$repetition &gt; 0">
+ <xsl:choose>
+ <!-- In case of no cell content (text, subelements, attribute, except repeated style) the ss:Index could be used -->
+ <xsl:when test="not(text()) and not(*) and not(@*[name() != 'table:number-columns-repeated'])">
+ <xsl:choose>
+ <xsl:when test="count($cellNodes) = 1">
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition - 1" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- Fastest cell repetition by creating cell once and copying, works not for
+ a) cells with formula (need of actual cell postition)
+ b) cells, which start with ss:Index (as ss:Index is not allowed to be repeated) -->
+ <xsl:when test="not(@table:formula) and not($setIndex)">
+ <!-- In case a non-empty cell is being repeated, the cell will be created
+ in a variabel, which is as many times given out, as being repeated -->
+ <xsl:variable name="tableCell">
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="false()" /><!-- copied cells may not have indices -->
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="repeat-copy-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell" />
+ <xsl:with-param name="repetition" select="$repetition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- explicit writing (instead of copying) of cell for the cases mentioned above -->
+ <xsl:otherwise>
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="$setIndex" /><!-- a possible Index will be created -->
+ <xsl:with-param name="calculatedCellPosition" select="$repetitionCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:choose>
+ <!-- as long there is a repetition (higher '1') stay on the same cell node -->
+ <xsl:when test="$repetition &gt; 1">
+ <xsl:call-template name="table:table-cell">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="repetitionCellPosition">
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-spanned">
+ <xsl:value-of select="$repetitionCellPosition + @table:number-columns-spanned" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$repetitionCellPosition + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="nextMatchedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="repetition" select="$repetition - 1" />
+ <xsl:with-param name="cellNodes" select="$cellNodes" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- in case no repetition took place -->
+ <xsl:choose>
+ <!-- neglect en empty cells by using ss:Index Attribut -->
+ <xsl:when test="not(text()) and not(*) and not(@*)">
+ <xsl:choose>
+ <!-- if it is the last cell, write this cell -->
+ <xsl:when test="count($cellNodes) = 1">
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition - 1" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="setIndex" select="true()" />
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- create cell and use/unset the ss:Index -->
+ <xsl:call-template name="create-table-cell">
+ <xsl:with-param name="setIndex" select="$setIndex" />
+ <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:call-template>
+ <xsl:apply-templates select="$cellNodes[2]">
+ <xsl:with-param name="calculatedCellPosition" select="$nextMatchedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ <xsl:with-param name="cellNodes" select="$cellNodes[position() != 1]" />
+ <xsl:with-param name="columnNodes" select="$columnNodes" />
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Copies the variable 'tableCell' to the output as often as 'repetition' -->
+ <xsl:template name="repeat-copy-table-cell">
+ <xsl:param name="tableCell" />
+ <xsl:param name="repetition" />
+
+ <xsl:if test="$repetition &gt; 0">
+ <xsl:copy-of select="$tableCell"/>
+ <xsl:call-template name="repeat-copy-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell" />
+ <xsl:with-param name="repetition" select="$repetition - 1" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="create-table-cell">
+ <xsl:param name="setIndex" select="false()" />
+ <xsl:param name="calculatedCellPosition" />
+ <xsl:param name="calculatedRowPosition" />
+ <xsl:param name="columnNodes" />
+
+ <xsl:element name="Cell" namespace="urn:schemas-microsoft-com:office:spreadsheet">
+ <xsl:if test="$setIndex">
+ <xsl:attribute name="ss:Index">
+ <xsl:value-of select="$calculatedCellPosition"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-columns-spanned &gt; 1">
+ <xsl:attribute name="ss:MergeAcross">
+ <xsl:value-of select="@table:number-columns-spanned - 1" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-rows-spanned &gt; 1">
+ <xsl:attribute name="ss:MergeDown">
+ <xsl:value-of select="@table:number-rows-spanned - 1" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="link" select="descendant::text:a/@xlink:href" />
+ <xsl:if test="$link">
+ <xsl:attribute name="ss:HRef">
+ <xsl:value-of select="$link" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@table:style-name">
+ <xsl:apply-templates select="@table:style-name" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$firstDefaultCellStyle != ''">
+ <xsl:variable name="defaultCellStyle" select="$columnNodes/table:table-column[position() = $calculatedCellPosition]/@table:default-cell-style-name" />
+ <xsl:if test="$defaultCellStyle">
+ <xsl:if test="not($defaultCellStyle = 'Default')">
+ <xsl:attribute name="ss:StyleID"><xsl:value-of select="$defaultCellStyle"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="@table:formula">
+ <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" />
+ <xsl:with-param name="calculatedRowPosition" select="$calculatedRowPosition" />
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="*">
+ <!-- in case it is not an empty cell
+
+ As the sequence of comment and data is opposite in Excel and Calc no match work here, in both comments exist only once
+ Possible Table Content of interest: text:h|text:p|text:list -->
+ <xsl:if test="text:h | text:p | text:list">
+ <xsl:variable name="valueType">
+ <xsl:choose>
+ <xsl:when test="@office:value-type">
+ <xsl:value-of select="@office:value-type" />
+ </xsl:when>
+ <xsl:otherwise>string</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="ss:Data">
+ <xsl:with-param name="valueType" select="$valueType" />
+ <xsl:with-param name="cellStyleName" select="@table:style-name" />
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:if test="office:annotation">
+ <xsl:element name="Comment">
+ <xsl:if test="office:annotation/@office:author">
+ <xsl:attribute name="ss:Author"><xsl:value-of select="office:annotation/@office:author" /></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="office:annotation/@office:display = 'true'">
+ <xsl:attribute name="ss:ShowAlways">1</xsl:attribute>
+ </xsl:if>
+ <!-- ss:Data is oblicatory, but not the same as the ss:Cell ss:Data child, as it has no attributes -->
+ <ss:Data xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:for-each select="office:annotation/text:p">
+ <xsl:choose>
+ <xsl:when test="*">
+ <!-- paragraph style have to be neglected due to Excel error,
+ which does not allow shadowing their HTML attributes -->
+ <xsl:for-each select="*">
+ <xsl:call-template name="style-and-contents" />
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@text:style-name">
+ <xsl:call-template name="style-and-contents" />
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if no style is set, BOLD is set as default -->
+ <B>
+ <xsl:call-template name="style-and-contents" />
+ </B>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </ss:Data>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- comments are handled separately in the cell -->
+ <xsl:template match="office:annotation" />
+ <xsl:template match="dc:date" />
+
+ <xsl:template name="ss:Data">
+ <!-- the default value is 'String' in the office -->
+ <xsl:param name="valueType" select="'string'" />
+ <xsl:param name="cellStyleName" />
+
+ <xsl:choose>
+ <xsl:when test="descendant::*/@text:style-name">
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <ss:Data ss:Type="Boolean" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date'">
+ <ss:Data ss:Type="DateTime" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:when>
+ <!-- float, time, percentage, currency (no 'Error' setting) -->
+ <xsl:otherwise>
+ <ss:Data ss:Type="Number" xmlns="http://www.w3.org/TR/REC-html40">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:apply-templates>
+ </ss:Data>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="Data">
+ <xsl:call-template name="ss:Type">
+ <xsl:with-param name="valueType" select="$valueType" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="ss:Type">
+ <xsl:param name="valueType" select="'string'" />
+
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <xsl:attribute name="ss:Type">String</xsl:attribute>
+ <xsl:apply-templates select="*"/>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <xsl:attribute name="ss:Type">Boolean</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@office:boolean-value = 'true'">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date' or $valueType = 'time'">
+ <!-- issue in Excel: can not have an empty 'DateTime' cell -->
+ <xsl:attribute name="ss:Type">DateTime</xsl:attribute>
+ <!-- Gathering information of two StarOffice date/time attributes
+ Excel always needs both informations in one attribute -->
+ <xsl:choose>
+ <xsl:when test="@office:date-value">
+ <!-- office:date-value may contain time (after 'T')-->
+ <xsl:choose>
+ <xsl:when test="contains(@office:date-value, 'T')">
+ <!-- in case time is also part of the date -->
+ <xsl:value-of select="substring-before(@office:date-value, 'T')" />
+ <xsl:text>T</xsl:text>
+ <xsl:value-of select="substring-after(@office:date-value,'T')" />
+ <xsl:if test="not(contains(@office:date-value,'.'))">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ <xsl:text>000</xsl:text>
+ </xsl:when>
+ <xsl:when test="@office:time-value">
+ <!-- conatains date and time (time will be evaluated later -->
+ <xsl:value-of select="@office:date-value" />
+ <xsl:text>T</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@table:formula or contains(@office:time-value,',')">
+ <!-- customized number types not implemented yet -->
+ <xsl:text>00:00:00.000</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(substring-after(@office:time-value,'PT'),'HMS','::.')" />
+ <xsl:if test="not(contains(@office:time-value,'S'))">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ <xsl:text>000</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@office:date-value" />
+ <xsl:text>T00:00:00.000</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@office:time-value">
+ <xsl:text>1899-12-31T</xsl:text>
+ <xsl:choose>
+ <xsl:when test="@table:formula or contains(@office:time-value,',')">
+ <!-- customized number types not implemented yet -->
+ <xsl:text>00:00:00.000</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(substring-after(@office:time-value,'PT'),'HMS','::.')" />
+ <xsl:if test="not(contains(@office:time-value,'S'))">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ <xsl:text>000</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- float, percentage, currency (no 'Error' setting) -->
+ <xsl:otherwise>
+ <xsl:attribute name="ss:Type">Number</xsl:attribute>
+ <xsl:value-of select="@office:value" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- ******************** -->
+ <!-- *** Common Rules *** -->
+ <!-- ******************** -->
+
+ <xsl:template match="*">
+ <xsl:param name="cellStyleName" />
+
+<!-- LineBreak in Cell -->
+ <xsl:if test="preceding-sibling::text:p[1]"><xsl:text>&#10;</xsl:text></xsl:if>
+ <xsl:call-template name="style-and-contents">
+ <xsl:with-param name="cellStyleName" select="$cellStyleName" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- disabling draw:frames -->
+ <xsl:template match="draw:frame" />
+
+ <xsl:template match="text:s">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace">
+ <xsl:param name="whitespaces" />
+
+ <xsl:text> </xsl:text>
+ <xsl:if test="$whitespaces >= 1">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- allowing all matched text nodes -->
+ <xsl:template match="text()"><xsl:value-of select="." /></xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/filter/source/xslt/export/uof/odf2uof_presentation.xsl b/filter/source/xslt/export/uof/odf2uof_presentation.xsl
new file mode 100644
index 000000000000..4cc71aea5d8c
--- /dev/null
+++ b/filter/source/xslt/export/uof/odf2uof_presentation.xsl
@@ -0,0 +1,3375 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 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:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:数="http://www.w3.org/1998/Math/MathML" xmlns:图="http://schemas.uof.org/cn/2003/graph" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="no" omit-xml-declaration="no"/>
+ <xsl:variable name="impresswithUnit">
+ <xsl:value-of select="/office:document/office:styles/style:style[@style:family='graphic']/style:graphic-properties/@svg:stroke-width"/>
+ </xsl:variable>
+ <xsl:variable name="uofUnit">
+ <xsl:choose>
+ <xsl:when test="contains($impresswithUnit,'inch')">inch</xsl:when>
+ <xsl:when test="contains($impresswithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($impresswithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($impresswithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cm-to-other">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='inch'">0.394</xsl:when>
+ <xsl:when test="$uofUnit='pt'">28.346</xsl:when>
+ <xsl:when test="$uofUnit='mm'">10</xsl:when>
+ <xsl:when test="$uofUnit='pica'">2.364</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/>
+ <xsl:template match="/">
+ <xsl:apply-templates select="office:document"/>
+ </xsl:template>
+ <xsl:template match="office:document">
+ <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:图="http://schemas.uof.org/cn/2003/graph" xmlns:数="http://www.w3.org/1998/Math/MathML" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uof:language="cn" uof:version="1.0" uof:locID="u0000" uof:mimetype="vnd.uof.presentation">
+ <xsl:apply-templates select="office:meta"/>
+ <xsl:if test="//text:bookmark|//text:bookmark-start">
+ <uof:书签集 uof:locID="u0027">
+ <xsl:for-each select="//text:bookmark|//text:bookmark-start">
+ <uof:书签 uof:名称="{@text:name}" uof:locID="u0028" uof:attrList="名称">
+ <uof:文本位置 uof:区域引用="{generate-id(.)}" uof:locID="u0029" uof:attrList="区域引用"/>
+ </uof:书签>
+ </xsl:for-each>
+ </uof:书签集>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/text:p/text:a | /office:document/office:body/text:p/draw:a">
+ <uof:链接集 uof:locID="u0031">
+ <xsl:for-each select="/office:document/office:body/text:p/text:a | /office:document/office:body/text:p/draw:a">
+ <xsl:variable name="hyperStr" select="@xlink:href"/>
+ <uof:超级链接 uof:locID="u0032" uof:attrList="标识符 目标 书签 式样引用 已访问式样引用 提示 链源">
+ <xsl:if test="contains($hyperStr,'#')">
+ <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute>
+ <xsl:attribute name="uof:提示"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="num">
+ <xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:链源"><xsl:value-of select="concat('hlnk',$num)"/></xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('hyk_','hlnk',$num)"/></xsl:attribute>
+ <xsl:if test="not(contains($hyperStr,'#'))">
+ <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains($hyperStr,'@')">
+ <xsl:attribute name="uof:提示">链接到邮件地址</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:提示">链接文件</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@text:style-name">
+ <xsl:attribute name="uof:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:visited-style-name">
+ <xsl:attribute name="uof:已访问式样引用"><xsl:value-of select="@text:visited-style-name"/></xsl:attribute>
+ </xsl:if>
+ </uof:超级链接>
+ </xsl:for-each>
+ </uof:链接集>
+ </xsl:if>
+ <uof:对象集 uof:locID="u0033">
+ <xsl:apply-templates select="office:master-styles/style:handout-master" mode="styles"/>
+ <xsl:apply-templates select="office:master-styles/style:master-page" mode="styles"/>
+ <xsl:apply-templates select="office:body/office:presentation/draw:page" mode="styles"/>
+ <xsl:apply-templates select="office:styles/style:presentation-page-layout/presentation:placeholder" mode="graphic"/>
+ <xsl:apply-templates select="office:body/office:presentation/draw:page/presentation:notes" mode="styles"/>
+ <xsl:for-each select="(/office:document/office:styles/draw:fill-image) | (/office:document/office:automatic-styles/draw:fill-image)">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:数据>
+ </uof:其他对象>
+ </xsl:for-each>
+ <xsl:for-each select="(/office:document/office:styles/style:style/style:graphic-properties/text:list-style/text:list-level-style-image) | (/office:document/office:automatic-styles/style:style/style:graphic-properties/text:list-style/text:list-level-style-image)">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:数据>
+ </uof:其他对象>
+ </xsl:for-each>
+ </uof:对象集>
+ <uof:式样集 uof:locID="u0039">
+ <xsl:apply-templates select="office:font-face-decls"/>
+ <xsl:element name="uof:自动编号集">
+ <xsl:attribute name="uof:locID">u0042</xsl:attribute>
+ <xsl:for-each select="/office:document//text:list-style">
+ <xsl:element name="字:自动编号">
+ <xsl:attribute name="uof:locID">t0169</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 父编号引用 多级编号</xsl:attribute>
+ <xsl:attribute name="字:标识符">
+ <xsl:variable name="count1" select="count(preceding::text:list-style)"/>
+ <xsl:choose><xsl:when test="@style:name"><xsl:value-of select="concat(@style:name,$count1)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(../../@style:name,$count1)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:多级编号">true</xsl:attribute>
+ <xsl:for-each select="./* ">
+ <xsl:if test="number(@text:level) &lt; 10">
+ <xsl:element name="字:级别">
+ <xsl:attribute name="uof:locID">t0159</xsl:attribute>
+ <xsl:attribute name="uof:attrList">级别值 编号对齐方式 尾随字符</xsl:attribute>
+ <xsl:attribute name="字:级别值"><xsl:value-of select="number(@text:level)"/></xsl:attribute>
+ <xsl:if test="style:list-level-properties/@fo:text-align">
+ <xsl:attribute name="字:编号对齐方式"><xsl:value-of select="style:list-level-properties/@fo:text-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="level">
+ <xsl:value-of select="@text:level"/>
+ </xsl:variable>
+ <xsl:if test="office:binary-data">
+ <xsl:element name="字:图片符号引用" uof:locID="t0164" uof:attrList="宽度 高度">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:height,$uofUnit)"/></xsl:attribute>
+ <xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:bullet-char">
+ <xsl:element name="字:项目符号">
+ <xsl:attribute name="uof:locID">t0171</xsl:attribute>
+ <xsl:value-of select="@text:bullet-char"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:符号字体">
+ <xsl:attribute name="uof:locID">t0160</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ <xsl:if test="@style:num-format">
+ <xsl:choose>
+ <xsl:when test="string(@style:num-format)='a'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">lower-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='A'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">upper-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='i'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">lower-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='I'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">upper-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='①, ②, ③, ...'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">decimal-enclosed-circle</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='甲, 乙, 丙, ...'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">ideograph-traditional</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='子, 丑, 寅, ...'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">ideograph-zodiac</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='一, 二, 三, ...'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">chinese-counting</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='壹, 贰, 叁, ...'">
+ <xsl:element name="字:编号格式" uof:locID="t0162">chinese-legal-simplified</xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:编号格式" uof:locID="t0162">decimal</xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:variable name="jibie">
+ <xsl:value-of select="position()"/>
+ </xsl:variable>
+ <xsl:variable name="xianshijibie">
+ <xsl:choose>
+ <xsl:when test="@text:display-levels">
+ <xsl:value-of select="@text:display-levels"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <字:编号格式表示 uof:locID="t0163">
+ <xsl:call-template name="字:编号格式表示">
+ <xsl:with-param name="bubianjibie" select="$jibie"/>
+ <xsl:with-param name="jibie" select="$jibie"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie"/>
+ <xsl:with-param name="biaoshi" select="concat(string(@style:num-prefix),'%',$jibie,string(@style:num-suffix))"/>
+ </xsl:call-template>
+ </字:编号格式表示>
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0165</xsl:attribute>
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:element>
+ <xsl:element name="字:制表符位置">
+ <xsl:attribute name="uof:locID">t0166</xsl:attribute>
+ <xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/>
+ </xsl:element>
+ <xsl:if test="@text:start-value">
+ <xsl:element name="字:起始编号">
+ <xsl:value-of select="@text:start-value"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:num-regular-exp">
+ <xsl:element name="字:正规格式" uof:locID="t0168" uof:attrList="值">
+ <xsl:attribute name="值"><xsl:value-of select="@text:num-regular-exp"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:for-each select="/office:document//text:list-style/*">
+ <xsl:if test="style:text-properties/@fo:font-family">
+ <xsl:element name="uof:句式样">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute>
+ <xsl:variable name="count"><xsl:value-of select="count(preceding::node())"/></xsl:variable>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat('ID',$count)"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="concat(ancestor::style:style/@style:name,@text:level)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="ancestor::style:style/@style:parent-style-name">
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="ancestor::style:style/@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:apply-templates select="office:styles | office:automatic-styles" mode="style"/>
+ <xsl:for-each select="/office:document/office:master-styles/style:master-page">
+ <xsl:for-each select="child::draw:frame">
+ <xsl:variable name="stylename" select="@presentation:style-name"/>
+ <xsl:variable name="parent" select="/office:document/office:automatic-styles/style:style[@style:name=$stylename]/@style:parent-style-name"/>
+ <xsl:for-each select="/office:document/*/style:style[@style:name=$parent]">
+ <xsl:if test="not(contains(@style:name,'outline'))">
+ <xsl:call-template name="段落式样"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:styles/style:style[contains(@style:name,'outline')]">
+ <xsl:call-template name="段落式样"/>
+ </xsl:for-each>
+ </uof:式样集>
+ <uof:演示文稿 uof:locID="u0048">
+ <演:公用处理规则 uof:locID="p0000">
+ <xsl:element name="演:度量单位">
+ <xsl:attribute name="uof:locID">p0055</xsl:attribute>
+ <xsl:value-of select="$uofUnit"/>
+ </xsl:element>
+ <演:页面设置集 uof:locID="p0001">
+ <xsl:apply-templates select="office:automatic-styles/style:page-layout"/>
+ </演:页面设置集>
+ <演:配色方案集 uof:locID="p0007">
+ <xsl:for-each select="/office:document/office:master-styles/*[@draw:style-name]">
+ <xsl:call-template name="配色方案"/>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:body/office:presentation/draw:page">
+ <xsl:call-template name="配色方案"/>
+ </xsl:for-each>
+ </演:配色方案集>
+ <演:页面版式集 uof:locID="p0017">
+ <xsl:apply-templates select="office:styles/style:presentation-page-layout" mode="pagestyle"/>
+ </演:页面版式集>
+ <xsl:if test="office:styles/style:style='标准-title' or office:styles/style:style='标准-outline'" >
+ <演:文本式样集 uof:locID="p0131">
+ <xsl:for-each select="office:styles/style:style">
+ <xsl:variable name="name"><xsl:value-of select="@style:name"/></xsl:variable>
+ <xsl:if test="$name='标准-title' or contains($name,'标准-outline')">
+ <演:文本式样 uof:locID="p0132" uof:attrList="标识符 名称">
+ <xsl:attribute name="演:标识符">text-style</xsl:attribute>
+ <xsl:attribute name="演:名称">文本式样</xsl:attribute>
+ <xsl:element name="演:段落式样">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:别名"><xsl:value-of select="@style:class"/></xsl:attribute>
+ <xsl:call-template name="ParaAttribute">
+ <xsl:with-param name="text-style-name" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ </演:文本式样>
+ </xsl:if>
+ </xsl:for-each>
+ </演:文本式样集>
+ </xsl:if>
+ <演:显示比例 uof:locID="p0020">
+ <xsl:variable name="VisibleAreaWidth">
+ <xsl:value-of select="/office:document/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry/config:config-item[@config:name='VisibleAreaWidth']"/>
+ </xsl:variable>
+ <xsl:value-of select="substring-before((13997 div $VisibleAreaWidth)*100,'.')"/>
+ </演:显示比例>
+ <演:放映设置 uof:locID="p0021">
+ <演:幻灯片序列 uof:locID="p0022" uof:attrList="标识符 名称 自定义">
+ <xsl:attribute name="演:标识符">customList</xsl:attribute>
+ <xsl:attribute name="演:名称">幻灯片序列</xsl:attribute>
+ <xsl:attribute name="演:自定义">true</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:start-page">
+ <xsl:variable name="start-page">
+ <xsl:value-of select="office:body/office:presentation/presentation:settings/@presentation:start-page"/>
+ </xsl:variable>
+ <xsl:variable name="before-slides">
+ <xsl:call-template name="幻灯片序列">
+ <xsl:with-param name="start-node" select="office:body/office:presentation/draw:page[@draw:name=$start-page]"/>
+ <xsl:with-param name="end-node" select="office:body/office:presentation/draw:page[last()]"/>
+ <xsl:with-param name="value"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="after-slides">
+ <xsl:for-each select="office:body/office:presentation/draw:page[@draw:name=$start-page]">
+ <xsl:call-template name="幻灯片序列">
+ <xsl:with-param name="start-node" select="/office:document/office:body/office:presentation/draw:page[1]"/>
+ <xsl:with-param name="end-node" select="preceding-sibling::node()[1]"/>
+ <xsl:with-param name="value"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:value-of select="concat($before-slides,' ',$after-slides)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="幻灯片序列">
+ <xsl:with-param name="start-node" select="office:body/office:presentation/draw:page[1]"/>
+ <xsl:with-param name="end-node" select="office:body/office:presentation/draw:page[last()]"/>
+ <xsl:with-param name="value"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:幻灯片序列>
+ <演:放映顺序 uof:locID="p0023" uof:attrList="名称 序列引用">
+ <xsl:attribute name="演:名称">放映顺序</xsl:attribute>
+ <xsl:attribute name="演:序列引用">customList</xsl:attribute>
+ </演:放映顺序>
+ <演:全屏放映 uof:locID="p0024">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:full-screen='false'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </演:全屏放映>
+ <演:循环放映 uof:locID="p0025">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:endless='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </演:循环放映>
+ <xsl:if test="office:body/office:presentation/presentation:settings/@presentation:pause">
+ <演:放映间隔 uof:locID="p0026">
+ <xsl:variable name="hms">
+ <xsl:value-of select="substring-after(office:body/office:presentation/presentation:settings/@presentation:pause,'PT')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat('P0Y0M0DT',$hms)"/>
+ </演:放映间隔>
+ </xsl:if>
+ <演:手动方式 uof:locID="p0027">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:force-manual='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </演:手动方式>
+ <演:导航帮助 uof:locID="p0029">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:start-with-navigator='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </演:导航帮助>
+ <演:放映动画 uof:locID="p0030">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:animations='disabled'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </演:放映动画>
+ <演:前端显示 uof:locID="p0031">
+ <xsl:choose>
+ <xsl:when test="office:body/office:presentation/presentation:settings/@presentation:stay-on-top='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </演:前端显示>
+ </演:放映设置>
+ </演:公用处理规则>
+ <演:主体 uof:locID="p0034">
+ <演:母版集 uof:locID="p0035">
+ <xsl:apply-templates select="office:master-styles"/>
+ </演:母版集>
+ <演:幻灯片集 uof:locID="p0039">
+ <xsl:apply-templates select="office:body/office:presentation/draw:page"/>
+ </演:幻灯片集>
+ </演:主体>
+ </uof:演示文稿>
+ </uof:UOF>
+ </xsl:template>
+<xsl:template name="配色方案">
+ <xsl:variable name="page-name"><xsl:value-of select="@draw:style-name"/></xsl:variable>
+ <演:配色方案 uof:locID="p0008" uof:attrList="标识符 名称 类型">
+ <xsl:attribute name="演:标识符">
+ <xsl:choose>
+ <xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@draw:style-name"/></xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:attribute>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name = $page-name]">
+ <xsl:attribute name="演:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="演:类型"><xsl:choose><xsl:when test="not(contains(@style:name,'color'))">custom</xsl:when><xsl:otherwise>standard</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:drawing-page-properties/@draw:fill-color">
+ <演:背景色 uof:locID="p0009">
+ <xsl:value-of select="style:drawing-page-properties/@draw:fill-color"/>
+ </演:背景色>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@svg:stroke-color">
+ <演:文本和线条 uof:locID="p0010">
+ <xsl:value-of select="style:drawing-page-properties/@svg:stroke-color"/>
+ </演:文本和线条>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@draw:shadow-color">
+ <演:阴影 uof:locID="p0011">
+ <xsl:value-of select="style:drawing-page-properties/@draw:shadow-color"/>
+ </演:阴影>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@svg:stroke-color">
+ <演:标题文本 uof:locID="p0012">
+ <xsl:value-of select="style:drawing-page-properties/@svg:stroke-color"/>
+ </演:标题文本>
+ </xsl:if>
+ <xsl:if test="style:drawing-page-properties/@draw:fill-color">
+ <演:填充 uof:locID="p0013">
+ <xsl:value-of select="style:drawing-page-properties/@draw:fill-color"/>
+ </演:填充>
+ </xsl:if>
+ <演:强调 uof:locID="p0014">#FFFFFF</演:强调>
+ <演:强调和超级链接 uof:locID="p0015">#FF0000</演:强调和超级链接>
+ <演:强调和尾随超级链接 uof:locID="p0016">#FF00FF</演:强调和尾随超级链接>
+ </xsl:for-each>
+ </演:配色方案>
+</xsl:template>
+ <xsl:template name="幻灯片序列">
+ <xsl:param name="start-node"/>
+ <xsl:param name="end-node"/>
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="not($start-node/@draw:name = $end-node/@draw:name)">
+ <xsl:for-each select="$start-node">
+ <xsl:variable name="value1">
+ <xsl:value-of select="concat($value,@draw:name,'_',@draw:style-name,' ')"/>
+ </xsl:variable>
+ <xsl:call-template name="幻灯片序列">
+ <xsl:with-param name="start-node" select="following-sibling::node()[1]"/>
+ <xsl:with-param name="end-node" select="$end-node"/>
+ <xsl:with-param name="value" select="$value1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($value,$start-node/@draw:name)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:编号格式表示">
+ <xsl:param name="bubianjibie"/>
+ <xsl:param name="jibie"/>
+ <xsl:param name="xianshijibie"/>
+ <xsl:param name="biaoshi"/>
+ <xsl:choose>
+ <xsl:when test="number($xianshijibie)= 1">
+ <xsl:value-of select="$biaoshi"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-prefix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-prefix"/>
+ </xsl:variable>
+ <xsl:variable name="num-suffix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-suffix"/>
+ </xsl:variable>
+ <xsl:call-template name="字:编号格式表示">
+ <xsl:with-param name="bubianjibie" select="$bubianjibie"/>
+ <xsl:with-param name="jibie" select="$jibie -1"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie -1"/>
+ <xsl:with-param name="biaoshi" select="concat($num-prefix,'%',number($jibie -1),$num-suffix,'.',$biaoshi)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:句属性">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute>
+ <xsl:if test=".//@fo:font-size or .//@style:font-size-asian or .//@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(.//@fo:font-size,'%') or contains(.//@style:font-size-asian,'%')">
+ <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'%')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-complex"><xsl:value-of select="substring-before(.//@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select=".//@style:font-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select=".//@style:font-name-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test=".//@style:text-background-color and not(.//@style:text-background-color='transparent')">
+ <xsl:element name="字:填充">
+ <xsl:element name="图:图案">
+ <xsl:attribute name="uof:locID">g0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 图形引用 前景色 背景色</xsl:attribute>
+ <xsl:if test=".//@style:text-background-color">
+ <xsl:attribute name="图:前景色"><xsl:value-of select=".//@style:text-background-color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:font-weight or .//@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:font-weight-asian='bold' or .//@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:font-style or .//@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@fo:font-style='italic' or .//@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-crossing-out">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"><xsl:with-param name="lineType" select=".//@style:text-crossing-out"/></xsl:call-template></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-underline">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"><xsl:with-param name="lineType" select=".//@style:text-underline"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:if test=".//@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@style:text-underline-color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:text-shadow and not(.//@fo:text-shadow='none')">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-emphasize">
+ <xsl:element name="字:着重号">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test=".//@style:text-emphasize='none'">
+ <xsl:attribute name="字:字着重号">false</xsl:attribute>
+ <xsl:attribute name="字:类型">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:字着重号">true</xsl:attribute>
+ <xsl:attribute name="字:类型">dot</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test=".//@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@text:display and not(.//@text:display='none')">
+ <xsl:element name="字:隐藏文字">
+ <xsl:attribute name="uof:locID">t0097</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-outline and not(.//@style:text-outline='none')">
+ <xsl:element name="字:空心">
+ <xsl:attribute name="uof:locID">t0098</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select=".//@style:text-outline"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:font-relief and not(.//@style:font-relief='none')">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test=".//@style:font-relief='embossed'">emboss</xsl:when><xsl:when test=".//@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:text-transform or .//@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test=".//@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test=".//@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test=".//@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test=".//@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-position">
+ <xsl:element name="字:位置">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:value-of select=".//@style:text-position"/>
+ </xsl:element>
+ <字:上下标 uof:locID="t0205" uof:attrList="值">
+ <xsl:attribute name="字:值">none</xsl:attribute>
+ </字:上下标>
+ </xsl:if>
+ <xsl:if test=".//@style:text-scale">
+ <xsl:element name="字:缩放">
+ <xsl:attribute name="uof:locID">t0103</xsl:attribute>
+ <xsl:value-of select=".//@style:text-scale"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:letter-spacing">
+ <xsl:element name="字:字符间距">
+ <xsl:attribute name="uof:locID">t0104</xsl:attribute>
+ <xsl:value-of select=".//@fo:letter-spacing"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:letter-kerning">
+ <xsl:element name="字:调整字间距">
+ <xsl:attribute name="uof:locID">t015</xsl:attribute>
+ <xsl:value-of select=".//@style:letter-kerning"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:字符对齐网格">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0106</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="style:presentation-page-layout" mode="pagestyle">
+ <演:页面版式 uof:locID="p0018" uof:attrList="标识符 名称">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="演:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <演:布局 uof:locID="p0129" uof:attrList="类型">
+ <xsl:attribute name="演:类型">
+ <xsl:variable name="layout" select="substring-after(@style:name,'T')"/>
+ <xsl:choose>
+ <xsl:when test="$layout='0'">title-subtitle</xsl:when><xsl:when test="$layout='1'">title-body</xsl:when><xsl:when test="$layout='19'">title-only</xsl:when><xsl:when test="$layout='12'">column-2-rows</xsl:when><xsl:when test="$layout='15'">2-rows-column</xsl:when><xsl:when test="$layout='16'">2-columns-row</xsl:when><xsl:when test="$layout='17'">2-rows</xsl:when><xsl:when test="$layout='18'">4-objects</xsl:when><xsl:when test="$layout='27'">v-2-rows</xsl:when><xsl:when test="$layout='28'">v-title-body</xsl:when><xsl:when test="$layout='29'">big-object</xsl:when><xsl:when test="$layout='30'">2-columns</xsl:when>
+ <xsl:otherwise>title-only</xsl:otherwise>
+ </xsl:choose></xsl:attribute>
+ </演:布局>
+ <xsl:apply-templates select="presentation:placeholder" mode="anchor"/>
+ </演:页面版式>
+ </xsl:template>
+ <xsl:template match="presentation:placeholder" mode="anchor">
+ <演:占位符 uof:locID="p0130" uof:attrList="类型">
+ <xsl:attribute name="演:类型"><xsl:choose><xsl:when test="@presentation:object = 'vertical_outline'">vertical_text</xsl:when><xsl:when test="@presentation:object = 'date-time'">date</xsl:when><xsl:when test="@presentation:object = 'page_number'">number</xsl:when><xsl:otherwise><xsl:value-of select="@presentation:object"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符">
+ <xsl:attribute name="uof:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:图形引用"><xsl:variable name="number"><xsl:value-of select="concat('_',count(preceding-sibling::presentation:placeholder))"/></xsl:variable><xsl:value-of select="concat(parent::style:presentation-page-layout/@style:name,$number)"/></xsl:attribute>
+ </uof:锚点>
+ </演:占位符>
+ </xsl:template>
+ <xsl:template match="presentation:placeholder" mode="graphic">
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象" 图:层次="3">
+ <xsl:attribute name="图:标识符"><xsl:variable name="number"><xsl:value-of select="concat('_',count(preceding-sibling::presentation:placeholder))"/></xsl:variable><xsl:value-of select="concat(parent::style:presentation-page-layout/@style:name,$number)"/></xsl:attribute>
+ </图:图形>
+ </xsl:template>
+ <xsl:template match="office:master-styles">
+ <xsl:apply-templates select="style:handout-master"/>
+ <xsl:apply-templates select="style:master-page"/>
+ <xsl:if test="style:master-page/presentation:notes">
+ <xsl:apply-templates select="style:master-page/presentation:notes"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:handout-master">
+ <演:母版 uof:locID="p0036" uof:attrList="标识符 名称 类型 页面设置引用 配色方案引用 页面版式引用 文本式样引用" 演:名称="handout母版" 演:类型="handout">
+ <xsl:attribute name="演:页面设置引用"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute>
+ <xsl:if test="@draw:style-name">
+ <xsl:attribute name="演:配色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ </演:母版>
+ </xsl:template>
+ <xsl:template match="style:master-page">
+ <演:母版 uof:locID="p0036" uof:attrList="标识符 名称 类型 页面设置引用 配色方案引用 页面版式引用 文本式样引用" 演:名称="slide母版" 演:类型="slide">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="演:页面设置引用"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute>
+ <xsl:if test="@draw:style-name">
+ <xsl:attribute name="演:配色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/*/style:style[@style:name=$stylename]/style:drawing-page-properties">
+ <xsl:if test="@draw:fill and not(@draw:fill='none')">
+ <演:背景 uof:locID="p0057">
+ <xsl:call-template name="填充">
+ <xsl:with-param name="picname" select="$stylename"/>
+ <xsl:with-param name="nodename" select="$name"/>
+ </xsl:call-template>
+ </演:背景>
+ </xsl:if>
+ </xsl:for-each>
+ </演:母版>
+ </xsl:template>
+ <xsl:template match="presentation:notes">
+ <演:母版 uof:locID="p0036" uof:attrList="标识符 名称 类型 页面设置引用 配色方案引用 页面版式引用 文本式样引用" 演:名称="notes母版" 演:类型="notes">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="concat('note-',parent::style:master-page/@style:name)"/></xsl:attribute>
+ <xsl:attribute name="演:页面设置引用"><xsl:value-of select="@style:page-layout-name"/></xsl:attribute>
+ <xsl:if test="@draw:style-name">
+ <xsl:attribute name="演:配色方案引用"><xsl:value-of select="@draw:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ </演:母版>
+ </xsl:template>
+ <xsl:template match="draw:page">
+ <演:幻灯片 uof:locID="p0040" uof:attrList="名称 标识符 母版引用 配色方案引用 页面版式引用 显示 显示背景 显示背景对象">
+ <xsl:attribute name="演:标识符"><xsl:value-of select="concat(@draw:name,'_',@draw:style-name)"/></xsl:attribute>
+ <xsl:attribute name="演:名称"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="演:母版引用"><xsl:value-of select="@draw:master-page-name"/></xsl:attribute>
+ <xsl:if test="@presentation:presentation-page-layout-name">
+ <xsl:attribute name="演:页面版式引用"><xsl:value-of select="@presentation:presentation-page-layout-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="产生锚点"/>
+ <xsl:apply-templates select="presentation:notes" mode="page"/>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/*/style:style[@style:name=$stylename]/style:drawing-page-properties">
+ <xsl:if test="@draw:fill and not(@draw:fill='none')">
+ <演:背景 uof:locID="p0057">
+ <xsl:call-template name="填充">
+ <xsl:with-param name="picname" select="$stylename"/>
+ <xsl:with-param name="nodename" select="$name"/>
+ </xsl:call-template>
+ </演:背景>
+ </xsl:if>
+ </xsl:for-each>
+ <演:切换 uof:locID="p0058" uof:attrList="效果 速度">
+ <xsl:for-each select="key('graphicset',$stylename)/style:drawing-page-properties">
+ <xsl:attribute name="演:速度"><xsl:choose><xsl:when test="@presentation:transition-speed='slow'">slow</xsl:when><xsl:otherwise>fast</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="演:效果"><xsl:variable name="type"><xsl:value-of select="@smil:type"/></xsl:variable><xsl:variable name="subtype"><xsl:value-of select="@smil:subtype"/></xsl:variable><xsl:choose><xsl:when test="$type='irisWipe' and $subtype='rectangle' and @smil:direction='reverse'">box in</xsl:when><xsl:when test="$type='irisWipe' and $subtype='rectangle'">box out</xsl:when><xsl:when test="$type='checkerBoardWipe' and $subtype='across'">checkerboard across</xsl:when><xsl:when test="$type='checkerBoardWipe' and $subtype='down'">checkerboard down</xsl:when><xsl:when test="$type='pushWipe' and $subtype='combHorizontal'">comb horizontal</xsl:when><xsl:when test="$type='pushWipe' and $subtype='combVertical'">comb vertical</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTop' and @smil:direction='reverse'">uncover down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromRight' and @smil:direction='reverse'">uncover left</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromLeft' and @smil:direction='reverse'">uncover right</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottom' and @smil:direction='reverse'">uncover up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopRight' and @smil:direction='reverse'">uncover left-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomRight' and @smil:direction='reverse'">uncover left-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopLeft' and @smil:direction='reverse'">uncover right-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomLeft' and @smil:direction='reverse'">uncover right-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTop'">cover down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromRight'">cover left</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromLeft'">cover right</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottom'">cover up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopRight'">cover left-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomRight'">cover left-up</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromTopLeft'">cover right-down</xsl:when><xsl:when test="$type='slideWipe' and $subtype='fromBottomLeft'">cover right-up</xsl:when><xsl:when test="$type='fade' and $subtype='fadeOverColor'">fade through black</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromTop'">push down</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromRight'">push left</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromLeft'">push right</xsl:when><xsl:when test="$type='pushWipe' and $subtype='fromBottom'">push up</xsl:when><xsl:when test="$type='randomBarWipe' and $subtype='horizontal'">random bars horizontal</xsl:when><xsl:when test="$type='randomBarWipe' and $subtype='vertical'">random bars vertical</xsl:when><xsl:when test="$type='ellipseWipe' and $subtype='circle'">shape circle</xsl:when><xsl:when test="$type='irisWipe' and $subtype='diamond'">shape diamond</xsl:when><xsl:when test="$type='fourBoxWipe' and $subtype='cornersOut'">shape plus</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='horizontal' and @smil:direction='reverse'">split horizontal in</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='horizontal'">split horizontal out</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='vertical' and @smil:direction='reverse'">split vertical in</xsl:when><xsl:when test="$type='barnDoorWipe' and $subtype='vertical'">split vertical out</xsl:when><xsl:when test="$type='fanWipe' and $subtype='centerTop'">wedge</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='oneBlade'">wheel clockwise – 1 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='twoBladeVertical'">wheel clockwise – 2 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='threeBlade'">wheel clockwise – 3 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='fourBlade'">wheel clockwise – 4 spoke</xsl:when><xsl:when test="$type='pinWheelWipe' and $subtype='eightBlade'">wheel clockwise – 8 spoke</xsl:when><xsl:when test="$type='barWipe' and $subtype='leftToRight' and @smil:direction='reverse'">wipe left</xsl:when><xsl:when test="$type='barWipe' and $subtype='leftToRight'">wipe right</xsl:when><xsl:when test="$type='barWipe' and $subtype='topToBottom' and @smil:direction='reverse'">wipe up</xsl:when><xsl:when test="$type='barWipe' and $subtype='topToBottom'">wipe down</xsl:when><xsl:when test="$type='blindsWipe' and $subtype='vertical'">blinds vertical</xsl:when><xsl:when test="$type='blindsWipe' and $subtype='horizontal'">blinds horizontal</xsl:when><xsl:when test="$type='dissolve'">dissolve</xsl:when><xsl:when test="$type='random'">random transition</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <演:声音 uof:locID="p0061" uof:attrList="预定义声音 自定义声音">
+ <xsl:choose>
+ <xsl:when test="not(presentation:sound)">
+ <xsl:attribute name="演:预定义声音">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="lujing">
+ <xsl:value-of select="substring-after(presentation:sound/@xlink:href,'share/gallery/sounds/')"/>
+ </xsl:variable>
+ <xsl:variable name="ming">
+ <xsl:value-of select="substring-before($lujing,'.wav')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$ming='applause'">
+ <xsl:attribute name="演:预定义声音">applause</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$ming='explos'">
+ <xsl:attribute name="演:预定义声音">explosion</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$ming='laser'">
+ <xsl:attribute name="演:预定义声音">laser</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义声音"><xsl:value-of select="presentation:sound/@xlink:href"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:声音>
+ <演:方式 uof:locID="p0062">
+ <演:单击鼠标 uof:locID="p0065">
+ <xsl:choose>
+ <xsl:when test="@presentation:transition-type='automatic'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </演:单击鼠标>
+ <xsl:if test="@presentation:duration">
+ <演:时间间隔 uof:locID="p0066">
+ <xsl:variable name="hms">
+ <xsl:value-of select="substring-after(@presentation:duration,'PT')"/>
+ </xsl:variable>
+ <xsl:variable name="h">
+ <xsl:value-of select="number(substring-before($hms,'H'))"/>
+ </xsl:variable>
+ <xsl:variable name="ms">
+ <xsl:value-of select="substring-after($hms,'H')"/>
+ </xsl:variable>
+ <xsl:variable name="m">
+ <xsl:value-of select="number(substring-before($ms,'M'))"/>
+ </xsl:variable>
+ <xsl:variable name="s">
+ <xsl:value-of select="number(substring-before(substring-after($ms,'M'),'S'))"/>
+ </xsl:variable>
+ <xsl:value-of select="$h *3600 + $m * 60 + $s"/>
+ </演:时间间隔>
+ </xsl:if>
+ </演:方式>
+ </xsl:for-each>
+ </演:切换>
+ </演:幻灯片>
+ </xsl:template>
+ <xsl:template match="presentation:notes" mode="page">
+ <演:幻灯片备注 uof:locID="p0054" uof:attrList="备注母版引用">
+ <xsl:attribute name="演:备注母版引用"><xsl:variable name="cute"><xsl:value-of select="parent::node()/@draw:master-page-name"/></xsl:variable><xsl:value-of select="concat('note-',$cute)"/></xsl:attribute>
+ <xsl:call-template name="产生锚点"/>
+ <演:背景 uof:locID="p0057">
+ <图:颜色 uof:locID="g0034">#ffffff</图:颜色>
+ </演:背景>
+ </演:幻灯片备注>
+ </xsl:template>
+ <xsl:template name="产生锚点">
+ <xsl:for-each select="child::node( )">
+ <xsl:choose>
+ <xsl:when test="substring-before(name(),':')='draw'">
+ <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:variable name="refpicname">
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@presentation:style-name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count(preceding::*[@presentation:style-name=$refpicname])"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="uof:x坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:y坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="@svg:width"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgx"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:width,$uofUnit))"/></xsl:variable><xsl:variable name="maxx"><xsl:call-template name="groupmaxx"><xsl:with-param name="value" select="$svgx + $width"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxx - $minx"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="@svg:height"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgy"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/></xsl:variable><xsl:variable name="height"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:height,$uofUnit))"/></xsl:variable><xsl:variable name="maxy"><xsl:call-template name="groupmaxy"><xsl:with-param name="value" select="$svgy + $height"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxy - $miny"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:图形引用"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:when test="not(@draw:style-name) and name()='draw:g'"><xsl:value-of select="concat(child::node()[1]/@draw:style-name,'_',$picnumber)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:随动方式"><xsl:choose><xsl:when test="key('graphicset',$refpicname)/node()/@style:protect"><xsl:for-each select="key('graphicset',$refpicname)/node()"><xsl:choose><xsl:when test="@style:protect='size'">move</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:for-each></xsl:when><xsl:otherwise>movesize</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="name(.)='draw:page-thumbnail'">
+ <xsl:attribute name="uof:缩略图">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(name(parent::node())='style:handout-master')">
+ <xsl:attribute name="uof:占位符"><xsl:choose><xsl:when test="@presentation:object"><xsl:value-of select="@presentation:object"/></xsl:when><xsl:when test=".//draw:image">graphic</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="@presentation:class">
+ <xsl:attribute name="uof:占位符"><xsl:value-of select="@presentation:class"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </uof:锚点>
+ </xsl:when>
+ <xsl:when test="name()= 'anim:par'">
+ <演:动画 uof:locID="p0042">
+ <xsl:apply-templates select="anim:seq"/>
+ </演:动画>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="anim:seq">
+ <xsl:apply-templates select="anim:par/anim:par/anim:par"/>
+ <xsl:apply-templates select="anim:par/anim:par/anim:iterate"/>
+ </xsl:template>
+ <xsl:template match="anim:par | anim:iterate">
+ <演:序列 uof:locID="p0043" uof:attrList="段落引用 动画对象">
+ <xsl:attribute name="演:动画对象"><xsl:choose>
+ <xsl:when test=".//@smil:targetElement"><xsl:value-of select=".//@smil:targetElement"/></xsl:when><xsl:when test="@anim:id"><xsl:value-of select="@anim:id"/></xsl:when><xsl:otherwise><xsl:value-of select="../@smil:targetElement"/></xsl:otherwise></xsl:choose></xsl:attribute>
+
+ <演:定时 uof:locID="p0067" uof:attrList="事件 延时 速度 重复 回卷">
+ <xsl:attribute name="演:事件">
+ <xsl:choose>
+ <xsl:when test="@presentation:node-type='on-click'">on click</xsl:when>
+ <xsl:when test="@presentation:node-type='with-previous'">with previous</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@presentation:node-type"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="演:延时"><xsl:value-of select="substring-before(@smil:begin,'s')"/></xsl:attribute>
+ <xsl:attribute name="演:速度"><xsl:choose><xsl:when test="anim:animate/@smil:dur='0.5s'">very fast</xsl:when><xsl:when test="anim:animate/@smil:dur='1s'">fast</xsl:when><xsl:when test="anim:animate/@smil:dur='2s'">medium</xsl:when><xsl:when test="anim:animate/@smil:dur='3s'">slow</xsl:when><xsl:when test="anim:animate/@smil:dur='5s'">very slow</xsl:when><xsl:otherwise>medium</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="演:重复"><xsl:choose><xsl:when test="@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="@smil:repeatCount ='2' or @smil:repeatCount ='3' or @smil:repeatCount ='4' or @smil:repeatCount ='5' or @smil:repeatCount ='10' "><xsl:value-of select="@smil:repeatCount"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="演:回卷"><xsl:choose><xsl:when test="@smil:fill='remove'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </演:定时>
+ <演:增强 uof:locID="p0068">
+ <演:动画播放后 uof:locID="p0070" uof:attrList="颜色 变暗 播放后隐藏 单击后隐藏">
+ <xsl:if test="../anim:animateColor">
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="../anim:animateColor">
+ <xsl:attribute name="演:变暗">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:变暗">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@presentation:preset-property='Direction;Accelerate;Decelerate' ">
+ <xsl:attribute name="演:播放后隐藏">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:播放后隐藏">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../anim:set/@smil:to">
+ <xsl:attribute name="演:单击后隐藏">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:单击后隐藏">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:动画播放后>
+ <演:动画文本 uof:locID="p0071" uof:attrList="发送 间隔 动画形状 相反顺序">
+ <xsl:attribute name="演:发送"><xsl:choose><xsl:when test="@anim:iterate-type = 'by-word' ">by word</xsl:when><xsl:when test="@anim:iterate-type = 'by-letter' ">by letter</xsl:when><xsl:otherwise>all at once</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="演:间隔"><xsl:choose><xsl:when test="@anim:iterate-interval"><xsl:value-of select="substring-before(@anim:iterate-interval,'s')"/>
+</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="演:动画形状">false</xsl:attribute>
+ <xsl:attribute name="演:相反顺序">false</xsl:attribute>
+ </演:动画文本>
+ <xsl:if test="anim:audio">
+ <演:声音 uof:locID="p0061" uof:attrList="预定义声音 自定义声音">
+ <xsl:variable name="audioname">
+ <xsl:value-of select="substring-after(anim:audio/@xlink:href,'gallery/sounds/')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not($audioname='')">
+ <xsl:attribute name="演:预定义声音"><xsl:choose><xsl:when test="anim:audio/@xlink:href"><xsl:value-of select="anim:audio/@xlink:href"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义声音"><xsl:value-of select="anim:audio/@xlink:href"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:声音>
+ </xsl:if>
+ </演:增强>
+ <演:效果 uof:locID="p0069">
+ <xsl:choose>
+ <xsl:when test="./@presentation:preset-class = 'entrance'">
+ <演:进入 uof:locID="p0073">
+ <xsl:apply-templates select="@presentation:preset-id"/>
+ </演:进入>
+ </xsl:when>
+ <xsl:when test="./@presentation:preset-class = 'exit'">
+ <演:退出 uof:locID="p0074">
+ <xsl:apply-templates select="@presentation:preset-id"/>
+ </演:退出>
+ </xsl:when>
+ <xsl:when test="./@presentation:preset-class = 'emphasis' ">
+ <演:强调 uof:locID="p0075">
+ <xsl:apply-templates select="@presentation:preset-id"/>
+ </演:强调>
+ </xsl:when>
+ <xsl:otherwise>
+ <演:动作路径 uof:locID="p0133" uof:attrList="路径">
+ <xsl:attribute name="演:路径">
+ <xsl:value-of select="anim:animateMotion/@svg:path"/>
+ </xsl:attribute>
+ </演:动作路径>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:效果>
+ </演:序列>
+ </xsl:template>
+ <xsl:template name="anim_speed">
+ <xsl:param name="speed"/>
+ <xsl:choose>
+ <xsl:when test="$speed='0.5s' or $speed='0.25s'">very fast</xsl:when>
+ <xsl:when test="$speed='1s'">fast</xsl:when>
+ <xsl:when test="$speed='2s'">medium</xsl:when>
+ <xsl:when test="$speed='3s'">slow</xsl:when>
+ <xsl:when test="$speed='5s'">very slow</xsl:when>
+ <xsl:otherwise>medium</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-venetian-blinds']">
+ <演:百叶窗 uof:locID="p0080" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:百叶窗>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-appear']">
+ <演:出现 uof:locID="p0081">
+ </演:出现>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-box']">
+ <演:盒状 uof:locID="p0082" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:盒状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-diagonal-squares']">
+ <演:阶梯状 uof:locID="p0083" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'left-to-bottom' ">left down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'left-to-top' ">left up</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-bottom' ">right down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-top' ">right up</xsl:when></xsl:choose></xsl:attribute>
+ </演:阶梯状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wheel']">
+ <演:轮子 uof:locID="p0084" uof:attrList="速度 辐射状">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:辐射状"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:轮子>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-checkerboard']">
+ <演:棋盘 uof:locID="p0085" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:subtype"/></xsl:attribute>
+ </演:棋盘>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-flash-once']">
+ <演:闪烁一次 uof:locID="p0086" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:set/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:闪烁一次>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-plus']">
+ <演:十字形扩展 uof:locID="p0087" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:十字形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-random']">
+ <演:随机效果 uof:locID="p0088">
+ </演:随机效果>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-circle']">
+ <演:圆形扩展 uof:locID="p0089" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:圆形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wipe']">
+ <演:擦除 uof:locID="p0090" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:擦除>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fly-in']">
+ <演:飞入 uof:locID="p0091" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-right'">from top-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-left'">from top-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-left'">from bottom-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-right'">from bottom-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when></xsl:choose></xsl:attribute>
+ </演:飞入>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fly-in-slow']">
+ <演:缓慢飞入 uof:locID="p0092" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:缓慢飞入>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-diamond']">
+ <演:菱形 uof:locID="p0093" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:菱形>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-split']">
+ <演:劈裂 uof:locID="p0094" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'horizontal-out'">horizontal out</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'horizontal-in'">horizontal in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-in'">vertical in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-out'">vertical out</xsl:when></xsl:choose></xsl:attribute>
+ </演:劈裂>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-peek-in']">
+ <演:切入 uof:locID="p0095" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:切入>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-wedge']">
+ <演:扇形展开 uof:locID="p0096" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:扇形展开>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-random-bars']">
+ <演:随机线条 uof:locID="p0097" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:随机线条>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-dissolve-in']">
+ <演:向内溶解 uof:locID="p0098" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:向内溶解>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-boomerang']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-bounce']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-curve-up']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-falling-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-flip']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-float']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fold']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-glide']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-magnify']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-movie-credits']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-pinwheel']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-breaks']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-sling']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-spiral-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-swivel']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-thread']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-whip']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'oooo-entrance-ascend']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-center-revolve']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-colored-lettering']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-compress']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-descend']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-ease-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-rise-up']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-spin-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-stretchy']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-turn-and-grow']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-unfold']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-colored-lettering']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-expand']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in-and-swivel']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-entrance-fade-in-and-zoom']">
+ <演:其他 uof:locID="p0099">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-fill-color']">
+ <演:更改填充颜色 uof:locID="p0124" uof:attrList="速度 颜色">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateColor/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </演:更改填充颜色>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-color']">
+ <演:更改字体颜色 uof:locID="p0126" uof:attrList="速度 颜色">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateColor/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </演:更改字体颜色>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-grow-and-shrink']">
+ <演:缩放 uof:locID="p0120" uof:attrList="速度 方向 预定义尺寸 自定义尺寸">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animateTransform/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向">horizontal</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="../anim:animateTransform/@smil:to='0.25,1' ">
+ <xsl:attribute name="演:预定义尺寸">tiny</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:animateTransform/@smil:to='0.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">smaller</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:animateTransform/@smil:to='1.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">larger</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:animateTransform/@smil:to='4,1' ">
+ <xsl:attribute name="演:预定义尺寸">huge</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义尺寸"><xsl:choose><xsl:when test="../anim:animateTransform/@smil:to"><xsl:value-of select="../anim:animateTransform/@smil:to"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:缩放>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-size']">
+ <演:更改字号 uof:locID="p0125" uof:attrList="速度 预定义尺寸 自定义尺寸">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='0.25,1' ">
+ <xsl:attribute name="演:预定义尺寸">tiny</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='0.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">smaller</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='1.5,1' ">
+ <xsl:attribute name="演:预定义尺寸">larger</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animate/@smil:to='4,1' ">
+ <xsl:attribute name="演:预定义尺寸">huge</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义尺寸"><xsl:choose><xsl:when test="parent::anim:par/anim:animate/@smil:to"><xsl:value-of select="parent::anim:par/anim:animate/@smil:to"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:更改字号>
+ </xsl:template>
+ <xsl:template name="getfontstyle_emphasis">
+ <xsl:value-of select="concat(@smil:to,' ')"/>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font-style']">
+ <演:更改字形 uof:locID="p0122" uof:attrList="字形 期间">
+ <xsl:attribute name="演:字形"><xsl:variable name="fontstyle"><xsl:for-each select="../anim:set"><xsl:call-template name="getfontstyle_emphasis"/></xsl:for-each></xsl:variable><xsl:value-of select="$fontstyle"/></xsl:attribute>
+ <xsl:attribute name="演:期间"><xsl:choose><xsl:when test="../@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="../@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="../@smil:repeatCount ='2' or ../@smil:repeatCount ='3' or ../@smil:repeatCount ='4' or ../@smil:repeatCount ='5' or ../@smil:repeatCount ='10'"><xsl:value-of select="../@smil:repeatCount"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </演:更改字形>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-line-color']">
+ <演:更改线条颜色 uof:locID="p0121" uof:attrList="速度 颜色">
+ <xsl:attribute name="演:速度">medium</xsl:attribute>
+ <xsl:attribute name="演:颜色"><xsl:value-of select="../anim:animateColor/@smil:to"/></xsl:attribute>
+ </演:更改线条颜色>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-spin']">
+ <演:陀螺旋 uof:locID="p0123" uof:attrList="速度 顺时针方向 预定义角度 自定义角度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:animateTransform/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:顺时针方向">true</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='90'">
+ <xsl:attribute name="演:预定义角度">quarter spin</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='180'">
+ <xsl:attribute name="演:预定义角度">half spin</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='360'">
+ <xsl:attribute name="演:预定义角度">full spin</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::anim:par/anim:animateTransform/@smil:by='720'">
+ <xsl:attribute name="演:预定义角度">two spins</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义角度"><xsl:value-of select="parent::anim:par/anim:animateTransform/@smil:by"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </演:陀螺旋>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-transparency']">
+ <演:透明 uof:locID="p0127" uof:attrList="预定义透明度 自定义透明度 期间">
+ <xsl:choose>
+ <xsl:when test="../anim:set/@smil:to='0.25' ">
+ <xsl:attribute name="演:预定义透明度">25</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:set/@smil:to='0.5' ">
+ <xsl:attribute name="演:预定义透明度">50</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:set/@smil:to='0.75' ">
+ <xsl:attribute name="演:预定义透明度">75</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="../anim:set/@smil:to='1' ">
+ <xsl:attribute name="演:预定义透明度">100</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="演:自定义透明度"><xsl:value-of select="../anim:set/@smil:to"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="演:期间"><xsl:choose><xsl:when test="../@smil:repeatCount = 'indefinite' "><xsl:choose><xsl:when test="../@smil:end='next'">until next click</xsl:when><xsl:otherwise>until next slide</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="../@smil:repeatCount ='2' or ../@smil:repeatCount ='3' or ../@smil:repeatCount ='4' or ../@smil:repeatCount ='5' or ../@smil:repeatCount ='10'"><xsl:value-of select="../@smil:repeatCount"/></xsl:when><xsl:otherwise>until next click</xsl:otherwise></xsl:choose></xsl:attribute>
+ </演:透明>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-font']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-blast']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-blink']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-bold-reveal']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-style-emphasis']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-wave']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-flicker']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-grow-with-color']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-shimmer']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-teeter']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-bold-flash']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-blend']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-over-by-letter']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-color-over-by-word']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-complementary-color']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-complementary-color-2']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-contrasting-color']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-darken']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-desaturate']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-flash-bulb']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-lighten']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-emphasis-reveal-underline']">
+ <演:其他 uof:locID="p0128">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-box']">
+ <演:盒状 uof:locID="p0111" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:盒状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-checkerboard']">
+ <演:棋盘 uof:locID="p0114" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:subtype"/></xsl:attribute>
+ </演:棋盘>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-circle']">
+ <演:圆形扩展 uof:locID="p0109" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:圆形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-crawl-out']">
+ <演:缓慢移出 uof:locID="p0102" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:缓慢移出>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-diagonal-squares']">
+ <演:阶梯状 uof:locID="p0112" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'left-to-bottom' ">left down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'left-to-top' ">left up</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-bottom' ">right down</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'right-to-top' ">right up</xsl:when></xsl:choose></xsl:attribute>
+ </演:阶梯状>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-diamond']">
+ <演:菱形 uof:locID="p0103" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:菱形>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-disappear']">
+ <演:消失 uof:locID="p0118">
+ </演:消失>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-dissolve']">
+ <演:向外溶解 uof:locID="p0108" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:向外溶解>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-flash-once']">
+ <演:闪烁一次 uof:locID="p0115" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:闪烁一次>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fly-out']">
+ <演:飞出 uof:locID="p0101" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-right'">to top-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top-left'">to top-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-left'">to bottom-left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom-right'">to bottom-right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when></xsl:choose></xsl:attribute>
+ </演:飞出>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-peek-out']">
+ <演:切出 uof:locID="p0105" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">to right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">to left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">to top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">to bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:切出>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-plus']">
+ <演:十字形扩展 uof:locID="p0116" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:十字形扩展>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-random-bars']">
+ <演:随机线条 uof:locID="p0107" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:随机线条>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-random']">
+ <演:随机效果 uof:locID="p0117">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:choose><xsl:when test="parent::anim:par/anim:transitionFilter/@smil:dur"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:when><xsl:otherwise><xsl:value-of select="../anim:animate/@smil:dur"/></xsl:otherwise></xsl:choose></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:随机效果>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-split']">
+ <演:劈裂 uof:locID="p0104" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'horizontal-out'">horizontal out</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'horizontal-in'">horizontal in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-in'">vertical in</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'vertical-out'">vertical out</xsl:when></xsl:choose></xsl:attribute>
+ </演:劈裂>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-venetian-blinds']">
+ <演:百叶窗 uof:locID="p0100" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:百叶窗>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wedge']">
+ <演:扇形展开 uof:locID="p0106" uof:attrList="速度">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ </演:扇形展开>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wheel']">
+ <演:轮子 uof:locID="p0113" uof:attrList="速度 轮辐">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:轮辐"><xsl:value-of select="../@presentation:preset-sub-type"/></xsl:attribute>
+ </演:轮子>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-wipe']">
+ <演:擦除 uof:locID="p0110" uof:attrList="速度 方向">
+ <xsl:attribute name="演:速度"><xsl:call-template name="anim_speed"><xsl:with-param name="speed"><xsl:value-of select="parent::anim:par/anim:transitionFilter/@smil:dur"/></xsl:with-param></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="演:方向"><xsl:choose><xsl:when test="../@presentation:preset-sub-type = 'from-right'">from right</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-left'">from left</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-top'">from top</xsl:when><xsl:when test="../@presentation:preset-sub-type = 'from-bottom'">from bottom</xsl:when></xsl:choose></xsl:attribute>
+ </演:擦除>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-boomerang']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-bounce']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-curve-down']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-flip']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-float']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fold']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-glide']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-magnify']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-movie-credits']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-pinwheel']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-breaks']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-sling']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-swish']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-swivel']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-thread']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-whip']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-ascend']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-center-revolve']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-collapse']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-colored-lettering']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-descend']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-ease-out']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-sink-down']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-spin-out']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-stretchy']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-turn-and-grow ']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-unfold']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-zoom']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-contract']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out-and-swivel']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="@presentation:preset-id[. = 'ooo-exit-fade-out-and-zoom']">
+ <演:其他 uof:locID="p0119">
+ <xsl:copy-of select="parent::node()"/>
+ </演:其他>
+ </xsl:template>
+ <xsl:template match="draw:page" mode="styles">
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template match="style:handout-master" mode="styles">
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template match="style:master-page" mode="styles">
+ <xsl:apply-templates select="presentation:notes" mode="styles"/>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template match="presentation:notes" mode="styles">
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template name="creategraphicstyles">
+ <xsl:for-each select="node()">
+ <xsl:variable name="nodename1">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:if test="(substring-before($nodename1,':') = 'draw')">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="$nodename1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="draw">
+ <xsl:param name="nodename1"/>
+ <xsl:choose>
+ <xsl:when test="substring-after($nodename1,':') = 'a'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="substring-after($nodename1,':') = 'g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphic"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:g">
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphic"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:call-template name="creategraphic"/>
+ </xsl:template>
+ <xsl:template name="zuheliebiao">
+ <xsl:param name="allnode"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="../child::*[$pos]">
+ <xsl:for-each select="../child::*[$pos]">
+ <xsl:variable name="nodepos">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name1">
+ <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/>
+ </xsl:variable>
+ <xsl:variable name="allnode1">
+ <xsl:value-of select="concat($allnode,',',$pic-name1)"/>
+ </xsl:variable>
+ <xsl:call-template name="zuheliebiao">
+ <xsl:with-param name="allnode" select="$allnode1"/>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$allnode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="creategraphic">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@draw:style-name or name()='draw:g'">
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="@presentation:style-name">
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@presentation:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@presentation:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@presentation:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="pic-process">
+ <xsl:param name="pic-name"/>
+ <xsl:param name="nodename"/>
+ <xsl:param name="picnumber"/>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:when test="not(@draw:style-name) and name()='draw:g'"><xsl:value-of select="concat(child::node()[1]/@draw:style-name,'-',$picnumber)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise>
+ </xsl:choose></xsl:attribute>
+ <xsl:if test="$nodename='draw:g'">
+ <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//office:binary-data">
+ <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="arrow-sign">
+ <xsl:choose>
+ <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:value-of select="'1'"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:page-thumbnail' or $nodename='draw:frame' or $nodename='draw:path'or $nodename='draw:g'">
+ <图:预定义图形 uof:locID="g0005">
+ <图:类别 uof:locID="g0006">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">11</xsl:when>
+ <xsl:when test="$nodename='draw:line'">61</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">19</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">65</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">66</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">19</xsl:when>
+ <xsl:when test="$nodename='draw:page-thumbnail'">67</xsl:when>
+ <xsl:when test="$nodename='draw:frame'">3</xsl:when>
+ <xsl:when test="$nodename='draw:path'">64</xsl:when>
+ <xsl:when test="$nodename='draw:g'">4</xsl:when>
+ </xsl:choose>
+ </图:类别>
+ <图:名称 uof:locID="g0007">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when>
+ <xsl:when test="$nodename='draw:line'">Line</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:page-thumbnail'">缩略图</xsl:when>
+ <xsl:when test="$nodename='draw:frame'">文本框</xsl:when>
+ <xsl:when test="$nodename='draw:path'">Curve</xsl:when>
+ <xsl:when test="$nodename='draw:g'">group</xsl:when>
+ </xsl:choose>
+ </图:名称>
+ <图:生成软件 uof:locID="g0008">PNG</图:生成软件>
+ <xsl:if test="./@draw:points or ./@svg:d">
+ <图:关键点坐标 uof:locID="g0009" uofattrList="路径">
+ <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute>
+ </图:关键点坐标>
+ </xsl:if>
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/*/style:style[@style:name=$pic-name]) ">
+ <xsl:for-each select="style:graphic-properties">
+ <xsl:if test="not(@draw:fill='none')">
+ <图:填充 uof:locID="g0012">
+ <xsl:call-template name="填充">
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picname" select="$pic-name"/>
+ </xsl:call-template>
+ </图:填充>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <图:线颜色 uof:locID="g0013">
+ <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/>
+ </图:线颜色>
+ </xsl:if>
+ <图:线型 uof:locID="g0014">
+ <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/>
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@draw:stroke)">
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@svg:stroke-width)">single</xsl:when>
+ <xsl:otherwise>thick</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:stroke = 'none'">none</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$linetype='Fine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dash-long-heavy</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed'">dash-long</xsl:when>
+ <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash' and style:graphic-properties/@svg:stroke-width">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dashed-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'and style:graphic-properties/@svg:stroke-width">dotted-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'">dotted</xsl:when>
+ <xsl:when test="$linetype='Line_20_with_20_Fine_20_Dots'">double</xsl:when>
+ <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_' and style:graphic-properties/@svg:stroke-width">dash-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_'">dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'and style:graphic-properties/@svg:stroke-width">wavy-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'">wave</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed_20__28_var_29_'">wavy-double</xsl:when>
+ <xsl:otherwise>dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:线型>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <图:线粗细 uof:locID="g0016">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/>
+ </图:线粗细>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)&gt;0">
+ <图:前端箭头 uof:locID="g0017">
+ <图:式样 uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Line_20_Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow_20_concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Square_20_45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:式样>
+ <xsl:if test="style:graphic-properties/@draw:marker-start-width">
+ <图:大小 uof:locID="g0019">
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大小>
+ </xsl:if>
+ </图:前端箭头>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-end">
+ <图:后端箭头 uof:locID="g0020">
+ <图:式样 uof:locID="g0021">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Line_20_Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow_20_concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Square_20_45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:式样>
+ <xsl:if test="style:graphic-properties/@draw:marker-end-width">
+ <图:大小 uof:locID="g0022">
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大小>
+ </xsl:if>
+ </图:后端箭头>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:opacity or style:graphic-properties/@svg:stroke-opacity or style:graphic-properties/@svg:stroke-opacity">
+ <图:透明度 uof:locID="g0038">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:opacity">
+ <xsl:variable name="transparency">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:opacity,'%')"/>
+ </xsl:variable>
+ <xsl:value-of select="(100 - $transparency) div 100"/>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@svg:stroke-opacity">
+ <xsl:variable name="transparency">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-opacity,'%')"/>
+ </xsl:variable>
+ <xsl:value-of select="(100 - $transparency) div 100"/>
+ </xsl:when>
+ <xsl:when test="style:properties/@svg:stroke-opacity">
+ <xsl:value-of select="substring-before(style:properties/@svg:stroke-opacity,'%')"/>
+ </xsl:when>
+ </xsl:choose>
+ </图:透明度>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打印对象 uof:locID="g0032">true</图:打印对象>
+ <图:Web文字 uof:locID="g0033"/>
+ </图:属性>
+ </图:预定义图形>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="./text:p or ./draw:text-box">
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接">
+ <xsl:if test="$nodename='draw:text-box'">
+ <xsl:attribute name="图:文本框">true</xsl:attribute>
+ <xsl:if test="./@draw:name = /office:document/office:body
+//draw:text-box/@draw:chain-next-name">
+ <xsl:attribute name="图:前一链接"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./@draw:chain-next-name">
+ <xsl:attribute name="图:后一链接"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@fo:padding-left">
+ <xsl:attribute name="图:左边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:右边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:上边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:下边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:文字排列方向">
+ <xsl:choose>
+ <xsl:when test="style:paragraph-properties/@style:writing-mode">
+ <xsl:choose>
+ <xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl' and style:graphic-properties/@draw:textarea-vertical-align='bottom'">vert-l2r</xsl:when>
+ <xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when>
+ <xsl:otherwise>hori-l2r</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="style:graphic-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动换行">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true'">
+ <xsl:attribute name="图:大小适应文字">true</xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="./draw:text-box">
+ <xsl:for-each select="draw:text-box/node( )">
+ <xsl:choose>
+ <xsl:when test="name()='text:list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="number('1')"/>
+ <xsl:with-param name="liststylename" select="@text:style-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='text:p'or name()='text:h'">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="./text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </图:文本内容>
+ </xsl:if>
+ <图:控制点 uof:locID="g0003" uof:attrList="x坐标 y坐标">
+ <xsl:attribute name="图:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ </图:控制点>
+ <图:翻转 uof:locID="g0040" uof:attrList="方向" 图:方向="x"/>
+ </图:图形>
+ <xsl:if test="name(..)='draw:g'">
+ <图:组合位置 uof:locID="g0041" uof:attrList="x坐标 y坐标">
+ <xsl:attribute name="图:x坐标"><xsl:variable name="minx"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-minx - $minx"/></xsl:when><xsl:otherwise><xsl:variable name="current-x" select="number(substring-before(@svg:x,$uofUnit))"/><xsl:value-of select="$current-x - $minx"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:y坐标"><xsl:variable name="miny"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-miny - $miny"/></xsl:when><xsl:otherwise><xsl:variable name="current-y" select="number(substring-before(@svg:y,$uofUnit))"/><xsl:value-of select="$current-y - $miny"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:组合位置>
+ </xsl:if>
+ <xsl:if test="name()='draw:frame' and ./draw:image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:if test="./draw:image/office:binary-data">
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="./draw:image/office:binary-data"/>
+ </uof:数据>
+ </xsl:if>
+ <xsl:if test="./draw:image/@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="./draw:image/@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name and @draw:fill='bitmap'">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:choose><xsl:when test="@draw:id"><xsl:value-of select="@draw:id"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">jpg</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="fill-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <uof:数据 uof:locID="u0037">
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]">
+ <xsl:value-of select="office:binary-data"/>
+ </xsl:for-each>
+ </uof:数据>
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="unordered-ordered-list">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <xsl:for-each select="text:list-item">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="node( )">
+ <xsl:if test="name()='text:list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl +1"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="groupminx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupminy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="svgx">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgx + $width"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="svgy">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:height,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgy + $height"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:points">
+ <xsl:param name="point"/>
+ <xsl:param name="lujing"/>
+ <xsl:choose>
+ <xsl:when test="contains($point,' ' )">
+ <xsl:variable name="first-point" select="substring-before($point,' ')"/>
+ <xsl:variable name="other-point" select="substring-after($point,' ')"/>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="$other-point"/>
+ <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="execParagraph">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <xsl:if test="@text:id">
+ <xsl:attribute name="字:动画标识"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:choose><xsl:when test="@text:id"><xsl:value-of select="@text:id"/></xsl:when><xsl:otherwise><xsl:value-of select="@text:style-name"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="not(number($currlistlvl) =number('0'))">
+ <xsl:variable name="parent-position">
+ <xsl:number from="/office:document/office:body/text:ordered-list" level="any" count="text:list-item/text:p" format="1"/>
+ </xsl:variable>
+ <xsl:element name="字:自动编号信息">
+ <xsl:attribute name="uof:locID">t0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">编号引用 编号级别 重新编号 起始编号</xsl:attribute>
+ <xsl:attribute name="字:编号引用"><xsl:value-of select="$liststylename"/></xsl:attribute>
+ <xsl:attribute name="字:编号级别"><xsl:value-of select="$currlistlvl"/></xsl:attribute>
+ <xsl:attribute name="字:重新编号"><xsl:choose><xsl:when test="number($parent-position)=number('1')">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:起始编号"><xsl:for-each select="//text:list-style[$liststylename=@style:name]/*[number($currlistlvl)=number(@text:level)]"><xsl:choose><xsl:when test="@text:start-value"><xsl:value-of select="@text:start-value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:for-each></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="(//style:style[@style:name=$stylename])">
+ <xsl:call-template name="ParaAttribute">
+ <xsl:with-param name="text-style-name" select="@text:style-name"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="self::node( )[name(.)='text:span']">
+ <xsl:call-template name="textspan"/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:time']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:s']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="substring-before(name(.),':')='draw' and not(name(.)='draw:a')">
+ </xsl:when>
+ <xsl:when test="name(.)='text:a'">
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <字:字体 uof:locID="t0088" uof:attrList="西文字体引用 中文字体引用 字号 颜色" 字:颜色="#0000ff"/>
+ <字:下划线 uof:locID="t0095" 字:类型="single" 字:颜色="#0000ff" uof:attrList="类型 颜色 字下划线"/>
+ </xsl:element>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Hyperlink</xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ </xsl:element>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ <xsl:element name="字:区域结束">
+ <xsl:attribute name="字:标识符引用">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="字:句"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </字:段落>
+ </xsl:template>
+ <xsl:template name="字:句">
+ <xsl:if test="not(name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data')">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用">
+ <xsl:choose>
+ <xsl:when test="@text:style-name">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:句属性>
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::text:bookmark-start) and (following-sibling::text:bookmark-end)">
+ <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark-start/@text:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="following-sibling::text:bookmark-end/@text:name"/></xsl:attribute>
+ </字:区域结束>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::text:bookmark">
+ <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark/@text:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="preceding-sibling::text:bookmark/@text:name"/></xsl:attribute>
+ </字:区域结束>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </xsl:when>
+ <xsl:when test="name(.)='draw:a'">
+ <xsl:variable name="link-name">
+ <xsl:value-of select="substring-after(@xlink:href,'#')"/>
+ </xsl:variable>
+ <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="$link-name"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="$link-name"/></xsl:attribute>
+ </字:区域结束>
+ </xsl:when>
+ <xsl:when test="self::node( )[name(.)='text:tab-stop']">
+ <xsl:element name="字:制表符">
+ <xsl:attribute name="uof:locID">t0123</xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data'">
+ </xsl:when>
+ <xsl:otherwise>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:句>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="jiaozhu">
+ <字:脚注 uof:locID="t0107" uof:attrList="引文体">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </字:脚注>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:variable name="count">
+ <xsl:choose>
+ <xsl:when test="not(@text:c)">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@text:c+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <字:句 uof:locID="t0085">
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="weizhu">
+ <字:尾注 uof:locID="t0108" uof:attrList="引文体">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </字:尾注>
+ </xsl:template>
+ <xsl:template match="text:time">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'TIME'"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <字:段落 uof:locID="t0051">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="timefmt">
+ <xsl:variable name="aa" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">AMPM</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="concat('TIME \@ ',$quote,$timefmt,$quote,' \* MERGEFORMAT ')"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ParaAttribute">
+ <xsl:param name="text-style-name"/>
+ <xsl:for-each select="/office:document/office:styles/style:style">
+ <xsl:if test="@style:name=$text-style-name and not($text-style-name='Standard')">
+ <xsl:element name="字:格式修订">
+ <xsl:attribute name="uof:locID">t0053</xsl:attribute>
+ <xsl:attribute name="uof:attrList">修订信息引用</xsl:attribute>
+ <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="@style:name='Heading'">
+ <xsl:element name="字:大纲级别">
+ <xsl:attribute name="uof:locID">t0054</xsl:attribute>
+ <xsl:value-of select="substring-after(@style:name,'Heading')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:text-align or .//@style:vertical-align">
+ <xsl:element name="字:对齐">
+ <xsl:attribute name="uof:locID">t0055</xsl:attribute>
+ <xsl:attribute name="uof:attrList">水平对齐 文字对齐</xsl:attribute>
+ <xsl:attribute name="字:水平对齐"><xsl:choose><xsl:when test=".//@fo:text-align='end'">right</xsl:when><xsl:when test=".//@fo:text-align='center'">center</xsl:when><xsl:when test=".//@fo:text-align='justify' and not(.//@fo:text-align-last='justify')">justified</xsl:when><xsl:when test=".//@fo:text-align='justify' and .//@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:文字对齐"><xsl:choose><xsl:when test=".//@style:vertical-align='baseline'">base</xsl:when><xsl:when test=".//@style:vertical-align='top'">top</xsl:when><xsl:when test=".//@style:vertical-align='middle'">center</xsl:when><xsl:when test=".//@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:margin-left or .//@fo:margin-right or .//@fo:text-indent">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0056</xsl:attribute>
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:行距">
+ <xsl:attribute name="uof:locID">t0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 值</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(.//@fo:line-height,$uofUnit)">
+ <xsl:attribute name="字:类型">fixed</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:line-height,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(.//@fo:line-height,'%')">
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:line-height,'%') div 100"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test=".//@style:line-height-at-least">
+ <xsl:attribute name="字:类型">at-least</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@style:line-height-at-least,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test=".//@style:line-spacing">
+ <xsl:attribute name="字:类型">line-space</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@style:line-spacing,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值">1.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test=".//@fo:orphans">
+ <xsl:element name="字:孤行控制">
+ <xsl:attribute name="uof:locID">t0060</xsl:attribute>
+ <xsl:value-of select=".//@fo:orphans"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:widows">
+ <xsl:element name="字:寡行控制">
+ <xsl:attribute name="uof:locID">t0061</xsl:attribute>
+ <xsl:value-of select=".//@fo:widows"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:break-inside">
+ <xsl:element name="字:段中不分页">
+ <xsl:attribute name="uof:locID">t0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:keep-with-next">
+ <xsl:element name="字:与下段同页">
+ <xsl:attribute name="uof:locID">t0063</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:break-before">
+ <xsl:element name="字:段前分页">
+ <xsl:attribute name="uof:locID">t0064</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:snap-to-layout-grid">
+ <xsl:element name="字:对齐网格">
+ <xsl:attribute name="uof:locID">t0069</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:snap-to-layout-grid='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap">
+ <xsl:element name="字:首字下沉">
+ <xsl:attribute name="uof:locID">t0070</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 字体引用 字符数 行数 间距</xsl:attribute>
+ <xsl:attribute name="字:类型">dropped</xsl:attribute>
+ <xsl:if test=".//style:drop-cap/@style:style-name">
+ <xsl:attribute name="字:字体引用"><xsl:value-of select=".//style:drop-cap/@style:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap/@style:distance">
+ <xsl:attribute name="字:间距"><xsl:value-of select="substring-before(.//style:drop-cap/@style:distance,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap/@style:length">
+ <xsl:attribute name="字:字符数"><xsl:value-of select=".//style:drop-cap/@style:length"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//style:drop-cap/@style:lines">
+ <xsl:attribute name="字:行数"><xsl:value-of select=".//style:drop-cap/@style:lines"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:hyphenate">
+ <xsl:element name="字:取消断字">
+ <xsl:attribute name="uof:locID">t0071</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select=".//@fo:hyphenate"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@text:number-lines">
+ <xsl:element name="字:取消行号">
+ <xsl:attribute name="字:值"><xsl:value-of select=".//@text:number-lines"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0072</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:允许单词断字">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0073</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test=".//@style:punctuation-wrap">
+ <xsl:element name="字:行首尾标点控制">
+ <xsl:attribute name="uof:locID">t0074</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:punctuation-wrap='hanging'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:是否行首标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ </xsl:element>
+ <xsl:if test=".//@style:line-break ">
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:line-break='strict'">true</xsl:when><xsl:when test=".//@style:line-break='normal'">false</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-autospace">
+ <xsl:element name="字:自动调整中英文字符间距">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:text-autospace='ideograph-alpha'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0077</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@style:text-autospace">
+ <xsl:element name="字:自动调整中文与数字间距">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test=".//@style:text-autospace='ideograph-alpha'">true </xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0078</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:有网格自动调整右缩进">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0195</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test=".//@fo:border or .//@fo:border-top or .//@fo:border-bottom or .//@fo:border-left or .//@fo:border-right or .//@style:shadow[.!='none']">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0065</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:background-color">
+ <xsl:element name="字:填充">
+ <xsl:attribute name="uof:locID">t0066</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test=".//@fo:margin-top or .//@fo:margin-bottom">
+ <字:段间距 uof:locID="t0058">
+ <xsl:if test=".//@fo:margin-top">
+ <字:段前距 uof:locID="t0196">
+ <字:绝对值 uof:locID="t0199" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ </字:绝对值>
+ </字:段前距>
+ </xsl:if>
+ <xsl:if test=".//@fo:margin-bottom">
+ <字:段后距 uof:locID="t0196">
+ <字:绝对值 uof:locID="t0202" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(.//@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </字:绝对值>
+ </字:段后距>
+ </xsl:if>
+ </字:段间距>
+ </xsl:if>
+ <xsl:if test=".//style:tab-stops">
+ <xsl:element name="字:制表位设置">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:for-each select=".//style:tab-stops/style:tab-stop">
+ <xsl:element name="字:制表位">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">位置 类型 前导符</xsl:attribute>
+ <xsl:attribute name="字:位置"><xsl:value-of select="@style:position"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@style:type"/>
+ </xsl:variable>
+ <xsl:variable name="zbflx">
+ <xsl:choose>
+ <xsl:when test="$aa='right'">right</xsl:when>
+ <xsl:when test="$aa='center'">center</xsl:when>
+ <xsl:when test="$aa='char'and @style:char!=''">decimal</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="字:类型"><xsl:value-of select="$zbflx"/></xsl:attribute>
+ <xsl:if test="$zbflx='decimal'">
+ <xsl:attribute name="字:制表位字符"><xsl:value-of select="@style:char"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:leader-char">
+ <xsl:attribute name="字:前导符"><xsl:value-of select="@style:leader-char"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="textspan">
+ <字:句 uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="./text:footnote">
+ <xsl:call-template name="jiaozhu"/>
+ </xsl:when>
+ <xsl:when test="./text:endnote">
+ <xsl:call-template name="weizhu"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:variable name="textstyle">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle and not(@style:parent-style-name='Standard')">
+ <xsl:if test="@style:parent-style-name=/office:document/office:styles/style:style/@style:name">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:parent-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:句>
+ </xsl:template>
+ <xsl:template name="SentenceXD">
+ <xsl:param name="Sentencestyle"/>
+ <xsl:element name="字:格式修订">
+ <xsl:attribute name="uof:locID">t0087</xsl:attribute>
+ <xsl:attribute name="uof:attrList">修订信息引用</xsl:attribute>
+ <xsl:attribute name="字:修订信息引用"><xsl:value-of select="$Sentencestyle"/></xsl:attribute>
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="$Sentencestyle"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="add-space">
+ <xsl:param name="number"/>
+ <xsl:if test="$number &gt; 1">
+ <xsl:call-template name="add-space">
+ <xsl:with-param name="number" select="$number - 1"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="office:styles | office:automatic-styles" mode="style">
+ <xsl:for-each select="style:style[@style:family= 'paragraph' or @style:family= 'text']">
+ <xsl:choose>
+ <xsl:when test="@style:family = 'text'">
+ <xsl:call-template name="句式样"/>
+ </xsl:when>
+ <xsl:when test="@style:family = 'paragraph'">
+ <xsl:call-template name="段落式样"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="段落式样">
+ <xsl:element name="uof:段落式样">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute>
+ <xsl:variable name="count"><xsl:value-of select="count(preceding::style:style)"/></xsl:variable>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat(@style:name,$count)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">default</xsl:attribute>
+ <xsl:attribute name="字:基式样引用"><xsl:variable name="stylename" select="@style:name"/><xsl:variable name="frame-parent"><xsl:choose><xsl:when test="/office:document/office:master-styles/style:master-page/draw:frame[draw:text-box//text:p/@text:style-name = $stylename]"><xsl:for-each select="/office:document/office:master-styles/style:master-page/draw:frame[draw:text-box//text:p/@text:style-name = $stylename][1]"><xsl:variable name="frame-style" select="@presentation:style-name"/><xsl:value-of select="/office:document/*/style:style[@style:name=$frame-style]/@style:parent-style-name"/></xsl:for-each></xsl:when><xsl:otherwise>not-master</xsl:otherwise></xsl:choose></xsl:variable><xsl:choose><xsl:when test="@style:parent-style-name"><xsl:value-of select="@style:parent-style-name"/></xsl:when><xsl:when test="not($frame-parent='not-master')"><xsl:value-of select="$frame-parent"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ <xsl:for-each select="style:text-properties">
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="style:paragraph-properties">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0056</xsl:attribute>
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:element>
+ <xsl:if test="@fo:text-align | @fotext-align-last">
+ <xsl:element name="字:对齐">
+ <xsl:attribute name="uof:locID">t0055</xsl:attribute>
+ <xsl:if test="@fo:text-align">
+ <xsl:attribute name="字:水平对齐"><xsl:choose><xsl:when test=".//@fo:text-align='end'">right</xsl:when><xsl:when test=".//@fo:text-align='center'">center</xsl:when><xsl:when test=".//@fo:text-align='justify' and not(.//@fo:text-align-last='justify')">justified</xsl:when><xsl:when test=".//@fo:text-align='justify' and .//@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:vertical-align">
+ <xsl:attribute name="字:文字对齐"><xsl:choose><xsl:when test=".//@style:vertical-align='baseline'">base</xsl:when><xsl:when test=".//@style:vertical-align='top'">top</xsl:when><xsl:when test=".//@style:vertical-align='middle'">center</xsl:when><xsl:when test=".//@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:attrList">水平对齐 文字对齐</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="句式样">
+ <xsl:element name="uof:句式样">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="style:text-properties">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute>
+ <xsl:if test=".//@fo:font-size or .//@style:font-size-asian or .//@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(.//@fo:font-size,'%') or contains(.//@style:font-size-asian,'%')">
+ <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'%')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:字号"><xsl:choose><xsl:when test=".//@fo:font-size"><xsl:value-of select="substring-before(.//@fo:font-size,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-asian"><xsl:value-of select="substring-before(.//@style:font-size-asian,'pt')"/></xsl:when><xsl:when test=".//@style:font-size-complex"><xsl:value-of select="substring-before(.//@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select=".//@style:font-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select=".//@style:font-name-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select=".//@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="(@fo:font-weight='bold') or (@fo:font-weight-asian='bold') or (@style:font-weight-asian='bold') or (@style:font-weight-complex='bold')">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="字:值">1</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="(@style:font-style-asian='italic') or (@style:font-style-complex='italic') or (@fo:font-style-asian='italic') or (@fo:font-style='italic')">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="字:值">1</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:page-layout">
+ <xsl:element name="演:页面设置">
+ <xsl:attribute name="uof:locID">p0002</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称</xsl:attribute>
+ <xsl:attribute name="演:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="演:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="演:名称">页面设置</xsl:attribute>
+ <xsl:element name="演:纸张">
+ <xsl:attribute name="uof:locID">p0003</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 高度 纸型</xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="style:page-layout-properties/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="style:page-layout-properties/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$height='29.7cm' and $width='42cm'">A3</xsl:when><xsl:when test="$height='21cm' and $width='29.7cm'">A4</xsl:when><xsl:when test="$height='14.8cm' and $width='21cm'">A5</xsl:when><xsl:when test="$height='25cm' and $width='35.3cm'">B4</xsl:when><xsl:when test="$height='17.6cm' and $width='25cm'">B5</xsl:when><xsl:when test="$height='12.5cm' and $width='17.6cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="演:页边距">
+ <xsl:attribute name="uof:locID">p0004</xsl:attribute>
+ <xsl:attribute name="uof:attrList">左 上 右 下</xsl:attribute>
+ <xsl:attribute name="uof:左"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:上"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:右"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:下"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ <xsl:variable name="PageNumberFormat">
+ <xsl:value-of select="/office:document/office:settings/config:config-item-set/config:config-item[@config:name='PageNumberFormat']"/>
+ </xsl:variable>
+ <xsl:if test="not($PageNumberFormat='5')">
+ <xsl:element name="演:页码格式">
+ <xsl:attribute name="uof:locID">p0005</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$PageNumberFormat='0'">upper-letter</xsl:when>
+ <xsl:when test="$PageNumberFormat='1'">lower-letter</xsl:when>
+ <xsl:when test="$PageNumberFormat='2'">upper-roman</xsl:when>
+ <xsl:when test="$PageNumberFormat='3'">lower-letter</xsl:when>
+ <xsl:when test="$PageNumberFormat='4'">decimal</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="演:纸张方向">
+ <xsl:attribute name="uof:locID">p0006</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:page-layout-properties/@style:print-orientation">
+ <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
+ </xsl:when>
+ <xsl:otherwise>portrait</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="obtain_anim_type">
+ <xsl:param name="flytype"/>
+ <xsl:variable name="flytypestr" select="substring-after($flytype,'from-')"/>
+ <xsl:choose>
+ <xsl:when test="contains($flytypestr,'-')">
+ <xsl:value-of select="concat(substring-before($flytypestr,'-'),substring-after($flytypestr,'-'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$flytypestr"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="cm2pt">
+ <xsl:param name="cmval"/>
+ <xsl:value-of select="substring-before($cmval,$uofUnit)* $cm-to-other "/>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <uof:字体集 uof:locID="u0040">
+ <uof:默认字体 uof:ascii="Times New Roman" uof:fareast="宋体" uof:h-ansi="宋体" uof:cs="宋体"/>
+ <xsl:for-each select="style:font-face">
+ <xsl:element name="uof:字体声明">
+ <xsl:attribute name="uof:attrList">标识符 名称 字体族</xsl:attribute>
+ <xsl:attribute name="uof:locID">u0041</xsl:attribute>
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="uof:字体族"><xsl:value-of select="@svg:font-family"/></xsl:attribute>
+ <xsl:if test="@style:font-charset= '02'">
+ <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-family-generic">
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <xsl:attribute name="uof:字体族">Swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='modern'">
+ <xsl:attribute name="uof:字符集">Modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic='roman'">
+ <xsl:attribute name="uof:字符集">Roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='script'">
+ <xsl:attribute name="uof:字符集">Script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='decorative'">
+ <xsl:attribute name="uof:字符集">Decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='system'">
+ <xsl:attribute name="uof:字符集">System</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:字符集">System</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="style:font-decl"/>
+ </uof:字体集>
+ </xsl:template>
+ <xsl:template match="office:meta">
+ <uof:元数据 uof:locID="u0001">
+ <uof:标题 uof:locID="u0002">
+ <xsl:value-of select="dc:title"/>
+ </uof:标题>
+ <uof:创建应用程序 uof:locID="u0011">
+ <xsl:value-of select="meta:generator"/>
+ </uof:创建应用程序>
+ <uof:摘要 uof:locID="u0007">
+ <xsl:value-of select="dc:description"/>
+ </uof:摘要>
+ <uof:主题 uof:locID="u0003">
+ <xsl:value-of select="dc:subject"/>
+ </uof:主题>
+ <uof:创建者 uof:locID="u0004"/>
+ <uof:作者 uof:locID="u0005">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:作者>
+ <uof:创建日期 uof:locID="u0008">
+ <xsl:value-of select="meta:creation-date"/>
+ </uof:创建日期>
+ <uof:最后作者 uof:locID="u0006">
+ <xsl:value-of select="dc:creator"/>
+ </uof:最后作者>
+ <uof:关键字集 uof:locID="u0014">
+ <xsl:for-each select=".">
+ <uof:关键字 uof:locID="u0015">
+ <xsl:value-of select="meta:keywords/@meta:keyword"/>
+ </uof:关键字>
+ </xsl:for-each>
+ </uof:关键字集>
+ <uof:编辑次数 uof:locID="u0009">
+ <xsl:value-of select="meta:editing-cycles"/>
+ </uof:编辑次数>
+ <xsl:if test="meta:editing-duration">
+ <uof:编辑时间 uof:locID="u0010">
+ <xsl:value-of select="meta:editing-duration"/>
+ </uof:编辑时间>
+ </xsl:if>
+ <xsl:if test="meta:template/@xlink:href">
+ <uof:文档模板 uof:locID="u0013">
+ <xsl:value-of select="meta:template/@xlink:href"/>
+ </uof:文档模板>
+ </xsl:if>
+ <xsl:if test="meta:user-defined/@meta:name">
+ <uof:用户自定义元数据集 uof:locID="u0016">
+ <xsl:for-each select="meta:user-defined">
+ <uof:用户自定义元数据 uof:locID="u0017" uof:attrList="名称 类型">
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@meta:name"/></xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute>
+ </uof:用户自定义元数据>
+ </xsl:for-each>
+ </uof:用户自定义元数据集>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:page-count">
+ <uof:页数 uof:locID="u0020">
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </uof:页数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:paragraph-count">
+ <uof:段落数 uof:locID="u0025">
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </uof:段落数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:object-count">
+ <uof:对象数 uof:locID="u0026">
+ <xsl:value-of select="meta:document-statistic/@meta:object-count"/>
+ </uof:对象数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count">
+ <uof:字数 uof:locID="u0021">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </uof:字数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:word-count">
+ <uof:中文字符数 uof:locID="u0023">
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </uof:中文字符数>
+ </xsl:if>
+ </uof:元数据>
+ </xsl:template>
+ <xsl:template name="填充">
+ <xsl:param name="picname"/>
+ <xsl:param name="nodename"/>
+ <xsl:choose>
+ <xsl:when test="@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:渐变>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@draw:fill='bitmap'">
+ <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称">
+ <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(@style:repeat)">title</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="@style:repeat = 'repeat'">title</xsl:when><xsl:when test="@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="@draw:fill-image-name"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:名称"><xsl:value-of select="concat($picname,'_b1')"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色">
+ <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ <xsl:attribute name="图:图形引用"/>
+ <xsl:attribute name="图:前景色"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="@draw:fill-color"><xsl:value-of select="@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:frame'">
+ <xsl:if test="@draw:fill='solid'">
+ <图:颜色 uof:locID="g0034">
+ <xsl:value-of select="@draw:fill-color"/>
+ </图:颜色>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="@draw:fill-color">
+ <xsl:value-of select="@draw:fill-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:缩进类型">
+ <xsl:if test="style:list-level-properties/@text:space-before">
+ <字:左 uof:locID="t0182">
+ <字:绝对 uof:locID="t0185" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:space-before,$uofUnit)"/></xsl:attribute>
+ </字:绝对>
+ </字:左>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@text:min-label-width">
+ <字:右 uof:locID="t0183">
+ <字:绝对 uof:locID="t0187" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/></xsl:attribute>
+ </字:绝对>
+ </字:右>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@text:min-label-distance">
+ <字:首行 uof:locID="t0184">
+ <字:绝对 uof:locID="t0189" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-distance,$uofUnit)"/></xsl:attribute>
+ </字:绝对>
+ </字:首行>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:线型类型">
+ <xsl:param name="lineType"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='single-line'">single</xsl:when>
+ <xsl:when test="$lineType='double-line'">double</xsl:when>
+ <xsl:when test="$lineType='single'">single</xsl:when>
+ <xsl:when test="$lineType='double'">double</xsl:when>
+ <xsl:when test="$lineType='dash'">dash</xsl:when>
+ <xsl:when test="$lineType='long-dash'">dash-long</xsl:when>
+ <xsl:when test="$lineType='dot-dash'">dot-dash</xsl:when>
+ <xsl:when test="$lineType='dot-dot-dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$lineType='wave'">wave</xsl:when>
+ <xsl:when test="$lineType='bold-dotted'">dotted-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-dash'">dashed-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-long-dash'">dash-long-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-dot-dash'">dash-dot-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-dot-dot-dash'">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$lineType='bold-wave'">wavy-heavy</xsl:when>
+ <xsl:when test="$lineType='double-wave'">wavy-double</xsl:when>
+ <xsl:when test="$lineType='bold'">bold</xsl:when>
+ <xsl:when test="$lineType='small-wave'">wave</xsl:when>
+ <xsl:when test="$lineType='dotted'">dotted</xsl:when>
+ <xsl:when test="$lineType='none'">none</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl
new file mode 100644
index 000000000000..1507305a8bd5
--- /dev/null
+++ b/filter/source/xslt/export/uof/odf2uof_spreadsheet.xsl
@@ -0,0 +1,6194 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" 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:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:variable name="scValueWithUnit">
+ <xsl:value-of select="/office:document/office:automatic-styles/style:style[@style:name='co1']/style:table-column-properties/@style:column-width"/>
+ </xsl:variable>
+ <xsl:variable name="uofUnit">
+ <xsl:choose>
+ <xsl:when test="contains($scValueWithUnit,'in')">inch</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ooUnit">
+ <xsl:choose>
+ <xsl:when test="contains($scValueWithUnit,'inch')">inch</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($scValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:template match="office:document">
+ <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" uof:language="cn" uof:locID="u0000" uof:version="1.0" uof:mimetype="vnd.uof.spreadsheet">
+ <xsl:apply-templates select="/office:document/office:meta"/>
+ <uof:对象集 uof:locID="u0033">
+ <xsl:if test="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation">
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation">
+ <xsl:variable name="num">
+ <xsl:value-of select="substring-after(@draw:style-name,'gr')"/>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat('pz',$num)"/></xsl:attribute>
+ <xsl:variable name="name" select="@draw:style-name"/>
+ <图:预定义图形 uof:locID="g0005">
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name]">
+ <xsl:call-template name="graphicattr"/>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打印对象 uof:locID="g0032">true</图:打印对象>
+ <图:Web文字 uof:locID="g0033"/>
+ </图:属性>
+ </图:预定义图形>
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接">
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name]">
+ <xsl:attribute name="图:文字排列方向"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:graphic-properties/@draw:textarea-horizontal-align">
+ <xsl:attribute name="图:水平对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-horizontal-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:textarea-vertical-align">
+ <xsl:attribute name="图:垂直对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-vertical-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动换行">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'">
+ <xsl:attribute name="图:大小适应文字">true</xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="./text:p">
+ <xsl:call-template name="textp"/>
+ </xsl:for-each>
+ </图:文本内容>
+ </图:图形>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table//table:table-cell/office:annotation">
+ <xsl:variable name="name1" select="@draw:style-name"/>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:style[@style:name=$name1]">
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name">
+ <xsl:variable name="bsh">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image">
+ <xsl:if test="@draw:name=$bsh">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($name1,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:数据>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:table/table:shapes/child::* | /office:document/office:body/office:spreadsheet/table:table/table:table-row/table:table-cell/child::*">
+ <xsl:if test="starts-with(name(.),'draw:')">
+ <xsl:choose>
+ <xsl:when test="name(.)='draw:frame' and self::node()/draw:object">
+ <xsl:for-each select="draw:image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:数据>
+ </uof:其他对象>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="name(.)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </uof:对象集>
+ <xsl:if test="/office:document/office:body//text:bookmark-start">
+ <uof:书签集 uof:locID="u0027">
+ <xsl:for-each select="/office:document/office:body//text:bookmark-start">
+ <xsl:element name="uof:书签">
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@text:name"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">u0028</xsl:attribute>
+ <xsl:attribute name="uof:attrList">名称</xsl:attribute>
+ <xsl:element name="uof:文本位置">
+ <xsl:attribute name="字:区域引用"><xsl:value-of select="concat('bk_',@text:name)"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">u0029</xsl:attribute>
+ <xsl:attribute name="uof:attrList">区域引用</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </uof:书签集>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/text:p/text:a">
+ <uof:链接集 uof:locID="u0031">
+ <xsl:for-each select="/office:document/office:body/text:p/text:a">
+ <!--chengxz 要改-->
+ <xsl:variable name="hyperStr" select="@xlink:href"/>
+ <xsl:element name="uof:超级链接">
+ <xsl:if test="contains($hyperStr,'#')">
+ <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute>
+ </xsl:if>
+ <!--暂时不写uof:提示-->
+ <xsl:attribute name="uof:链源">hlnk<xsl:number from="/office:document/office:body" level="any" count="text:p[text:a]"/></xsl:attribute>
+ <xsl:if test="contains($hyperStr,'http://') or contains($hyperStr,'mailto')">
+ <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">u0032</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 目标 书签 式样引用 已访问式样引用 提示 链源</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </uof:链接集>
+ </xsl:if>
+ <uof:式样集 uof:locID="u0039">
+ <xsl:apply-templates select="/office:document/office:font-face-decls"/>
+ <xsl:apply-templates select="/office:document/office:styles/style:style" mode="styles"/>
+ <xsl:apply-templates select="/office:document/office:automatic-styles/style:style" mode="styles">
+ <xsl:with-param name="isAutomatic" select="true()"/>
+ </xsl:apply-templates>
+ </uof:式样集>
+ <uof:电子表格 uof:locID="u0049">
+ <表:公用处理规则 uof:locID="s0000">
+ <表:度量单位 uof:locID="s0001">
+ <xsl:value-of select="$uofUnit"/>
+ </表:度量单位>
+ <xsl:apply-templates select="/office:document/office:body/office:spreadsheet/table:calculation-settings" mode="common"/>
+ <xsl:apply-templates select="/office:document/office:body/office:spreadsheet/table:content-validations" mode="common"/>
+ <xsl:if test="/office:document/office:automatic-styles/style:style[@style:family='table-cell' and style:map]">
+ <xsl:element name="表:条件格式化集">
+ <xsl:attribute name="uof:locID">s0016</xsl:attribute>
+ <xsl:call-template name="create-condition-format"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:spreadsheet/table:database-ranges/table:database-range">
+ <表:区域公式集 uof:locID="s0122">
+ <表:区域公式 uof:locID="s0123" uof:attrList="类型">
+ <xsl:attribute name="表:类型">table</xsl:attribute>
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:database-ranges/table:database-range">
+ <表:区域 uof:locID="s0007">
+ <xsl:value-of select="@table:target-range-address"/>
+ </表:区域>
+ <表:公式 uof:locID="s0125"/>
+ </xsl:for-each>
+ </表:区域公式>
+ </表:区域公式集>
+ </xsl:if>
+ <表:是否RC引用 uof:locID="s0124" uof:attrList="值" 表:值="false"/>
+ </表:公用处理规则>
+ <表:主体 uof:locID="s0024">
+ <xsl:apply-templates select="office:body"/>
+ </表:主体>
+ </uof:电子表格>
+ </uof:UOF>
+ </xsl:template>
+ <xsl:template match="office:body">
+ <xsl:apply-templates select="office:spreadsheet"/>
+ </xsl:template>
+ <xsl:template match="office:spreadsheet">
+ <xsl:apply-templates select="./*"/>
+ </xsl:template>
+ <xsl:template match="office:meta">
+ <uof:元数据 uof:locID="u0001">
+ <uof:标题 uof:locID="u0002">
+ <xsl:value-of select="dc:title"/>
+ </uof:标题>
+ <uof:创建应用程序 uof:locID="u0011">
+ <xsl:value-of select="meta:generator"/>
+ </uof:创建应用程序>
+ <uof:摘要 uof:locID="u0007">
+ <xsl:value-of select="dc:description"/>
+ </uof:摘要>
+ <uof:主题 uof:locID="u0003">
+ <xsl:value-of select="dc:subject"/>
+ </uof:主题>
+ <uof:创建者 uof:locID="u0004"/>
+ <uof:作者 uof:locID="u0005">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:作者>
+ <uof:创建日期 uof:locID="u0008">
+ <xsl:value-of select="meta:creation-date"/>
+ </uof:创建日期>
+ <xsl:if test="dc:creator">
+ <uof:最后作者 uof:locID="u0006">
+ <xsl:value-of select="dc:creator"/>
+ </uof:最后作者>
+ </xsl:if>
+ <uof:关键字集 uof:locID="u0014">
+ <uof:关键字 uof:locID="u0015">
+ <xsl:value-of select="meta:keyword"/>
+ </uof:关键字>
+ </uof:关键字集>
+ <uof:编辑次数 uof:locID="u0009">
+ <xsl:value-of select="meta:editing-cycles"/>
+ </uof:编辑次数>
+ <xsl:if test="meta:editing-duration">
+ <uof:编辑时间 uof:locID="u0010">
+ <xsl:value-of select="meta:editing-duration"/>
+ </uof:编辑时间>
+ </xsl:if>
+ <xsl:if test="meta:template/@xlink:href">
+ <uof:文档模板 uof:locID="u0013">
+ <xsl:value-of select="meta:template/@xlink:href"/>
+ </uof:文档模板>
+ </xsl:if>
+ <xsl:if test="meta:user-defined/@meta:name">
+ <uof:用户自定义元数据集 uof:locID="u0016">
+ <xsl:for-each select="meta:user-defined">
+ <uof:用户自定义元数据 uof:locID="u0017" uof:attrList="名称 类型">
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@meta:name"/></xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute>
+ <xsl:value-of select="."/>
+ </uof:用户自定义元数据>
+ </xsl:for-each>
+ </uof:用户自定义元数据集>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:page-count">
+ <uof:页数 uof:locID="u0020">
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </uof:页数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:paragraph-count">
+ <uof:段落数 uof:locID="u0025">
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </uof:段落数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:object-count">
+ <uof:对象数 uof:locID="u0026">
+ <xsl:value-of select="meta:document-statistic/@meta:object-count"/>
+ </uof:对象数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count">
+ <uof:字数 uof:locID="u0021">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </uof:字数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:word-count">
+ <uof:中文字符数 uof:locID="u0023">
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </uof:中文字符数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count">
+ <uof:英文字符数 uof:locID="u0022">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count"/>
+ </uof:英文字符数>
+ </xsl:if>
+ <xsl:if test="meta:document-statistic/@meta:character-count">
+ <uof:行数 uof:locID="u0024">
+ <xsl:variable name="quzhi">
+ <xsl:value-of select="(meta:document-statistic/@meta:character-count div 39) + 0.9"/>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($quzhi,'.')"/>
+ </uof:行数>
+ </xsl:if>
+ <xsl:if test="meta:user-defined[@meta:name='Category']">
+ <uof:分类 uof:locID="u0012">
+ <xsl:value-of select="meta:user-defined[@meta:name='Category']"/>
+ </uof:分类>
+ </xsl:if>
+ <xsl:if test="meta:user-defined[@meta:name='Manager']">
+ <uof:经理名称 uof:locID="u0019">
+ <xsl:value-of select="meta:user-defined[meta:name='Manager']"/>
+ </uof:经理名称>
+ </xsl:if>
+ <xsl:if test="meta:user-defined[@meta:name='Company']">
+ <uof:公司名称 uof:locID="u0018">
+ <xsl:value-of select="meta:user-defined[meta:name='Company']"/>
+ </uof:公司名称>
+ </xsl:if>
+ </uof:元数据>
+ </xsl:template>
+ <xsl:template match="table:table">
+ <xsl:element name="表:工作表">
+ <xsl:attribute name="uof:locID">s0025</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 隐藏 背景 式样引用</xsl:attribute>
+ <xsl:attribute name="表:标识符"><xsl:value-of select="@table:name"/></xsl:attribute>
+ <xsl:attribute name="表:名称"><xsl:value-of select="@table:name"/></xsl:attribute>
+ <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:style-name='ta1'"><xsl:value-of select="'false'"/></xsl:when><xsl:otherwise><xsl:value-of select="'true'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:背景"><xsl:choose><xsl:when test="/office:document/office:automatic-styles/style:page-master/style:table-properties/@fo:background-color"><xsl:value-of select="/office:document/office:automatic-styles/style:page-master/style:table-properties/@fo:background-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:式样引用"><xsl:value-of select="@table:style-name"/></xsl:attribute>
+ <xsl:element name="表:工作表属性">
+ <xsl:attribute name="uof:locID">s0026</xsl:attribute>
+ <表:标签前景色 uof:locID="s0027">#000000</表:标签前景色>
+ <表:标签背景色 uof:locID="s0028">#ffffff</表:标签背景色>
+ <xsl:call-template name="creat-page-setting">
+ <xsl:with-param name="master-page" select="/*/office:master-styles/style:master-page"/>
+ <xsl:with-param name="page-master-style" select="/*/office:automatic-styles/style:page-layout/style:page-layout-properties"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-view">
+ <xsl:with-param name="table-name" select="/*/office:body/office:spreadsheet/table:table/@table:name"/>
+ <xsl:with-param name="view-id" select="count(preceding-sibling::table:table) + 1"/>
+ <xsl:with-param name="aaa" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed/config:config-item-map-entry"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:call-template name="table"/>
+ <xsl:variable name="filter" select="/*/office:body/office:spreadsheet/table:database-ranges/table:database-range"/>
+ <xsl:if test="$filter">
+ <xsl:variable name="target-range-address" select="//table:database-range[table:filter]/@table:target-range-address"/>
+ <xsl:element name="表:筛选">
+ <xsl:attribute name="uof:locID">s0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$filter/@table:display-filter-buttons">auto</xsl:when><xsl:otherwise>advance</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="表:范围">
+ <xsl:attribute name="uof:locID">s0102</xsl:attribute>
+ <xsl:value-of select="$filter/@table:target-range-address"/>
+ </xsl:element>
+ <xsl:variable name="column-and-row" select="substring-before(substring-after($target-range-address,'.'),':')"/>
+ <xsl:variable name="dd" select="number(substring($column-and-row,2,1))"/>
+ <xsl:variable name="zone-left-column-string">
+ <xsl:choose>
+ <xsl:when test="contains($dd,'NaN') ">
+ <xsl:value-of select="substring($column-and-row,1,2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($column-and-row,1,1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="zone-left-column-num">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="$zone-left-column-string"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-filter-conditions">
+ <xsl:with-param name="filter-condition-set" select="$filter//table:filter-condition"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ <xsl:if test="$filter/@table:condition-source-range-address">
+ <xsl:element name="表:条件区域">
+ <xsl:attribute name="uof:locID">s0108</xsl:attribute>
+ <xsl:value-of select="$filter/@table:condition-source-range-address"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$filter/@table:display-duplicates">
+ <xsl:element name="表:结果区域">
+ <xsl:attribute name="uof:locID">s0109</xsl:attribute>
+ <xsl:value-of select="$filter/@table:display-duplicates"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="key('styles', .//@table:style-name)/style:table-row-properties/@fo:break-before = 'page' or key('styles',.//@table:style-name)/style:table-column-properties/@fo:break-before='page'">
+ <xsl:element name="表:分页符集">
+ <xsl:attribute name="uof:locID">s0111</xsl:attribute>
+ <xsl:call-template name="分页符集"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:param name="tableElement" select="'表:工作表内容'"/>
+ <xsl:param name="rowElement" select="'表:行'"/>
+ <!--xsl:param name="cellElement" select="'表:单元格'" /-->
+ <!-- ************** -->
+ <!-- *** Table *** -->
+ <!-- ************** -->
+ <xsl:template name="table">
+ <!-- The table will only be created if the table:scenario is active -->
+ <xsl:if test="not(table:scenario) or table:scenario/@table:is-active">
+ <xsl:call-template name="create-table"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-table">
+ <!-- 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:call-template name="create-table-element">
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="create-table-element">
+ <xsl:param name="allVisibleTableRows"/>
+ <xsl:element name="表:工作表内容">
+ <xsl:attribute name="uof:locID">s0018</xsl:attribute>
+ <xsl:attribute name="uof:attrList">最大行 最大列 缺省行高 缺省列宽</xsl:attribute>
+ <xsl:variable name="group-column" select="./table:table-column-group"/>
+ <xsl:variable name="group-row" select="./table:table-row-group"/>
+ <xsl:apply-templates select="@table:style-name"/>
+ <xsl:for-each select="table:table-column">
+ <表:列 uof:locID="s0048" uof:attrList="列号 隐藏 列宽 式样引用 跨度">
+ <xsl:attribute name="表:列号"><xsl:value-of select="position()"/></xsl:attribute>
+ <xsl:if test="@table:visibility">
+ <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:visibility='collapse'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="表:列宽"><xsl:value-of select="substring-before(key('styles',@table:style-name)/style:table-column-properties/@style:column-width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:式样引用"><xsl:value-of select="@table:style-name"/></xsl:attribute>
+ <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="@table:number-columns-repeated"><xsl:value-of select="@table:number-columns-repeated"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </表:列>
+ </xsl:for-each>
+ <xsl:variable name="columnNodes" select="table:table-column"/>
+ <xsl:variable name="columnsRepeated" select="table:table-column/@table:number-columns-repeated"/>
+ <xsl:variable name="columnCount">
+ <xsl:choose>
+ <xsl:when test="$columnNodes[last()]/@table:number-columns-repeated &gt; 99">
+ <xsl:value-of select="count($columnNodes)+ number(sum($columnsRepeated))- count($columnsRepeated)- $columnNodes[last()]/@table:number-columns-repeated+ 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count($columnNodes)+ number(sum($columnsRepeated))- count($columnsRepeated)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="table-name" select="@table:name"/>
+ <xsl:apply-templates select="table:table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:apply-templates>
+ <xsl:if test="table:table-row-group//table:table-row">
+ <xsl:apply-templates select="table:table-row-group//table:table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:for-each select="table:shapes/child::*">
+ <xsl:if test="starts-with(name(.),'draw:')">
+ <xsl:choose>
+ <xsl:when test="name(.)='draw:frame' and self::node()/draw:object">
+ <xsl:call-template name="draw:chart-frame">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="uof锚点"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="table:table-row-group or table:table-column-group">
+ <xsl:element name="表:分组集">
+ <xsl:attribute name="uof:locID">s0098</xsl:attribute>
+ <xsl:for-each select="table:table-column-group">
+ <xsl:variable name="numcolumnrep" select="count(descendant::table:table-column[@table:number-columns-repeated])"/>
+ <xsl:variable name="numrep" select="sum(descendant::table:table-column/@table:number-columns-repeated)"/>
+ <xsl:variable name="numcolumn" select="count(descendant::table:table-column)"/>
+ <xsl:call-template name="table:table-column-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-column)"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-column) + $numrep + $numcolumn - $numcolumnrep"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:for-each select="table:table-row-group">
+ <xsl:variable name="numrowrep" select="count(descendant::table:table-row[@table:number-rows-repeated])"/>
+ <xsl:variable name="numrep" select="sum(descendant::table:table-row/@table:number-rows-repeated)"/>
+ <xsl:variable name="numrow" select="count(descendant::table:table-row)"/>
+ <xsl:call-template name="table:table-row-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-row)"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-row) + $numrep + $numrow - $numrowrep"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="table:table-row-group">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:element name="表:行">
+ <xsl:attribute name="uof:locID">s0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">起始 终止 隐藏</xsl:attribute>
+ <xsl:attribute name="表:起始"><xsl:value-of select="$start + 1"/></xsl:attribute>
+ <xsl:attribute name="表:终止"><xsl:value-of select="$end"/></xsl:attribute>
+ <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:display"><xsl:value-of select="'true'"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:for-each select="table:table-row-group">
+ <xsl:call-template name="table:table-row-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-row) + number(sum(preceding::table:table-row/@table:number-rows-repeated)) - count(preceding::table:table-row[@table:number-rows-repeated])"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-row) + number(sum(preceding::table:table-row/@table:number-rows-repeated)) - count(preceding::table:table-row[@table:number-rows-repeated]) + number(sum(descendant::table:table-row/@table:number-rows-repeated)) + count(descendant::table:table-row) - count(descendant::table:table-row[@table:number-rows-repeated])"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="table:table-column-group">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:element name="表:列">
+ <xsl:attribute name="uof:locID">s0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">起始 终止 隐藏</xsl:attribute>
+ <xsl:attribute name="表:起始"><xsl:value-of select="$start + 1"/></xsl:attribute>
+ <xsl:attribute name="表:终止"><xsl:value-of select="$end"/></xsl:attribute>
+ <xsl:attribute name="表:隐藏"><xsl:choose><xsl:when test="@table:display"><xsl:value-of select="'true'"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:for-each select="table:table-column-group">
+ <xsl:call-template name="table:table-column-group">
+ <xsl:with-param name="start" select="count(preceding::table:table-column) + number(sum(preceding::table:table-column/@table:number-columns-repeated)) - count(preceding::table:table-column[@table:number-columns-repeated])"/>
+ <xsl:with-param name="end" select="count(preceding::table:table-column) + number(sum(preceding::table:table-column/@table:number-columns-repeated)) - count(preceding::table:table-column[@table:number-columns-repeated]) + number(sum(descendant::table:table-column/@table:number-columns-repeated)) + count(descendant::table:table-column) - count(descendant::table:table-column[@table:number-columns-repeated])"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="uof锚点">
+ <xsl:if test="not(name(.)='draw:glue-point')">
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="name='draw:a'">
+ <xsl:for-each select="child::node( )">
+ <xsl:call-template name="uof锚点"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符">
+ <xsl:attribute name="uof:x坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:y坐标"><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="@svg:width"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgx"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="number(substring-before(descendant::node()[@svg:x][1]/@svg:width,$uofUnit))"/></xsl:variable><xsl:variable name="maxx"><xsl:call-template name="groupmaxx"><xsl:with-param name="value" select="$svgx + $width"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxx - $minx"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="@svg:height"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/></xsl:when><xsl:when test="name(.)='draw:g'"><xsl:variable name="miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:variable name="svgy"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/></xsl:variable><xsl:variable name="height"><xsl:value-of select="number(substring-before(descendant::node()[@svg:y][1]/@svg:height,$uofUnit))"/></xsl:variable><xsl:variable name="maxy"><xsl:call-template name="groupmaxy"><xsl:with-param name="value" select="$svgy + $height"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$maxy - $miny"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="refpicname">
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:when test="./@table:end-cell-address">
+ <xsl:value-of select="@table:end-cell-address"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="uof:图形引用"><xsl:variable name="picnumber"><xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/></xsl:variable><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:随动方式"><xsl:choose><xsl:when test="key('graphicset',$refpicname)/style:graphic-properties/@style:protect"><xsl:for-each select="key('graphicset',$refpicname)/style:graphic-properties"><xsl:choose><xsl:when test="@style:protect='size'">move</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:for-each></xsl:when><xsl:otherwise>movesize</xsl:otherwise></xsl:choose></xsl:attribute>
+ </uof:锚点>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--end 06.02.14 -->
+ <!-- **************** -->
+ <!-- *** Columns *** -->
+ <!-- **************** -->
+ <!--Redoffice comment liliang 06.05.23-->
+ <!--xsl:template name="create-table-column">
+ <xsl:param name="columnNodes"/>
+ <xsl:param name="currentColumn"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="columnNo"/>
+ <xsl:param name="columnNodeNo"/>
+ <xsl:param name="index"/>
+ <xsl:element name="表:列">
+ <xsl:attribute name="locID">s0048</xsl:attribute>
+ <xsl:attribute name="attrList">列号 隐藏 列宽 式样引用 跨度</xsl:attribute>
+ <xsl:if test="$currentColumn/@table:visibility = 'collapse' or $currentColumn/@table:visibility = 'filter'">
+ <xsl:attribute name="表:隐藏">true</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="$currentColumn/@table:number-columns-repeated"><xsl:value-of select="$currentColumn/@table:number-columns-repeated - 1"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$index">
+ <xsl:attribute name="表:列号"><xsl:value-of select="$columnNo"/></xsl:attribute>
+ </xsl:if-->
+ <!--自动列宽没有,暂略 autofitwidth-->
+ <!--Redoffice comment liliang 06.05.22-->
+ <!--xsl:variable name="width">
+ <xsl:value-of select="key('styles', $currentColumn/@table:style-name)/style:properties/@style:column-width"/>
+ </xsl:variable-->
+ <!--end-->
+ <!--xsl:if test="$width">
+ <xsl:attribute name="表:宽度"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$width"/></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="表:跨度"><xsl:choose><xsl:when test="$currentColumn/@table:number-columns-repeated"><xsl:value-of select="$currentColumn/@table:number-columns-repeated - 1"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="$columnNo &lt; $columnCount">
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="create-table-column">
+ <xsl:with-param name="columnNodes" select="$columnNodes"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="columnNo" select="$columnNo + $currentColumn/@table:number-columns-repeated"/>
+ <xsl:with-param name="columnNodeNo" select="$columnNodeNo + 1"/>
+ <xsl:with-param name="currentColumn" select="$columnNodes[$columnNodeNo + 1]"/>
+ <xsl:with-param name="index" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-table-column">
+ <xsl:with-param name="columnNodes" select="$columnNodes"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="columnNo" select="$columnNo + 1"/>
+ <xsl:with-param name="columnNodeNo" select="$columnNodeNo + 1"/>
+ <xsl:with-param name="currentColumn" select="$columnNodes[$columnNodeNo + 1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template-->
+ <!-- ************* -->
+ <!-- *** Rows *** -->
+ <!-- ************* -->
+ <xsl:template match="table:table-row">
+ <xsl:param name="table-name"/>
+ <xsl:param name="columnCount"/>
+ <xsl:choose>
+ <xsl:when test="@table:number-rows-repeated &gt; 1">
+ <xsl:choose>
+ <xsl:when test="(last() or (last() - 1)) and @table:number-rows-repeated &gt; 99">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="lastRow" select="true()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- In case a cell is being repeated, the cell will be created
+ in a variabel, which is as many times given out, as being repeated -->
+ <xsl:variable name="tableRow">
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="repeat-write-table-row">
+ <xsl:with-param name="tableRow" select="$tableRow"/>
+ <xsl:with-param name="repetition" select="@table:number-rows-repeated"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-row">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="write-table-row">
+ <xsl:param name="table-name"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="lastRow"/>
+ <xsl:element name="表:行">
+ <xsl:attribute name="uof:locID">s0049</xsl:attribute>
+ <xsl:attribute name="uof:attrList">行号 隐藏 行高 式样引用 跨度</xsl:attribute>
+ <xsl:if test="./table:table-cell/@office:value-type">
+ <xsl:attribute name="表:行号"><xsl:value-of select="count(preceding::table:table-row[not(@table:number-rows-repeated)])+1+number(sum(preceding::table:table-row[@table:number-rows-repeated]/@table:number-rows-repeated))"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:visibility = 'collapse' or @table:visibility = 'filter'">
+ <xsl:attribute name="表:隐藏">true</xsl:attribute>
+ </xsl:if>
+ <!-- although valid, can not be opened with Excel - issue i31949)
+ <xsl:if test="$lastRow">
+ <xsl:attribute name="ss:Span"><xsl:value-of select="@table:number-rows-repeated - 1" /></xsl:attribute>
+ </xsl:if>-->
+ <!-- writing the style of the row -->
+ <xsl:apply-templates select="@table:style-name"/>
+ <xsl:variable name="rowProperties" select="key('styles', @table:style-name)/*"/>
+ <!--xsl:if test="$rowProperties/@style:use-optimal-row-height = 'false'">
+ <! - - default is '1', therefore write only '0' - ->
+ <xsl:attribute name="ss:AutoFitHeight">0</xsl:attribute>
+ </xsl:if-->
+ <xsl:variable name="height" select="$rowProperties/@style:row-height"/>
+ <xsl:if test="$height">
+ <xsl:attribute name="表:行高"><!-- using the absolute height in point --><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$height"/></xsl:call-template></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="table:table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="repeat-write-table-row">
+ <xsl:param name="tableRow"/>
+ <xsl:param name="repetition"/>
+ <xsl:copy-of select="$tableRow"/>
+ <xsl:if test="$repetition &gt; 1">
+ <xsl:call-template name="repeat-write-table-row">
+ <xsl:with-param name="tableRow" select="$tableRow"/>
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- ************** -->
+ <!-- *** Cells *** -->
+ <!-- ************** -->
+ <!-- Table cells are able to be repeated by attribute in StarOffice,
+ but not in Excel. If more cells are repeated
+ (e.g. for emulating background) only as many cells as columns are
+ allowed to be written out. -->
+ <xsl:template match="table:table-cell">
+ <xsl:param name="table-name"/>
+ <xsl:param name="columnCount"/>
+ <!--xsl:choose>
+ <xsl:when test="@table:number-columns-repeated &gt; 1">
+ <xsl:variable name="tableCell">
+ <xsl:call-template name="write-table-cell"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(following-sibling::table:table-cell)">
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="cellNo" select="position()+ sum(preceding-sibling::table:table-cell/@table:number-columns-repeated)- count(preceding-sibling::table:table-cell/@table:number-columns-repeated)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-cell"/>
+ </xsl:otherwise>
+ </xsl:choose-->
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="write-table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="repeat-table-cell-no" select="@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="repeat-table-cell-no" select="number(1)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--xsl:template name="repeat-write-table-cell">
+ <xsl:param name="tableCell"/>
+ <xsl:param name="repetition"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="cellNo"/>
+ <xsl:copy-of select="$tableCell"/>
+ <xsl:if test="$repetition &gt; 1">
+ <xsl:choose>
+ <xsl:when test="$cellNo">
+ <xsl:if test="$cellNo &lt; $columnCount">
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="cellNo" select="$cellNo + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="repeat-write-table-cell">
+ <xsl:with-param name="tableCell" select="$tableCell"/>
+ <xsl:with-param name="repetition" select="$repetition - 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template-->
+ <xsl:template name="write-table-cell">
+ <xsl:param name="table-name"/>
+ <xsl:param name="repeat-table-cell-no"/>
+ <xsl:if test="$repeat-table-cell-no &gt; 0">
+ <表:单元格 uof:locID="s0050" uof:attrList="列号 式样引用 超链接引用 合并列数 合并行数">
+ <xsl:if test="@table:number-columns-spanned &gt; 1">
+ <xsl:attribute name="表:合并列数"><xsl:value-of select="@table:number-columns-spanned - 1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@table:number-rows-spanned &gt; 1">
+ <xsl:attribute name="表:合并行数"><xsl:value-of select="@table:number-rows-spanned - 1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="link" select="descendant::text:a/@xlink:href"/>
+ <xsl:if test="$link">
+ <xsl:attribute name="表:超链接引用"><xsl:value-of select="$link"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@table:style-name">
+ <xsl:apply-templates select="@table:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="ancestor::table:table/table:table-column/@table:default-cell-style-name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="*">
+ <xsl:if test="text:p">
+ <xsl:variable name="valueType">
+ <xsl:choose>
+ <xsl:when test="@office:value-type">
+ <xsl:value-of select="@office:value-type"/>
+ </xsl:when>
+ <xsl:otherwise>string</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="表的数据">
+ <xsl:with-param name="valueType" select="$valueType"/>
+ <xsl:with-param name="cellStyleName" select="@table:style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="office:annotation">
+ <xsl:element name="表:批注">
+ <xsl:attribute name="uof:locID">s0053</xsl:attribute>
+ <xsl:attribute name="uof:attrList">是否显示</xsl:attribute>
+ <xsl:attribute name="表:是否显示"><xsl:choose><xsl:when test="office:annotation/@office:display = 'true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <uof:锚点 uof:locID="u0064" uof:attrList="x坐标 y坐标 宽度 高度 图形引用 随动方式 缩略图 占位符">
+ <xsl:variable name="num">
+ <xsl:value-of select="substring-after(office:annotation/@draw:style-name,'gr')"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:图形引用"><xsl:value-of select="concat('pz',$num)"/></xsl:attribute>
+ <xsl:attribute name="uof:x坐标"><xsl:value-of select="substring-before(office:annotation/@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:y坐标"><xsl:value-of select="substring-before(office:annotation/@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(office:annotation/@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(office:annotation/@svg:height,$uofUnit)"/></xsl:attribute>
+ </uof:锚点>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:for-each select="child::*">
+ <xsl:if test="starts-with(name(.),'draw:')">
+ <xsl:choose>
+ <xsl:when test="name(.)='draw:frame' and self::node()/draw:object">
+ <xsl:call-template name="draw:chart-frame">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="uof锚点"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="/office:document/office:body/office:spreadsheet/table:tracked-changes and not(self::node()/@table:style-name) and self::node()/text:p">
+ <xsl:element name="表:数据">
+ <xsl:attribute name="uof:locID">s0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">数据类型</xsl:attribute>
+ <xsl:element name="字:句">
+ <xsl:attribute name="uof:locID">t0085</xsl:attribute>
+ <xsl:call-template name="table:tracked-changes"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </表:单元格>
+ <xsl:variable name="repeat-table-cell-no1">
+ <xsl:value-of select="$repeat-table-cell-no - 1"/>
+ </xsl:variable>
+ <xsl:call-template name="write-table-cell">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="repeat-table-cell-no" select="$repeat-table-cell-no1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="office:annotation"/>
+ <xsl:template match="dc:date"/>
+ <xsl:template name="表的数据">
+ <xsl:param name="valueType"/>
+ <xsl:param name="cellStyleName"/>
+ <xsl:choose>
+ <xsl:when test="descendant::*/@text:style-name">
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <表:数据 表:数据类型="string" uof:locID="s0051" uof:attrList="数据类型">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:数据>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <表:数据 表:数据类型="boolean" uof:locID="s0051" uof:attrList="数据类型">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:数据>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date'">
+ <表:数据 表:数据类型="date" uof:locID="s0051" uof:attrList="数据类型">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:数据>
+ </xsl:when>
+ <xsl:otherwise>
+ <表:数据 表:数据类型="number" uof:locID="s0051" uof:attrList="数据类型">
+ <xsl:apply-templates>
+ <xsl:with-param name="cellStyleName" select="$cellStyleName"/>
+ </xsl:apply-templates>
+ </表:数据>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <表:数据 uof:locID="s0051" uof:attrList="数据类型">
+ <xsl:choose>
+ <xsl:when test="$valueType = 'string'">
+ <xsl:attribute name="表:数据类型">text</xsl:attribute>
+ <!--xsl:attribute name="表:数据数值"><xsl:value-of select="@office:string-value"/></xsl:attribute-->
+ <!--chengxz schema no this attr-->
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="$valueType = 'boolean'">
+ <xsl:attribute name="表:数据类型">boolean</xsl:attribute>
+ <字:句 uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="@table:boolean-value = 'true'">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">true</字:文本串>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">false</字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="$valueType = 'date'">
+ <xsl:attribute name="表:数据类型">date</xsl:attribute>
+ <xsl:attribute name="表:数据数值"><xsl:value-of select="@office:date-value"/></xsl:attribute>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="$valueType = 'time'">
+ <xsl:attribute name="表:数据类型">time</xsl:attribute>
+ <xsl:attribute name="表:数据数值"><xsl:value-of select="@office:time-value"/></xsl:attribute>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:数据类型">number</xsl:attribute>
+ <xsl:attribute name="表:数据数值"><xsl:value-of select="@office:value"/></xsl:attribute>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="text:p"/>
+ </字:文本串>
+ </字:句>
+ </xsl:otherwise>
+ </xsl:choose>
+ </表:数据>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="分页符集">
+ <xsl:for-each select="table:table-row">
+ <xsl:if test="key('styles', @table:style-name)/style:table-row-properties/@fo:break-before">
+ <xsl:variable name="table-break-before">
+ <xsl:value-of select="key('styles', @table:style-name)/style:table-row-properties/@fo:break-before"/>
+ </xsl:variable>
+ <xsl:if test="$table-break-before = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-row/@table:number-rows-repeated">
+ <xsl:attribute name="表:行号"><xsl:value-of select="sum(preceding-sibling::table:table-row/@table:number-rows-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-row/@table:number-rows-repeated)">
+ <xsl:attribute name="表:行号">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="key('styles', @table:style-name)/style:table-row-properties/@fo:break-after">
+ <xsl:variable name="table-break-after" select="key('styles', @table:style-name)/style:table-row-properties/@fo:break-after"/>
+ <xsl:if test="$table-break-after = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-row/@table:number-rows-repeated">
+ <xsl:attribute name="表:行号"><xsl:value-of select="sum(preceding-sibling::table:table-row/@table:number-rows-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-row/@table:number-rows-repeated)">
+ <xsl:attribute name="表:行号">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="table:table-column">
+ <xsl:if test="key('styles', @table:style-name)/style:table-column-properties/@fo:break-before">
+ <xsl:variable name="table-break-before" select="key('styles', @table:style-name)/style:table-column-properties/@fo:break-before"/>
+ <xsl:if test="$table-break-before = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-column/@table:number-columns-repeated">
+ <xsl:attribute name="表:列号"><xsl:value-of select="sum(preceding-sibling::table:table-column/@table:number-columns-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-column/@table:number-columns-repeated)">
+ <xsl:attribute name="表:列号">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="key('styles', @table:style-name)/style:table-column-properties/@fo:break-after">
+ <xsl:variable name="table-break-after" select="key('styles', @table:style-name)/style:table-column-properties/@fo:break-after"/>
+ <xsl:if test="$table-break-after = 'page'">
+ <xsl:element name="表:分页符">
+ <xsl:attribute name="uof:locID">s0112</xsl:attribute>
+ <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute>
+ <xsl:if test="preceding-sibling::table:table-column/@table:number-columns-repeated">
+ <xsl:attribute name="表:列号"><xsl:value-of select="sum(preceding-sibling::table:table-column/@table:number-columns-repeated)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(preceding-sibling::table:table-column/@table:number-columns-repeated)">
+ <xsl:attribute name="表:列号">1</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace">
+ <xsl:param name="whitespaces"/>
+ <xsl:text> </xsl:text>
+ <xsl:if test="$whitespaces >= 1">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- allowing all matched text nodes -->
+ <!--chengxz0630-->
+ <!--xsl:template match="text()">
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="locID">t0109</xsl:attribute>
+
+ <xsl:value-of select="." />
+ </xsl:element>
+ </字:句>
+ </xsl:template-->
+ <xsl:variable name="namespace-html" select="'http://www.w3.org/TR/REC-html40'"/>
+ <xsl:template match="@table:style-name | @table:default-cell-style-name">
+ <xsl:attribute name="表:式样引用"><!--ss:styleID--><xsl:value-of select="."/><!--chengxz 060114--></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="style-and-contents">
+ <xsl:param name="cellStyleName"/>
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:文本串">
+ <!--chengxz0630-->
+ </xsl:element>
+ </字:句>
+ </xsl:template>
+ <!-- *************88-->
+ <xsl:param name="dpi" select="111"/>
+ <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-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="convert2px">
+ <xsl:param name="value"/>
+ <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, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-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:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:key match="draw:object/office:document/office:automatic-styles/style:style" name="chart-style-name" use="@style:name"/>
+ <xsl:template name="draw:chart-frame">
+ <xsl:param name="table-name"/>
+ <表:图表 uof:locID="s0055" uof:attrList="类型 子类型 宽度 高度 x坐标 y坐标 随动方式">
+ <xsl:variable name="plot-area">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="data-area">
+ <xsl:value-of select="draw:object/@draw:notify-on-update-of-ranges"/>
+ </xsl:variable>
+ <xsl:variable name="series-generate">
+ <xsl:for-each select="key('chart-style-name',$plot-area)">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:series-source='columns'">col</xsl:when>
+ <xsl:otherwise>row</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template name="表:图表">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ <表:图表区 uof:locID="s0056">
+ <xsl:call-template name="表:图表区">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:图表区>
+ <表:绘图区 uof:locID="s0060">
+ <xsl:attribute name="表:宽度"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:高度"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:x坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:y坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:call-template name="表:绘图区">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:绘图区>
+ <表:分类轴 uof:locID="s0061" uof:attrList="主刻度类型 次刻度类型 刻度线标志">
+ <xsl:variable name="axis-style-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[child::chart:categories]/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$axis-style-name]">
+ <xsl:attribute name="表:主刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true' and style:chart-properties/@chart:tick-marks-major-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='false'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:次刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true' and style:chart-properties/@chart:tick-marks-minor-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:刻度线标志"><xsl:choose><xsl:when test="style:chart-properties/@chart:display-label='true'">next to axis</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="表:坐标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="axis-type" select="category-axis"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </表:分类轴>
+ <表:数值轴 uof:locID="s0082" uof:attrList="主刻度类型 次刻度类型 刻度线标志">
+ <xsl:variable name="axis-style-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[child::chart:grid]/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$axis-style-name]">
+ <xsl:attribute name="表:主刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true' and style:chart-properties/@chart:tick-marks-major-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-major-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:次刻度类型"><xsl:choose><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true' and style:chart-properties/@chart:tick-marks-minor-outer='true'">cross</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">inside</xsl:when><xsl:when test="style:chart-properties/@chart:tick-marks-minor-inner='true'">outside</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:刻度线标志"><xsl:choose><xsl:when test="style:chart-properties/@chart:display-label='true'">next to axis</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="表:坐标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="axis-type" select="category-axis"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </表:数值轴>
+ <表:图例 uof:locID="s0083" uof:attrList="位置">
+ <xsl:attribute name="表:位置"><xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@chart:legend-position"/></xsl:attribute>
+ <xsl:attribute name="表:x坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:y坐标"><xsl:value-of select="substring-before(draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:call-template name="表:图例">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:图例>
+ <!--表:数据表 uof:locID="s0085">
+ <xsl:call-template name="表:数据表">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ </xsl:call-template>
+ </表:数据表-->
+ <表:数据系列集 uof:locID="s0086">
+ <xsl:variable name="data-series-path" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series"/>
+ <xsl:call-template name="表:数据系列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="data-series-path" select="$data-series-path"/>
+ </xsl:call-template>
+ </表:数据系列集>
+ <!--0825 by lil -->
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series">
+ <表:数据点集 uof:locID="s0090">
+ <xsl:variable name="data-series-path" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series"/>
+ <xsl:call-template name="表:数据点">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="data-series-path" select="$data-series-path"/>
+ </xsl:call-template>
+ </表:数据点集>
+ </xsl:if>
+ <!--end-->
+ <表:网格线集 uof:locID="s0092">
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x' and @chart:style-name]/chart:grid">
+ <xsl:call-template name="表:网格线">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="grid-type" select="'category axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/@chart:style-name">
+ <xsl:call-template name="表:网格线">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="grid-type" select="'value axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ </表:网格线集>
+ <表:数据源 uof:locID="s0094" uof:attrList="数据区域 系列产生">
+ <xsl:variable name="series-row-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring-before(substring(substring-after($data-area,'.'),2),':')"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-row-end">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after(substring-after($data-area,'.'),'.'),2)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-col-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($data-area,'.'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-col-end">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after(substring-after($data-area,'.'),'.'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="series-value-count">
+ <xsl:choose>
+ <xsl:when test="$series-generate='col'">
+ <xsl:value-of select="$series-col-end -$series-col-start +1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$series-row-end -$series-row-start +1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="表:数据区域"><xsl:value-of select="draw:object/@draw:notify-on-update-of-ranges"/></xsl:attribute>
+ <xsl:attribute name="表:系列产生"><xsl:choose><xsl:when test="contains($series-generate,'col')">col</xsl:when><xsl:when test="contains($series-generate,'row')">row</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="表:系列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="series-row-start" select="$series-row-start"/>
+ <xsl:with-param name="series-row-end" select="$series-row-end"/>
+ <xsl:with-param name="series-col-start" select="$series-col-start"/>
+ <xsl:with-param name="series-col-end" select="$series-col-end"/>
+ <xsl:with-param name="series-value-current" select="'1'"/>
+ <xsl:with-param name="series-value-count" select="$series-value-count"/>
+ </xsl:call-template>
+ </表:数据源>
+ <表:标题集 uof:locID="s0096">
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:title">
+ <xsl:call-template name="表:标题">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="caption-type" select="'chart'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']">
+ <xsl:call-template name="表:标题">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="caption-type" select="'category axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']">
+ <xsl:call-template name="表:标题">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="caption-type" select="'value axis'"/>
+ </xsl:call-template>
+ </xsl:if>
+ </表:标题集>
+ </表:图表>
+ </xsl:template>
+ <xsl:template name="表:图表">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="chart-class">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:class"/>
+ </xsl:variable>
+ <xsl:variable name="chart-area">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="plot-area">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$chart-class='chart:bar'">
+ <xsl:variable name="chart-sub-class">
+ <xsl:value-of select="key('chart-style-name',$plot-area)/style:chart-properties/@chart:vertical"/>
+ </xsl:variable>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$chart-sub-class='true'">bar</xsl:when><xsl:when test="$chart-sub-class='false'">column</xsl:when><xsl:otherwise/></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:子类型"><xsl:choose><xsl:when test="$chart-sub-class='true'"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">bar_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">bar_stacked</xsl:when><xsl:otherwise>bar_standard</xsl:otherwise></xsl:choose></xsl:when><xsl:when test="$chart-sub-class='false'"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">column_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">column_stacked</xsl:when><xsl:otherwise>column_standard</xsl:otherwise></xsl:choose></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$chart-class='chart:line'">
+ <xsl:attribute name="表:类型">line</xsl:attribute>
+ <xsl:attribute name="表:子类型"><xsl:choose><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:percentage">line_percent</xsl:when><xsl:when test="key('chart-style-name',$plot-area)/style:chart-properties/@chart:stacked">line_stacked</xsl:when><xsl:otherwise>line_standard</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$chart-class='chart:circle'">
+ <xsl:attribute name="表:类型">pie</xsl:attribute>
+ <xsl:variable name="data-point-end" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:series[1]/chart:data-point"/>
+ <xsl:choose>
+ <xsl:when test="count($data-point-end) &lt;=1">
+ <xsl:attribute name="表:子类型">pie_standard</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="data-point-position-1">
+ <xsl:for-each select="$data-point-end[position()=1]">
+ <xsl:choose>
+ <xsl:when test="@chart:style-name">
+ <xsl:for-each select="key('chart-style-name',@chart:style-name)">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:pie-offset">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$data-point-position-1='0'">
+ <xsl:attribute name="表:子类型">pie_standard</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="$data-point-end[position()=2]">
+ <xsl:choose>
+ <xsl:when test="@chart:style-name">
+ <xsl:for-each select="key('chart-style-name',@chart:style-name)">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:pie-offset">
+ <xsl:attribute name="表:子类型">pie_offset2</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:子类型">pie_offset1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:子类型">pie_offset1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$chart-class='chart:ring'">
+ <xsl:attribute name="表:类型">pie</xsl:attribute>
+ <xsl:attribute name="表:子类型">pie_ring</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:attribute name="表:宽度"><xsl:value-of select="substring-before(@svg:width,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:高度"><xsl:value-of select="substring-before(@svg:height,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="表:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:variable name="draw-style-name" select="@draw:style-name"/>
+ <xsl:for-each select="draw:object//office:document/office:automatic-styles/style:style[@style:name=$draw-style-name]">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:move-protect='true' and style:graphic-properties/@draw:size-protect='true'">
+ <xsl:attribute name="表:随动方式">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:size-protect='true'">
+ <xsl:attribute name="表:随动方式">move</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:随动方式">move and re-size</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:随动方式">move and re-size</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:图表区">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="chart-style-name" select="draw:object/office:document/office:body/office:chart/chart:chart/@chart:style-name"/>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$chart-style-name]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型">
+ </xsl:call-template>
+ </表:字体>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:绘图区">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="plot-style-name" select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:wall/@chart:style-name"/>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$plot-style-name]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型2"/>
+ </表:填充>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:图例">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:variable name="legend">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:legend/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="draw:object/office:document/office:automatic-styles/style:style[@style:name=$legend]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型"/>
+ </表:字体>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:图例项">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <表:图例项 uof:locID="s0084" uof:attrList="系列">
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型"/>
+ </表:字体>
+ </表:图例项>
+ </xsl:template>
+ <xsl:template name="表:数据表">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型"/>
+ </表:字体>
+ </xsl:template>
+ <xsl:template name="表:数据系列">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="data-series-path"/>
+ <xsl:for-each select="$data-series-path">
+ <表:数据系列 uof:locID="s0087" uof:attrList="系列">
+ <xsl:variable name="data-series-position">
+ <xsl:value-of select="position()"/>
+ </xsl:variable>
+ <xsl:attribute name="表:系列"><xsl:value-of select="$data-series-position"/></xsl:attribute>
+ <xsl:variable name="data-series-point" select="@chart:style-name"/>
+ <xsl:call-template name="表:数据点类型">
+ <xsl:with-param name="data-series-point" select="$data-series-point"/>
+ <xsl:with-param name="data-series-position" select="$data-series-position"/>
+ </xsl:call-template>
+ </表:数据系列>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:数据点">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="data-series-path"/>
+ <xsl:for-each select="$data-series-path">
+ <xsl:variable name="data-series-position" select="position()"/>
+ <xsl:for-each select="chart:data-point">
+ <!--xsl:if test="@chart:style-name"-->
+ <xsl:variable name="data-point-position">
+ <xsl:call-template name="count-chart-data-point">
+ <xsl:with-param name="data-point-count" select="'1'"/>
+ <xsl:with-param name="data-point-position-temp" select="position() -1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <表:数据点 uof:locID="s0091" uof:attrList="系列 点">
+ <xsl:attribute name="表:系列"><xsl:value-of select="$data-series-position"/></xsl:attribute>
+ <xsl:attribute name="表:点"><xsl:value-of select="$data-point-position"/></xsl:attribute>
+ <xsl:variable name="data-series-point" select="@chart:style-name"/>
+ <xsl:for-each select="../../../../../office:automatic-styles/style:style[@style:name=$data-series-point]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型"/>
+ </表:字体>
+ <表:显示标志 uof:locID="s0088" uof:attrList="系列名 类别名 数值 百分数 分隔符 图例标志">
+ <xsl:attribute name="表:系列名"/>
+ <xsl:attribute name="表:分隔符"/>
+ <xsl:if test="style:chart-properties/@chart:data-label-text">
+ <xsl:attribute name="表:类别名"><xsl:value-of select="style:chart-properties/@chart:data-label-text"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-number">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='value'">
+ <xsl:attribute name="表:数值">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='percentage'">
+ <xsl:attribute name="表:百分数">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-symbol">
+ <xsl:attribute name="表:图例标志"><xsl:value-of select="style:chart-properties/@chart:data-label-symbol"/></xsl:attribute>
+ </xsl:if>
+ </表:显示标志>
+ <表:系列名 uof:locID="s0089">
+ <xsl:value-of select="concat('系列',$data-series-position)"/>
+ </表:系列名>
+ </xsl:for-each>
+ </表:数据点>
+ <!--/xsl:if-->
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:网格线">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="grid-type"/>
+ <xsl:if test="$grid-type='category axis'">
+ <xsl:variable name="category-axis-grid">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$category-axis-grid)">
+ <表:网格线 uof:locID="s0093" uof:attrList="类型 宽度 边距 颜色 阴影 位置">
+ <xsl:call-template name="表:边框"/>
+ <xsl:attribute name="表:位置"><xsl:value-of select="$grid-type"/></xsl:attribute>
+ </表:网格线>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$grid-type='value axis'">
+ <xsl:variable name="value-axis-grid">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$value-axis-grid)">
+ <表:网格线 uof:locID="s0093" uof:attrList="类型 宽度 边距 颜色 阴影 位置">
+ <xsl:call-template name="表:边框"/>
+ <xsl:attribute name="表:位置"><xsl:value-of select="$grid-type"/></xsl:attribute>
+ </表:网格线>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:系列">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="series-row-start"/>
+ <xsl:param name="series-row-end"/>
+ <xsl:param name="series-col-start"/>
+ <xsl:param name="series-col-end"/>
+ <xsl:param name="series-value-current"/>
+ <xsl:param name="series-value-count"/>
+ <xsl:choose>
+ <xsl:when test="$series-value-current>$series-value-count"/>
+ <xsl:otherwise>
+ <表:系列 uof:locID="s0095" uof:attrList="系列名 系列值 分类名">
+ <xsl:attribute name="表:系列名"><xsl:value-of select="concat('系列',$series-value-current)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$series-generate='col'">
+ <xsl:variable name="series-col-letter-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$series-col-start +$series-value-current -1"/>
+ <xsl:with-param name="output-type" select="'CHARS_UPPER_LETTER'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="表:系列值"><xsl:value-of select="concat($table-name,'!',$series-col-letter-start,$series-row-start,':',$series-col-letter-start,$series-row-end)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="series-col-letter-start">
+ <xsl:value-of select="substring(substring-after($data-area,'.'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="series-col-letter-end">
+ <xsl:value-of select="substring(substring-after(substring-after($data-area,'.'),'.'),1,1)"/>
+ </xsl:variable>
+ <xsl:attribute name="表:系列值"><xsl:value-of select="concat($table-name,'!',$series-col-letter-start,$series-row-start +$series-value-current -1,':',$series-col-letter-end,$series-row-start +$series-value-current -1)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </表:系列>
+ <xsl:call-template name="表:系列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="data-area" select="$data-area"/>
+ <xsl:with-param name="series-generate" select="$series-generate"/>
+ <xsl:with-param name="series-row-start" select="$series-row-start"/>
+ <xsl:with-param name="series-row-end" select="$series-row-end"/>
+ <xsl:with-param name="series-col-start" select="$series-col-start"/>
+ <xsl:with-param name="series-col-end" select="$series-col-end"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current +1"/>
+ <xsl:with-param name="series-value-count" select="$series-value-count"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:标题">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="caption-type"/>
+ <xsl:if test="$caption-type='chart'">
+ <xsl:variable name="chart-title">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:title/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="chart-title-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:title/text:p"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$chart-title)">
+ <表:标题 uof:locID="s0097" uof:attrList="名称 位置">
+ <xsl:attribute name="表:名称"><xsl:value-of select="$chart-title-name"/></xsl:attribute>
+ <xsl:attribute name="表:位置"><xsl:value-of select="$caption-type"/></xsl:attribute>
+ <xsl:call-template name="表:标题类型"/>
+ </表:标题>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$caption-type='category axis'">
+ <xsl:variable name="category-axis-title">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/chart:title/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="category-axis-title-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='x']/chart:title/text:p"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$category-axis-title)">
+ <表:标题 uof:locID="s0097" uof:attrList="名称 位置">
+ <xsl:attribute name="表:名称"><xsl:value-of select="$category-axis-title-name"/></xsl:attribute>
+ <xsl:attribute name="表:位置"><xsl:value-of select="$caption-type"/></xsl:attribute>
+ <xsl:call-template name="表:标题类型"/>
+ </表:标题>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$caption-type='value axis'">
+ <xsl:variable name="value-axis-title">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/chart:title/@chart:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="value-axis-title-name">
+ <xsl:value-of select="draw:object/office:document/office:body/office:chart/chart:chart/chart:plot-area/chart:axis[@chart:dimension='y']/chart:title/text:p"/>
+ </xsl:variable>
+ <xsl:for-each select="key('chart-style-name',$value-axis-title)">
+ <表:标题 uof:locID="s0097" uof:attrList="名称 位置">
+ <xsl:attribute name="表:名称"><xsl:value-of select="$value-axis-title-name"/></xsl:attribute>
+ <xsl:attribute name="表:位置"><xsl:value-of select="$caption-type"/></xsl:attribute>
+ <xsl:call-template name="表:标题类型"/>
+ </表:标题>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:坐标轴类型">
+ <xsl:param name="table-name"/>
+ <xsl:param name="data-area"/>
+ <xsl:param name="series-generate"/>
+ <xsl:param name="axis-type"/>
+ <表:线型 uof:locID="s0062" uof:attrList="类型 宽度 边距 颜色 阴影">
+ <xsl:attribute name="uof:类型"><xsl:call-template name="表:线型"/></xsl:attribute>
+ </表:线型>
+ <表:数值 uof:locID="s0063" uof:attrList="链接到源 分类名称 格式码">
+ <xsl:attribute name="表:链接到源"><xsl:choose><xsl:when test="style:chart-properties/@chart:link-data-style-to-source"><xsl:value-of select="style:chart-properties/@chart:link-data-style-to-source"/></xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="@style:data-style-name">
+ <xsl:call-template name="Chart-NumberFormat">
+ <xsl:with-param name="temp-style" select="@style:data-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </表:数值>
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型"/>
+ </表:字体>
+ <表:刻度 uof:locID="s0064">
+ <xsl:call-template name="表:刻度类型"/>
+ </表:刻度>
+ <表:对齐 uof:locID="s0078">
+ <xsl:if test="style:chart-properties/@style:direction">
+ <xsl:element name="表:文字方向">
+ <xsl:attribute name="uof:locID">s0079</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@style:direction = 'ttb'">vertical</xsl:when>
+ <xsl:otherwise>horizontal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@text:rotation-angle">
+ <表:旋转角度 uof:locID="s0080">
+ <xsl:value-of select="style:chart-properties/@text:rotation-angle"/>
+ </表:旋转角度>
+ </xsl:if>
+ <表:偏移量 uof:locID="s0081"/>
+ </表:对齐>
+ </xsl:template>
+ <xsl:template name="Chart-NumberFormat">
+ <xsl:param name="temp-style"/>
+ <xsl:for-each select="(preceding-sibling::*[@style:name=$temp-style]) | (following-sibling::*[@style:name=$temp-style])">
+ <xsl:attribute name="表:分类名称"><xsl:choose><xsl:when test="name(.)='number:currency-style'">currency</xsl:when><xsl:when test="name(.)='number:percentage-style'">percentage</xsl:when><xsl:when test="name(.)='number:date-style'">date</xsl:when><xsl:when test="name(.)='number:time-style'">time</xsl:when><xsl:when test="name(.)='number:boolean-style'">custom</xsl:when><xsl:when test="name(.)='number:text-style'">text</xsl:when><xsl:when test="name(.)='number:number-style'"><xsl:choose><xsl:when test="number:fraction">fraction</xsl:when><xsl:when test="number:scientific-number">scientific</xsl:when><xsl:otherwise>number</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>general</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:格式码"><xsl:call-template name="element-attribute"/><xsl:for-each select="style:map"><xsl:text>[</xsl:text><xsl:value-of select="@style:condition"/><xsl:text>]</xsl:text><xsl:variable name="apply-style" select="@style:apply-style-name"/><xsl:for-each select="../../child::*[@style:name=$apply-style]/*"><xsl:call-template name="general-number-format"/></xsl:for-each><xsl:text>;</xsl:text></xsl:for-each><xsl:for-each select="*[not(name(.)='style:map')]"><xsl:call-template name="general-number-format"/></xsl:for-each></xsl:attribute>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:数据点类型">
+ <xsl:param name="data-series-point"/>
+ <xsl:param name="data-series-position"/>
+ <xsl:for-each select="ancestor::draw:object/office:document/office:automatic-styles/style:style[@style:name=$data-series-point]">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型"/>
+ </表:字体>
+ <表:显示标志 uof:locID="s0088" uof:attrList="系列名 类别名 数值 百分数 分隔符 图例标志">
+ <xsl:attribute name="表:系列名">true</xsl:attribute>
+ <xsl:if test="style:chart-properties/@chart:data-label-text">
+ <xsl:attribute name="表:类别名"><xsl:value-of select="style:chart-properties/@chart:data-label-text"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-number">
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='value'">
+ <xsl:attribute name="表:数值">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:chart-properties/@chart:data-label-number='percentage'">
+ <xsl:attribute name="表:百分数">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:data-label-symbol">
+ <xsl:attribute name="表:图例标志"><xsl:value-of select="style:chart-properties/@chart:data-label-symbol"/></xsl:attribute>
+ </xsl:if>
+ </表:显示标志>
+ <表:系列名 uof:locID="s0089">
+ <xsl:value-of select="concat('系列',$data-series-position)"/>
+ </表:系列名>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:标题类型">
+ <表:边框 uof:locID="s0057" uof:attrList="类型 宽度 边距 颜色 阴影">
+ <xsl:call-template name="表:边框"/>
+ </表:边框>
+ <xsl:if test="style:graphic-properties/@draw:fill-color or (style:graphic-properties/@draw:fill and not(style:graphic-properties/@draw:fill='none'))">
+ <表:填充 uof:locID="s0058">
+ <xsl:call-template name="图:填充类型"/>
+ </表:填充>
+ </xsl:if>
+ <表:字体 uof:locID="s0059" uof:attrList="式样引用">
+ <xsl:call-template name="字:句属性类型"/>
+ </表:字体>
+ <表:对齐 uof:locID="s0020">
+ <xsl:call-template name="表:对齐格式类型"/>
+ </表:对齐>
+ </xsl:template>
+ <xsl:template name="count-chart-data-point">
+ <xsl:param name="data-point-count"/>
+ <xsl:param name="data-point-position-temp"/>
+ <xsl:choose>
+ <xsl:when test="$data-point-position-temp=0">
+ <xsl:value-of select="$data-point-count"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="temp">
+ <xsl:for-each select="../chart:data-point[position()=$data-point-position-temp]">
+ <xsl:choose>
+ <xsl:when test="@chart:repeated">
+ <xsl:value-of select="@chart:repeated"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:call-template name="count-chart-data-point">
+ <xsl:with-param name="data-point-count" select="$data-point-count +$temp"/>
+ <xsl:with-param name="data-point-position-temp" select="$data-point-position-temp -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:边框">
+ <xsl:attribute name="uof:类型"><xsl:call-template name="表:线型"/></xsl:attribute>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="style:graphic-properties/@svg:stroke-color"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:阴影">false</xsl:attribute>
+ </xsl:template>
+ <xsl:template name="图:填充类型">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:渐变>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name">
+ <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称">
+ <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:名称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色">
+ <xsl:attribute name="图:类型"><xsl:value-of select="../../office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ <xsl:attribute name="图:图形引用">gr1</xsl:attribute>
+ <xsl:attribute name="图:前景色"><xsl:value-of select="../../office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="图:填充类型2">
+ <xsl:if test="style:graphic-properties/@draw:fill-color">
+ <图:颜色 uof:locID="g0034">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </图:颜色>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name">
+ <xsl:variable name="chart-image-name" select="style:graphic-properties/@draw:fill-image-name"/>
+ <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称">
+ <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="../../office:styles/draw:fill-image[@draw:name=$chart-image-name]">
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('chart_image_',count(preceding::draw:fill-image))"/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:名称"><xsl:value-of select="$chart-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:fill-hatch-name">
+ <xsl:variable name="chart-hatch-name" select="style:graphic-properties/@draw:fill-hatch-name"/>
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色">
+ <xsl:for-each select="../../office:styles/draw:hatch[@draw:name=$chart-hatch-name]">
+ <xsl:attribute name="图:类型"><xsl:value-of select="@draw:style"/></xsl:attribute>
+ <xsl:attribute name="图:前景色"><xsl:value-of select="@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"/>
+ <xsl:attribute name="图:距离"><xsl:value-of select="@draw:distance"/></xsl:attribute>
+ <xsl:attribute name="图:旋转度"><xsl:value-of select="@draw:rotation"/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="$chart-hatch-name"/></xsl:attribute>
+ </图:图案>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:fill-gradient-name">
+ <xsl:variable name="chart-gradient-name" select="style:graphic-properties/@draw:fill-gradient-name"/>
+ <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型">
+ <xsl:for-each select="../../office:styles/draw:gradient[@draw:name=$chart-gradient-name]">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </xsl:for-each>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="$chart-gradient-name"/></xsl:attribute>
+ </图:渐变>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:对齐格式类型">
+ <xsl:if test="style:chart-properties/@style:rotation-angle">
+ <表:文字旋转角度 uof:locID="s0080">
+ <xsl:value-of select="style:chart-properties/@style:rotation-angle"/>
+ </表:文字旋转角度>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@fo:text-align">
+ <xsl:element name="表:水平对齐方式">
+ <xsl:attribute name="uof:locID">s0115</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'center'">center</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'end'">right</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'justify'">justify</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:text-align = 'start'">left</xsl:when>
+ <xsl:otherwise>fill</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="(style:chart-properties/@style:vertical-align) or (style:chart-properties/@fo:vertical-align)">
+ <xsl:element name="表:垂直对齐方式">
+ <xsl:attribute name="uof:locID">s0116</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:when test="style:chart-propeoperties/@fo:vertical-align = 'middle'">center</xsl:when>
+ <xsl:when test="style:charties/@fo:vertical-align = 'bottom'">bottom</xsl:when>
+ <xsl:when test="style:chart-prrt-properties/@fo:vertical-align = 'justify'">justify</xsl:when>
+ <xsl:when test="style:chart-properties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:otherwise>distributed</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-left">
+ <表:缩进 uof:locID="s0117">
+ <xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-left,$uofUnit)"/>
+ </表:缩进>
+ </xsl:if>
+ <xsl:element name="表:文字方向">
+ <xsl:attribute name="uof:locID">s0118</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:chart-properties/@style:direction = 'ttb'">vertical</xsl:when>
+ <xsl:otherwise>horizontal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <表:自动换行 uof:locID="s0120" uof:attrList="值">
+ <xsl:attribute name="表:值">true</xsl:attribute>
+ </表:自动换行>
+ <表:缩小字体填充 uof:locID="s0121" uof:attrList="值">
+ <xsl:attribute name="表:值">true</xsl:attribute>
+ </表:缩小字体填充>
+ </xsl:template>
+ <xsl:template name="表:线型">
+ <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/>
+ <xsl:variable name="stroke" select="style:graphic-properties/@draw:stroke"/>
+ <xsl:choose>
+ <xsl:when test="$stroke='solid'">single</xsl:when>
+ <xsl:when test="$stroke='none'">none</xsl:when>
+ <xsl:when test="$stroke='dash'">
+ <xsl:choose>
+ <xsl:when test="$linetype='Ultrafine_20_Dashed'">dash</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed'">dashed-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_2_20_Dots_20_3_20_Dashes'">dot-dash</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dotted'">dotted</xsl:when>
+ <xsl:when test="$linetype='Line_20_with_20_Fine_20_Dots'">dash-long-heavy</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed_20__28_var_29_'">dash-long</xsl:when>
+ <xsl:when test="$linetype='_33__20_Dashes_20_3_20_Dots_20__28_var_29_'">dash-dot-dot</xsl:when>
+ <xsl:when test="$linetype='Ultrafine_20_Dotted_20__28_var_29_'">dotted-heavy</xsl:when>
+ <xsl:when test="$linetype='Line_20_Style_20_9'">thick</xsl:when>
+ <xsl:when test="$linetype='_32__20_Dots_20_1_20_Dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$linetype='Dashed_20__28_var_29_'">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='Dash_20_10'">dash-dot-heavy</xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:刻度类型">
+ <xsl:if test="style:chart-properties/@chart:minimum">
+ <表:最小值 uof:locID="s0065">
+ <xsl:value-of select="style:chart-properties/@chart:minimum"/>
+ </表:最小值>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:maximum">
+ <表:最大值 uof:locID="s0066">
+ <xsl:value-of select="style:chart-properties/@chart:maximum"/>
+ </表:最大值>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:interval-major">
+ <表:主单位 uof:locID="s0067">
+ <xsl:value-of select="style:chart-properties/@chart:interval-major"/>
+ </表:主单位>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:interval-minor">
+ <表:次单位 uof:locID="s0068">
+ <xsl:value-of select="style:chart-properties/@chart:interval-minor"/>
+ </表:次单位>
+ </xsl:if>
+ <xsl:if test="style:chart-properties/@chart:origin">
+ <表:分类交叉点 uof:locID="s0069">
+ <xsl:value-of select="style:chart-properties/@chart:origin"/>
+ </表:分类交叉点>
+ </xsl:if>
+ <表:单位 uof:locID="s0070">none</表:单位>
+ <表:显示单位 uof:locID="s0071" uof:attrList="值" 表:值="false"/>
+ <表:对数 uof:locID="s0072" uof:attrList="值" 表:值="false"/>
+ </xsl:template>
+ <xsl:template name="字:句属性类型">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(style:text-properties/@fo:font-size,'%') or contains(style:text-properties/@style:font-size-asian,'%')">
+ <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'%')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-complex"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-family">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="style:text-properties/@fo:font-family"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-family-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-family-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@style:text-background-color and not(style:text-properties/@style:text-background-color='transparent')">
+ <xsl:element name="字:填充">
+ <xsl:element name="图:图案">
+ <xsl:attribute name="uof:locID">g0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 图形引用 前景色 背景色</xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-background-color">
+ <xsl:attribute name="图:前景色"><xsl:value-of select="style:text-properties/@style:text-background-color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-line-through-style and not(style:text-properties/@style:text-line-through-style='none')">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-underline">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-emphasize">
+ <xsl:element name="字:着重号">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:text-properties/@style:text-emphasize='none'">
+ <xsl:attribute name="字:字着重号">false</xsl:attribute>
+ <xsl:attribute name="字:类型">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:字着重号">true</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:着重号类型"><xsl:with-param name="te" select="style:text-properties/@style:text-emphasize"/></xsl:call-template></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@text:display">
+ <xsl:element name="字:隐藏文字">
+ <xsl:attribute name="uof:locID">t0097</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-outline">
+ <xsl:element name="字:空心">
+ <xsl:attribute name="uof:locID">t0098</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="style:text-properties/@style:text-outline"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-relief">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-position">
+ <xsl:element name="字:位置">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:text-position"/>
+ </xsl:element>
+ <字:上下标 uof:locID="t0205" uof:attrList="值">
+ <xsl:attribute name="字:值">none</xsl:attribute>
+ </字:上下标>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-scale">
+ <xsl:element name="字:缩放">
+ <xsl:attribute name="uof:locID">t0103</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:text-scale"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:letter-spacing">
+ <xsl:element name="字:字符间距">
+ <xsl:attribute name="uof:locID">t0104</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@fo:letter-spacing"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:letter-kerning">
+ <xsl:element name="字:调整字间距">
+ <xsl:attribute name="uof:locID">t015</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:letter-kerning"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:着重号类型">
+ <xsl:param name="te"/>
+ <xsl:choose>
+ <xsl:when test="$te='disc above' ">disc above</xsl:when>
+ <xsl:when test="$te='circle above' ">circle above</xsl:when>
+ <xsl:when test="$te='dot above' ">dot above</xsl:when>
+ <xsl:when test="$te='accent above' ">accent above</xsl:when>
+ <xsl:when test="$te='dot below' ">dot below</xsl:when>
+ <xsl:when test="$te='circle below' ">circle below</xsl:when>
+ <xsl:when test="$te='disc below' ">disc below</xsl:when>
+ <xsl:when test="$te='accent below' ">accent below</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:线型类型">
+ <xsl:variable name="spath" select="style:text-properties/@style:text-underline-style"/>
+ <xsl:variable name="wpath" select="style:text-properties/@style:text-underline-width"/>
+ <xsl:variable name="tpath" select="style:text-properties/@style:text-underline-type"/>
+ <xsl:choose>
+ <xsl:when test="$spath='solid' and not($tpath='double' ) and $wpath='auto' ">single</xsl:when>
+ <xsl:when test="$spath='solid' and $tpath='double' and $wpath='auto' ">double</xsl:when>
+ <xsl:when test="$spath='solid' and not($tpath='double' )and $wpath='bold' ">thick</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='auto' ">dotted</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='bold' ">dotted-heavy</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='auto' ">dash</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='bold' ">dashed-heavy</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='auto' ">dash-long</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='bold' ">dash-long-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='auto' ">wave</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='bold' ">wavy-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and $tpath='double' and $wpath='auto' ">wavy-double</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:delete线型类型">
+ <xsl:variable name="wpath" select="style:text-properties/@style:text-line-through-width"/>
+ <xsl:variable name="textpath" select="style:text-properties/@style:text-line-through-text"/>
+ <xsl:variable name="umpath" select="style:text-properties/@style:text-underline-mode"/>
+ <xsl:variable name="tmpath" select="style:text-properties/@style:text-line-through-mode"/>
+ <xsl:variable name="tpath" select="style:text-properties/@style:text-line-through-type"/>
+ <xsl:choose>
+ <xsl:when test="$umpath='continuous' and $tmpath='continuous'">single</xsl:when>
+ <xsl:when test="$tpath='double'">double</xsl:when>
+ <xsl:when test="$wpath='bold'">bold</xsl:when>
+ <xsl:when test="$textpath='/'">带/</xsl:when>
+ <xsl:when test="$textpath='X'">带X</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--comment: if input char is Roman,please add a prefix 'Roman_'-->
+ <xsl:template name="General-Char-Transition">
+ <xsl:param name="input-char"/>
+ <xsl:param name="output-type"/>
+ <xsl:choose>
+ <xsl:when test="$input-char='A' or $input-char='a' or $input-char='1' or $input-char='Roman_I' or $input-char='Roman_i' or $input-char='一' or $input-char='壹' or $input-char='甲' or $input-char='子'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">甲</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">子</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='B' or $input-char='b' or $input-char='2' or $input-char='Roman_II' or $input-char='Roman_ii' or $input-char='二' or $input-char='贰' or $input-char='乙' or $input-char='丑'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">2</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">b</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">B</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">II</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">2</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">2</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">2</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">乙</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">丑</xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='C' or $input-char='c' or $input-char='3' or $input-char='Roman_III' or $input-char='Roman_iii' or $input-char='三' or $input-char='叁' or $input-char='丙' or $input-char='寅'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">c</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">C</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">III</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">叁</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">3</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">丙</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">寅</xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='D' or $input-char='d' or $input-char='4' or $input-char='Roman_IV' or $input-char='Roman_iv' or $input-char='四' or $input-char='肆' or $input-char='丁' or $input-char='卯'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">4</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">d</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">D</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">4</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">四</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">4</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">4</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">丁</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">卯</xsl:when>
+ <xsl:otherwise>4</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='E' or $input-char='e' or $input-char='5' or $input-char='Roman_V' or $input-char='Roman_v' or $input-char='五' or $input-char='伍' or $input-char='戊' or $input-char='辰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">e</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">E</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">v</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">伍</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">5</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">戊</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">辰</xsl:when>
+ <xsl:otherwise>5</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='F' or $input-char='f' or $input-char='6' or $input-char='Roman_VI' or $input-char='Roman_vi' or $input-char='六' or $input-char='陆' or $input-char='己' or $input-char='巳'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">6</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">f</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">F</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">6</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">六</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">6</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">6</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">己</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">巳</xsl:when>
+ <xsl:otherwise>6</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='G' or $input-char='g' or $input-char='7' or $input-char='Roman_VII' or $input-char='Roman_vii' or $input-char='七' or $input-char='柒' or $input-char='庚' or $input-char='午'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">7</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">g</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">G</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">7</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">7</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">7</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">庚</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">午</xsl:when>
+ <xsl:otherwise>7</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='H' or $input-char='h' or $input-char='8' or $input-char='Roman_VIII' or $input-char='Roman_viii' or $input-char='八' or $input-char='捌' or $input-char='辛' or $input-char='未'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">h</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">H</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">viii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">八</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">捌</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">8</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">辛</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">未</xsl:when>
+ <xsl:otherwise>8</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='I' or $input-char='i' or $input-char='9' or $input-char='Roman_IX' or $input-char='Roman_ix' or $input-char='九' or $input-char='玖' or $input-char='壬' or $input-char='申'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">9</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">i</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">9</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">九</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">9</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">9</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">壬</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">申</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='J' or $input-char='j' or $input-char='10' or $input-char='Roman_X' or $input-char='Roman_x' or $input-char='十' or $input-char='拾' or $input-char='癸' or $input-char='酉'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">j</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">J</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">x</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">10</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">癸</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">酉</xsl:when>
+ <xsl:otherwise>10</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='K' or $input-char='k' or $input-char='11' or $input-char='Roman_XI' or $input-char='Roman_xi' or $input-char='十一' or $input-char='拾壹' or $input-char='戌'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">k</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">K</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">11</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">戌</xsl:when>
+ <xsl:otherwise>11</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='L' or $input-char='l' or $input-char='12' or $input-char='Roman_XII' or $input-char='Roman_xii' or $input-char='十二' or $input-char='拾贰' or $input-char='亥'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">l</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">L</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">12</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">亥</xsl:when>
+ <xsl:otherwise>12</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='M' or $input-char='m' or $input-char='13' or $input-char='Roman_XIII' or $input-char='Roman_xiii' or $input-char='十三' or $input-char='拾叁'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">m</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">M</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾叁</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">13</xsl:when>
+ <xsl:otherwise>13</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='N' or $input-char='n' or $input-char='14' or $input-char='Roman_XIV' or $input-char='Roman_xiv' or $input-char='十四' or $input-char='拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">n</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">N</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十四</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">14</xsl:when>
+ <xsl:otherwise>14</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='O' or $input-char='o' or $input-char='15' or $input-char='Roman_XV' or $input-char='Roman_xv' or $input-char='十五' or $input-char='拾伍'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">o</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">O</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾伍</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">15</xsl:when>
+ <xsl:otherwise>15</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='P' or $input-char='p' or $input-char='16' or $input-char='Roman_XVI' or $input-char='Roman_xvi' or $input-char='十六' or $input-char='拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">p</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">P</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十六</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">16</xsl:when>
+ <xsl:otherwise>16</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Q' or $input-char='q' or $input-char='17' or $input-char='Roman_XVII' or $input-char='Roman_xvii' or $input-char='十七' or $input-char='拾柒'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">q</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Q</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">17</xsl:when>
+ <xsl:otherwise>17</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='R' or $input-char='r' or $input-char='18' or $input-char='Roman_XVIII' or $input-char='Roman_xviii' or $input-char='十八' or $input-char='拾捌'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">r</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">R</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xviii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十八</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾捌</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">18</xsl:when>
+ <xsl:otherwise>18</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='S' or $input-char='s' or $input-char='19' or $input-char='Roman_XIX' or $input-char='Roman_xix' or $input-char='十九' or $input-char='拾玖'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">s</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">S</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十九</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">19</xsl:when>
+ <xsl:otherwise>19</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='T' or $input-char='t' or $input-char='20' or $input-char='Roman_XX' or $input-char='Roman_xx' or $input-char='二十' or $input-char='贰拾'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">t</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">T</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xx</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">20</xsl:when>
+ <xsl:otherwise>20</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='U' or $input-char='u' or $input-char='21' or $input-char='Roman_XXI' or $input-char='Roman_xxi' or $input-char='二十一' or $input-char='贰拾壹'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">u</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">U</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">21</xsl:when>
+ <xsl:otherwise>21</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='V' or $input-char='v' or $input-char='22' or $input-char='Roman_XXII' or $input-char='Roman_xxii' or $input-char='二十二' or $input-char='贰拾贰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">v</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">22</xsl:when>
+ <xsl:otherwise>22</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='W' or $input-char='w' or $input-char='23' or $input-char='Roman_XXIII' or $input-char='Roman_xxiii' or $input-char='二十三' or $input-char='贰拾叁'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">w</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">W</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾叁</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">23</xsl:when>
+ <xsl:otherwise>23</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='X' or $input-char='x' or $input-char='24' or $input-char='Roman_XXIV' or $input-char='Roman_xxiv' or $input-char='二十四' or $input-char='贰拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">x</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十四</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">24</xsl:when>
+ <xsl:otherwise>24</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Y' or $input-char='y' or $input-char='25' or $input-char='Roman_XXV' or $input-char='Roman_xxv' or $input-char='二十五' or $input-char='贰拾伍'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">y</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Y</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾伍</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">25</xsl:when>
+ <xsl:otherwise>25</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Z' or $input-char='z' or $input-char='26' or $input-char='Roman_XXVI' or $input-char='Roman_xxvi' or $input-char='二十六' or $input-char='贰拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">z</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Z</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十六</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">26</xsl:when>
+ <xsl:otherwise>26</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--RedOffice comment (Zengjh) end charts-->
+ <!-- 以下模板的作用是将网格线的R或者G或者B颜色从十进制转换为16进制-->
+ <xsl:template name="transform-decimal-to-hexadecimal">
+ <xsl:param name="color-decimal"/>
+ <xsl:variable name="first-number" select="floor($color-decimal div 16)"/>
+ <xsl:variable name="first-char">
+ <xsl:call-template name="decimal-to-hex">
+ <xsl:with-param name="number" select="$first-number"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="second-number" select="$color-decimal - ($first-number * 16)"/>
+ <xsl:variable name="second-char">
+ <xsl:call-template name="decimal-to-hex">
+ <xsl:with-param name="number" select="$second-number"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($first-char,$second-char)"/>
+ </xsl:template>
+ <!-- 以下模板的作用为将0到15的整数转换为16进制数-->
+ <xsl:template name="decimal-to-hex">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number=0">0</xsl:when>
+ <xsl:when test="$number=1">1</xsl:when>
+ <xsl:when test="$number=2">2</xsl:when>
+ <xsl:when test="$number=3">3</xsl:when>
+ <xsl:when test="$number=4">4</xsl:when>
+ <xsl:when test="$number=5">5</xsl:when>
+ <xsl:when test="$number=6">6</xsl:when>
+ <xsl:when test="$number=7">7</xsl:when>
+ <xsl:when test="$number=8">8</xsl:when>
+ <xsl:when test="$number=9">9</xsl:when>
+ <xsl:when test="$number=10">a</xsl:when>
+ <xsl:when test="$number=11">b</xsl:when>
+ <xsl:when test="$number=12">c</xsl:when>
+ <xsl:when test="$number=13">d</xsl:when>
+ <xsl:when test="$number=14">e</xsl:when>
+ <xsl:when test="$number='15'">f</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="setDefaultPageWidth">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='inch'">
+ <xsl:value-of select="'7.9'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='cm'">
+ <xsl:value-of select="'20.999'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='mm'">
+ <xsl:value-of select="'200.99'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='pt'">
+ <xsl:value-of select="'7870'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'20.990'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="setDefaultPageHeight">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='inch'">
+ <xsl:value-of select="'10.14'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='cm'">
+ <xsl:value-of select="'26.999'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='mm'">
+ <xsl:value-of select="'269.99'"/>
+ </xsl:when>
+ <xsl:when test="$uofUnit='pt'">
+ <xsl:value-of select="'1023'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'26.990'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--ro000179 chenjh-->
+ <xsl:template name="create-condition-format">
+ <xsl:variable name="unique-map-cellstyle" select="/office:document/office:automatic-styles/style:style[style:map and not(style:map/@style:condition=preceding-sibling::style:style/style:map/@style:condition and style:map/@style:apply-style-name=preceding-sibling::style:style/style:map/@style:apply-style-name and style:map/@style:base-cell-address=preceding-sibling::style:style/style:map/@style:base-cell-address)]"/>
+ <xsl:for-each select="$unique-map-cellstyle">
+ <xsl:call-template name="create-cell-condition-format"/>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="create-cell-condition-format">
+ <xsl:element name="表:条件格式化">
+ <xsl:attribute name="uof:locID">s0017</xsl:attribute>
+ <xsl:element name="表:区域">
+ <xsl:attribute name="uof:locID">s0007</xsl:attribute>
+ <xsl:variable name="cellstylenamelist">
+ <xsl:call-template name="createcellnamelist">
+ <xsl:with-param name="list">
+ <xsl:value-of select="/office:document/office:automatic-styles/style:style[style:map and (style:map/@style:condition=current()/style:map/@style:condition and style:map/@style:apply-style-name=current()/style:map/@style:apply-style-name and style:map/@style:base-cell-address=current()/style:map/@style:base-cell-address)]"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- <xsl:value-of select="concat($cellstylenamelist,'end')"/>-->
+ <xsl:variable name="left-top">
+ <xsl:call-template name="search-left-top">
+ <xsl:with-param name="cellstylenamelist" select="$cellstylenamelist"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- <xsl:value-of select="concat('qqqqqqqq ',$left-top)"/> -->
+ <xsl:variable name="after-tanslated-left-top">
+ <xsl:call-template name="translate-left-top-condition">
+ <xsl:with-param name="left-top" select="$left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($after-tanslated-left-top,':',style:map/@style:base-cell-address)"/>
+ </xsl:element>
+ <xsl:for-each select="style:map">
+ <xsl:element name="表:条件">
+ <xsl:attribute name="uof:locID">s0019</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:variable name="conditiontext" select="@style:condition"/>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="contains($conditiontext,'cell-content')">cell value</xsl:when><xsl:when test="contains($conditiontext,'is-true-formula')">formula</xsl:when><xsl:otherwise>条件字符串错误!</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="表:操作码">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($conditiontext,'is-true-formula')">equal to</xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content()')">
+ <xsl:variable name="operatortext" select="substring-after($conditiontext,'cell-content()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'&lt;=')">less than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;=')">greater than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'&lt;')">less than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;')">greater than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'!=')">not equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'=')">equal to</xsl:when>
+ <!-- 注意:uof有的另几种操作码在oo中没有,他们是contain,not contain,start with,not start with, end with,not end with-->
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-between')">between</xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-not-between')">not between</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:第一操作数">
+ <xsl:attribute name="uof:locID">s0010</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($conditiontext,'is-true-formula')">
+ <xsl:value-of select="substring(substring-after($conditiontext,'is-true-formula('),1,string-length($conditiontext)-1-string-length('is-true-formula('))"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'cell-content-is-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content-is-not-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'cell-content-is-not-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'cell-content()')">
+ <xsl:variable name="operatortext" select="substring-after($conditiontext,'cell-content()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'&lt;=')">
+ <xsl:value-of select="substring-after($conditiontext,'&lt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;=')">
+ <xsl:value-of select="substring-after($conditiontext,'&gt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'&lt;')">
+ <xsl:value-of select="substring-after($conditiontext,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'&gt;')">
+ <xsl:value-of select="substring-after($conditiontext,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'!=')">
+ <xsl:value-of select="substring-after($conditiontext,'!=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'=')">
+ <xsl:value-of select="substring-after($conditiontext,'=')"/>
+ </xsl:when>
+ <!-- 注意:uof有的另几种操作码在oo中没有,他们是contain,not contain,start with,not start with, end with,not end with-->
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="starts-with($conditiontext,'cell-content-is-between') or starts-with($conditiontext,'cell-content-is-not-between')">
+ <xsl:element name="表:第二操作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:value-of select="substring(substring-after($conditiontext,','),1,string-length(substring-after($conditiontext,','))-1)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:格式">
+ <xsl:variable name="apply-style-name" select="@style:apply-style-name"/>
+ <xsl:attribute name="uof:locID">s0023</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="表:式样引用"><xsl:value-of select="$apply-style-name"/></xsl:attribute>
+ <!--xsl:attribute name="表:式样引用"><xsl:value-of select="generate-id(//style:style[@style:name=$apply-style-name])"/></xsl:attribute-->
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="createcellnamelist">
+ <xsl:param name="list"/>
+ <xsl:choose>
+ <xsl:when test="$list">
+ <xsl:variable name="first" select="$list[1]"/>
+ <xsl:variable name="stringlist-of-rest">
+ <xsl:call-template name="createcellnamelist">
+ <xsl:with-param name="list" select="$list[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($first/@style:name,' ',$stringlist-of-rest)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top">
+ <xsl:param name="cellstylenamelist"/>
+ <xsl:choose>
+ <xsl:when test="$cellstylenamelist!=''">
+ <xsl:variable name="first-cellstylename" select="substring-before($cellstylenamelist, ' ')"/>
+ <xsl:variable name="tableslist" select="/office:document/office:body/office:spreadsheet/table:table"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle">
+ <xsl:with-param name="cellstylename" select="$first-cellstylename"/>
+ <xsl:with-param name="tableslist" select="$tableslist"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top">
+ <xsl:with-param name="cellstylenamelist" select="substring-after($cellstylenamelist,' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="final-left-top">
+ <xsl:choose>
+ <xsl:when test="$rest-left-top =''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$first-left-top =''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="after-compared-left-top">
+ <xsl:call-template name="compare-two-left-top">
+ <xsl:with-param name="first" select="$first-left-top"/>
+ <xsl:with-param name="second" select="$rest-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$after-compared-left-top"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$final-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-left-top-condition">
+ <xsl:param name="left-top"/>
+ <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat(substring-before($left-top,'.'),'.',$column-character1,$column-character2,substring-after($left-top,' '))"/>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle">
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="tableslist"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$tableslist and $return=''">
+ <xsl:variable name="firsttablerows" select="$tableslist[1]//table:table-row"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inatable">
+ <xsl:with-param name="row-num" select="'1'"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle">
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top!=''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="compare-two-left-top">
+ <xsl:param name="first"/>
+ <xsl:param name="second"/>
+ <xsl:variable name="first-column" select="substring-before(substring-after($first,'.'),' ')"/>
+ <xsl:variable name="first-row" select="substring-after($first,' ')"/>
+ <xsl:variable name="second-column" select="substring-before(substring-after($second,'.'),' ')"/>
+ <xsl:variable name="second-row" select="substring-after($second,' ')"/>
+ <xsl:choose>
+ <xsl:when test="$first-row&lt;$second-row">
+ <xsl:value-of select="$first"/>
+ </xsl:when>
+ <xsl:when test="$first-row=$second-row">
+ <xsl:choose>
+ <xsl:when test="$first-column&lt;=$second-column">
+ <xsl:value-of select="$first"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle-inatable">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firsttablerows"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firsttablerows and $return=''">
+ <xsl:variable name="firstcells" select="$firsttablerows[1]/table:table-cell"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="'1'"/>
+ <xsl:with-param name="firstcells" select="$firstcells"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="row-num-p">
+ <xsl:choose>
+ <xsl:when test="$firsttablerows[1]/@table:number-rows-repeated">
+ <xsl:value-of select="$row-num+ $firsttablerows[1]/@table:number-rows-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-num+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inatable">
+ <xsl:with-param name="row-num" select="$row-num-p"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle-inarow">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="firstcells"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firstcells and $return=''">
+ <xsl:variable name="firstcell" select="$firstcells[1]"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inacell">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="cell" select="$firstcell"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-num-p">
+ <xsl:choose>
+ <xsl:when test="$firstcell/@table:number-columns-repeated">
+ <xsl:value-of select="$column-num+ $firstcell/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$column-num+ 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-with-one-cellstyle-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num-p"/>
+ <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-with-one-cellstyle-inacell">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:choose>
+ <xsl:when test="$cell/@table:style-name">
+ <xsl:if test="$cell/@table:style-name=$cellstylename">
+ <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="style-is-default">
+ <xsl:call-template name="is-default-or-not">
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="cell" select="$cell"/>
+ <xsl:with-param name="preceding-cellstylename" select="''"/>
+ <xsl:with-param name="temp-num" select="'0'"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="table-collumns" select="$cell/ancestor::table:table//table:table-column "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$style-is-default='yes' ">
+ <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="is-default-or-not">
+ <xsl:param name="column-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="preceding-cellstylename"/>
+ <xsl:param name="temp-num"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="table-collumns"/>
+ <xsl:choose>
+ <xsl:when test="$temp-num&lt;$column-num">
+ <xsl:variable name="firstcolumn">
+ <xsl:choose>
+ <xsl:when test="$table-collumns[1]/@table:number-columns-repeated">
+ <xsl:value-of select="$table-collumns[1]/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'1'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="preceding-cellstylename-to-param">
+ <xsl:choose>
+ <xsl:when test="$table-collumns[1]/@table:default-cell-style-name">
+ <xsl:value-of select="$table-collumns[1]/@table:default-cell-style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="is-default-or-not">
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="temp-num" select="$temp-num + $firstcolumn"/>
+ <xsl:with-param name="preceding-cellstylename" select="$preceding-cellstylename-to-param"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="table-collumns" select="$table-collumns[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$cellstylename=$preceding-cellstylename">
+ <xsl:value-of select="'yes'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'no'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="table:tracked-changes">
+ <xsl:for-each select="/office:document/office:body/office:spreadsheet/table:tracked-changes">
+ <xsl:if test="table:cell-content-change/table:cell-address">
+ <xsl:variable name="row" select="table:cell-content-change/table:cell-address/@table:row"/>
+ <xsl:variable name="column" select="table:cell-content-change/table:cell-address/@table:column"/>
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat($row,'-',$column)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">format</xsl:attribute>
+ <xsl:if test="table:cell-content-change/office:change-info and table:cell-content-change/table:previous">
+ <xsl:variable name="creator" select="table:cell-content-change/office:change-info/dc:creator"/>
+ <xsl:variable name="date" select="table:cell-content-change/office:change-info/dc:date"/>
+ <xsl:variable name="text" select="table:cell-content-change/table:previous/table:change-track-table-cell/text:p"/>
+ <xsl:attribute name="字:修订信息引用"><xsl:value-of select="concat($creator,'+',$date,'%',$text)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="字:修订结束">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <uof:字体集 uof:locID="u0040">
+ <xsl:for-each select="style:font-face">
+ <xsl:element name="uof:字体声明">
+ <xsl:attribute name="uof:attrList">标识符 名称 字体族</xsl:attribute>
+ <xsl:attribute name="uof:locID">u0041</xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="translate(@style:name,' ','_')"/></xsl:attribute>
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="uof:字体族"><xsl:value-of select="@svg:font-family"/></xsl:attribute>
+ <!-- added by glu, for process special fonts e.g. Marlett, -->
+ <!--chengxz 060821 delete uof:字符集,because there is no this attr-->
+ <!--xsl:if test="@style:font-charset= '02'">
+ <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute>
+ </xsl:if-->
+ <!--xsl:if test="@style:font-family-generic">
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <xsl:attribute name="uof:字体族">Swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='modern'">
+ <xsl:attribute name="uof:字体族">Modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic='roman'">
+ <xsl:attribute name="uof:字体族">Roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='script'">
+ <xsl:attribute name="uof:字体族">Script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='decorative'">
+ <xsl:attribute name="uof:字体族">Decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='system'">
+ <xsl:attribute name="uof:字体族">System</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:字体族">System</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if-->
+ <!--xsl:if test="@style:font-pitch">
+ <xsl:attribute name="uof:字号">12</xsl:attribute>
+ </xsl:if-->
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="style:font-face"/>
+ </uof:字体集>
+ </xsl:template>
+ <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/>
+ <xsl:template match="style:style" mode="styles">
+ <xsl:param name="isAutomatic"/>
+ <xsl:param name="styleName" select="@style:name"/>
+ <xsl:choose>
+ <xsl:when test="@style:family='text'">
+ <xsl:element name="uof:句式样">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:call-template name="字:字体"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@style:family='paragraph'">
+ <xsl:element name="uof:段落式样">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:text-properties">
+ <xsl:element name="uof:句式样">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">custum</xsl:attribute>
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ <xsl:call-template name="字:字体"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="uof:单元格式样">
+ <xsl:attribute name="uof:locID">u0046</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ <xsl:attribute name="表:标识符"><xsl:value-of select="$styleName"/></xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="ancestor::office:automatic-styles">auto</xsl:when><xsl:when test="ancestor::office:styles">custom</xsl:when><xsl:otherwise>default</xsl:otherwise></xsl:choose></xsl:attribute>
+ <!--xsl:attribute name="表:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute-->
+ <xsl:choose>
+ <xsl:when test="style:map">
+ <xsl:attribute name="表:名称"><xsl:value-of select="style:map/@style:apply-style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="not($isAutomatic)">
+ <xsl:choose>
+ <xsl:when test="$styleName='Default'">
+ <xsl:attribute name="表:名称"><xsl:value-of select="'Normal'"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="表:名称"><xsl:value-of select="$styleName"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!--xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="表:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if-->
+ <!--chengxz chang the order-->
+ <xsl:variable name="styleProperties" select="key('styles', $styleName)/*"/>
+ <xsl:call-template name="Font">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ </xsl:call-template>
+ <xsl:call-template name="Alignment">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ </xsl:call-template>
+ <!--chenjh changed 1103-->
+ <!--xsl:if test="/*/office:automatic-styles/style:style[@style:name=/*/office:body/table:table/table:table-row/table:table-cell/@table:style-name]/style:properties/@fo:border"-->
+ <xsl:if test="@style:data-style-name">
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26-->
+ <xsl:call-template name="NumberFormat">
+ <xsl:with-param name="temp-style" select="@style:data-style-name"/>
+ </xsl:call-template>
+ <!--RedOffice comment (Zengjh) end-->
+ </xsl:if>
+ <xsl:call-template name="Border">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ <!--xsl:with-param name="styleProperties" select="/*/office:automatic-styles/style:style"/-->
+ </xsl:call-template>
+ <!--/xsl:if-->
+ <!--chenjh end 1103-->
+ <xsl:call-template name="Interior">
+ <xsl:with-param name="styleProperties" select="$styleProperties"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:字体">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@fo:font-size-asian or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size">
+ <xsl:attribute name="字:字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@fo:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size"><xsl:value-of select="substring-before(style:text-properties/@style:font-size,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="style:text-properties/@style:font-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name-complex">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-name-complex"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-line-through-style and not(style:text-properties/@style:text-line-through-style='none')">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-underline-style">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-position">
+ <xsl:element name="字:位置">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:value-of select="style:text-properties/@style:text-position"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-01 Based on Original-->
+ <xsl:template name="NumberFormat">
+ <xsl:param name="temp-style"/>
+ <xsl:for-each select="(/*/office:styles/child::*[@style:name=$temp-style]) | (/*/office:automatic-styles/child::*[@style:name=$temp-style])">
+ <表:数字格式 uof:locID="s0021" uof:attrList="分类名称 格式码">
+ <xsl:attribute name="表:分类名称"><xsl:choose><xsl:when test="name(.)='number:currency-style'">currency</xsl:when><xsl:when test="name(.)='number:percentage-style'">percentage</xsl:when><xsl:when test="name(.)='number:date-style'">date</xsl:when><xsl:when test="name(.)='number:time-style'">time</xsl:when><xsl:when test="name(.)='number:boolean-style'">custom</xsl:when><xsl:when test="name(.)='number:text-style'">text</xsl:when><xsl:when test="name(.)='number:number-style'"><xsl:choose><xsl:when test="number:fraction">fraction</xsl:when><xsl:when test="number:scientific-number">scientific</xsl:when><xsl:otherwise>number</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>general</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:格式码"><xsl:call-template name="element-attribute"/><xsl:for-each select="style:map"><xsl:text>[</xsl:text><xsl:value-of select="@style:condition"/><xsl:text>]</xsl:text><xsl:variable name="apply-style" select="@style:apply-style-name"/><xsl:for-each select="../../child::*[@style:name=$apply-style]/*"><xsl:call-template name="general-number-format"/></xsl:for-each><xsl:text>;</xsl:text></xsl:for-each><xsl:for-each select="*[not(name(.)='style:map')]"><xsl:call-template name="general-number-format"/></xsl:for-each></xsl:attribute>
+ </表:数字格式>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="general-number-format">
+ <xsl:choose>
+ <xsl:when test="name(.)='style:text-properties'">
+ <xsl:call-template name="general-color-format"/>
+ </xsl:when>
+ <xsl:when test="name(.)='number:text'">&quot;<xsl:value-of select="text()"/>&quot;</xsl:when>
+ <xsl:when test="name(.)='number:text-content' ">@</xsl:when>
+ <xsl:when test="name(.)='number:boolean'">boolean</xsl:when>
+ <xsl:when test="name(.)='number:currency-symbol'">
+ <xsl:call-template name="general-currency-format"/>
+ </xsl:when>
+ <xsl:when test="name(.)='number:fraction' or name(.)='number:number' or name(.)='number:scientific-number'">
+ <xsl:if test="@number:min-integer-digits and not(@number:grouping)">
+ <xsl:choose>
+ <xsl:when test="@number:min-integer-digits='0'">#</xsl:when>
+ <xsl:when test="@number:min-integer-digits='1'">0</xsl:when>
+ <xsl:when test="@number:min-integer-digits='2'">00</xsl:when>
+ <xsl:when test="@number:min-integer-digits='3'">000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='4'">0000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='5'">00000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='6'">000000</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-integer-digits and @number:grouping">
+ <xsl:choose>
+ <xsl:when test="@number:min-integer-digits='0'">#,###</xsl:when>
+ <xsl:when test="@number:min-integer-digits='1'">#,##0</xsl:when>
+ <xsl:when test="@number:min-integer-digits='2'">#,#00</xsl:when>
+ <xsl:when test="@number:min-integer-digits='3'">#,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='4'">##0,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='5'">#00,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='6'">#,000,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='7'">##0,000,000</xsl:when>
+ <xsl:when test="@number:min-integer-digits='8'">#,#00,000,000</xsl:when>
+ <xsl:otherwise>#,##0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:decimal-places and not(@number:decimal-replacement)">
+ <xsl:choose>
+ <xsl:when test="@number:decimal-places='0'"/>
+ <xsl:when test="@number:decimal-places='1'">.0</xsl:when>
+ <xsl:when test="@number:decimal-places='2'">.00</xsl:when>
+ <xsl:when test="@number:decimal-places='3'">.000</xsl:when>
+ <xsl:when test="@number:decimal-places='4'">.0000</xsl:when>
+ <xsl:when test="@number:decimal-places='5'">.00000</xsl:when>
+ <xsl:when test="@number:decimal-places='6'">.000000</xsl:when>
+ <xsl:otherwise>.00</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:decimal-places and @number:decimal-replacement">
+ <xsl:choose>
+ <xsl:when test="@number:decimal-places='0'"/>
+ <xsl:when test="@number:decimal-places='1'">.#</xsl:when>
+ <xsl:when test="@number:decimal-places='2'">.##</xsl:when>
+ <xsl:when test="@number:decimal-places='3'">.###</xsl:when>
+ <xsl:when test="@number:decimal-places='4'">.####</xsl:when>
+ <xsl:when test="@number:decimal-places='5'">.#####</xsl:when>
+ <xsl:when test="@number:decimal-places='6'">.######</xsl:when>
+ <xsl:otherwise>.##</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:display-factor">
+ <xsl:choose>
+ <xsl:when test="@number:display-factor='1000'">,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000'">,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000'">,,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000000000'">,,,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000000000000'">,,,,,</xsl:when>
+ <xsl:when test="@number:display-factor='1000000000000000000000'">,,,,,</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-exponent-digits">
+ <xsl:choose>
+ <xsl:when test="@number:min-exponent-digits='1'">E+0</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='2'">E+00</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='3'">E+000</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='4'">E+0000</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='5'">E+00000</xsl:when>
+ <xsl:when test="@number:min-exponent-digits='6'">E+000000</xsl:when>
+ <xsl:otherwise>E+00</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-numerator-digits">
+ <xsl:choose>
+ <xsl:when test="@number:min-numerator-digits='1' "> ?</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='2' "> ??</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='3' "> ???</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='4' "> ????</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='5' "> ?????</xsl:when>
+ <xsl:when test="@number:min-numerator-digits='6' "> ??????</xsl:when>
+ <xsl:otherwise> ???</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@number:min-denominator-digits">
+ <xsl:choose>
+ <xsl:when test="@number:min-denominator-digits='1' ">/?</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='2' ">/??</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='3' ">/???</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='4' ">/????</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='5' ">/?????</xsl:when>
+ <xsl:when test="@number:min-denominator-digits='6' ">/??????</xsl:when>
+ <xsl:otherwise>/???</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="name(.)='number:year'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">YYYY</xsl:when>
+ <xsl:otherwise>YY</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:month'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' and @number:textual='true'">MMMM</xsl:when>
+ <xsl:when test="not(@number:style='long') and @number:textual='true'">MMM</xsl:when>
+ <xsl:when test="@number:style='long' and not(@number:textual)">MM</xsl:when>
+ <xsl:when test="not(@number:style='long') and not(@number:textual)">M</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:day'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">DD</xsl:when>
+ <xsl:otherwise>D</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:day-of-week'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">NNNN</xsl:when>
+ <xsl:otherwise>NNN</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:quarter'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">QQ</xsl:when>
+ <xsl:otherwise>Q</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:hours'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' and ../@number:truncate-on-overflow='false'">[HH]</xsl:when>
+ <xsl:when test="@number:style='long'">HH</xsl:when>
+ <xsl:otherwise>H</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:minutes'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">MM</xsl:when>
+ <xsl:otherwise>M</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:seconds'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' and @number:decimal-places='2'">SS.00</xsl:when>
+ <xsl:when test="@number:style='long'">SS</xsl:when>
+ <xsl:otherwise>S</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name(.)='number:am-pm'">AM/PM</xsl:when>
+ <xsl:when test="name(.)='number:week-of-year'">
+ <xsl:choose>
+ <xsl:when test="@number:style='long'">WW</xsl:when>
+ <xsl:otherwise>WW</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="general-color-format">
+ <xsl:choose>
+ <xsl:when test="@fo:color='#000000'">[Black]</xsl:when>
+ <xsl:when test="@fo:color='#0000ff'">[Blue]</xsl:when>
+ <xsl:when test="@fo:color='#00ffff'">[Cyan]</xsl:when>
+ <xsl:when test="@fo:color='#00ff00'">[Green]</xsl:when>
+ <xsl:when test="@fo:color='#ff00ff'">[Magenta]</xsl:when>
+ <xsl:when test="@fo:color='#ff0000'">[Red]</xsl:when>
+ <xsl:when test="@fo:color='#ffffff'">[White]</xsl:when>
+ <xsl:when test="@fo:color='#ffff00'">[Yellow]</xsl:when>
+ <xsl:otherwise>[Black]</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="general-currency-format">
+ <xsl:choose>
+ <xsl:when test="text()='¥' and @number:language='zh' and @number:country='CN'">[$¥-804]</xsl:when>
+ <xsl:when test="text()='$' and @number:language='en' and @number:country='US'">[$$-409]</xsl:when>
+ <xsl:when test="text()='$' and @number:language='es' and @number:country='AR'">[$$-2C0A]</xsl:when>
+ <xsl:when test="text()='$' and @number:language='fr' and @number:country='CA'">[$$-C0C]</xsl:when>
+ <xsl:when test="text()='CNY'">[$CNY]</xsl:when>
+ <xsl:when test="text()='AFA'">[$AFA]</xsl:when>
+ <xsl:when test="text()='CCC'">CCC</xsl:when>
+ <xsl:otherwise>¥</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="element-attribute">
+ <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='short'">[NatNum1]</xsl:if>
+ <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='medium'">[NatNum7]</xsl:if>
+ <xsl:if test="@number:transliteration-format='一' and @number:transliteration-style='long'">[NatNum4]</xsl:if>
+ <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='short'">[NatNum2]</xsl:if>
+ <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='medium'">[NatNum8]</xsl:if>
+ <xsl:if test="@number:transliteration-format='壹' and @number:transliteration-style='long'">[NatNum5]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='short'">[NatNum3]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='medium'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='long'">[NatNum6]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='short'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='medium'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-format='1' and @number:transliteration-style='long'">[NatNum0]</xsl:if>
+ <xsl:if test="@number:transliteration-language='zh' and @number:transliteration-country='CN'">[$-804]</xsl:if>
+ </xsl:template>
+ <!--RedOffice comment (Zengjh) end-->
+ <!--huangzf0715-->
+ <xsl:template name="Alignment">
+ <xsl:param name="styleProperties"/>
+ <xsl:if test="($styleProperties/@fo:text-align) or ($styleProperties/@style:vertical-align) or ($styleProperties/@fo:wrap-option) or($styleProperties/@fo:margin-left) or ($styleProperties/@style:rotation-angle) or ($styleProperties/@style:direction)">
+ <xsl:element name="表:对齐格式">
+ <xsl:attribute name="uof:locID">s0114</xsl:attribute>
+ <xsl:if test="$styleProperties/@fo:margin-left">
+ <xsl:attribute name="表:缩进"><xsl:variable name="margin"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@fo:margin-left"/><xsl:with-param name="rounding-factor" select="1"/></xsl:call-template></xsl:variable><xsl:value-of select="number($margin) div 10"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="表:水平对齐方式">
+ <xsl:attribute name="uof:locID">s0115</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:text-align">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:text-align = 'center'">center</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'end'">right</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'justify'">justify</xsl:when>
+ <xsl:when test="$styleProperties/@fo:text-align = 'start'">left</xsl:when>
+ <xsl:otherwise>fill</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>general</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="($styleProperties/@style:vertical-align) or ($styleProperties/@fo:vertical-align)">
+ <xsl:element name="表:垂直对齐方式">
+ <xsl:attribute name="uof:locID">s0116</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'bottom'">bottom</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'middle'">center</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'justify'">justify</xsl:when>
+ <xsl:when test="$styleProperties/@fo:vertical-align = 'top'">top</xsl:when>
+ <xsl:otherwise>distributed</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:文字方向">
+ <xsl:attribute name="uof:locID">s0118</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:direction = 'ttb'">vertical</xsl:when>
+ <xsl:otherwise>horizontal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$styleProperties/@style:rotation-angle">
+ <xsl:element name="表:文字旋转角度">
+ <xsl:attribute name="uof:locID">s0119</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt; 90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &gt;= 270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle - 180"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt; -90">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:rotation-angle &lt;= -270">
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle + 180"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$styleProperties/@style:rotation-angle"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:wrap-option = 'wrap'">
+ <xsl:element name="表:自动换行">
+ <xsl:attribute name="uof:locID">s0120</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:shrink-to-fit">
+ <xsl:element name="表:缩小字体填充">
+ <xsl:attribute name="uof:locID">s0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="$styleProperties/@style:shrink-to-fit"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="Font">
+ <xsl:param name="styleProperties"/>
+ <!--xsl:if test="(style:text-properties/@fo:font-weight) or (style:text-properties/@fo:color) or ($styleProperties/@style:font-name) or ($styleProperties/@fo:font-style) or ($styleProperties/@style:text-outline) or ($styleProperties/@style:text-shadow) or ($styleProperties/@style:font-size) or ($styleProperties/@style:text-crossing-out) or ($styleProperties/@style:text-underline) or ($styleProperties/@style:text-underline-style) or ($styleProperties/@style:text-position)"-->
+ <xsl:if test="not(@style:name='Default')">
+ <xsl:element name="表:字体格式">
+ <xsl:attribute name="uof:locID">s0113</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:if test="$styleProperties/@fo:font-weight or $styleProperties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$styleProperties/@style:font-weight-asian='bold' or $styleProperties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:font-style or $styleProperties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$styleProperties/@fo:font-style='italic' or $styleProperties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-outline = 'true'">
+ <字:空心 uof:locID="t0098" uof:attrList="值" 字:值="true"/>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-shadow = 'shadow'">
+ <字:阴影 uof:locID="t0100" uof:attrList="值" 字:值="true"/>
+ </xsl:if>
+ <xsl:if test="(style:text-properties/@style:text-underline-style) and ($styleProperties/@style:text-underline-style != 'none')">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字下划线</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:attribute name="字:字下划线">true</xsl:attribute>
+ <xsl:if test="$styleProperties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="$styleProperties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="$styleProperties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-line-through-style and not($styleProperties/@style:text-line-through-style='none')">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:delete线型类型"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-emphasize">
+ <xsl:element name="字:着重号">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:text-emphasize='none'">
+ <xsl:attribute name="字:字着重号">false</xsl:attribute>
+ <xsl:attribute name="字:类型">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:字着重号">true</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:着重号类型"><xsl:with-param name="te" select="$styleProperties/@style:text-emphasize"/></xsl:call-template></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$styleProperties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="$styleProperties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:text-position">
+ <xsl:element name="字:上下标">
+ <xsl:choose>
+ <xsl:when test="substring-before($styleProperties/@style:text-position, '% ') &gt; 0">
+ <xsl:attribute name="字:上下标">sup</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:上下标">sub</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute>
+ <xsl:if test="$styleProperties/@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="translate($styleProperties/@style:font-name-asian,' ','_')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@style:font-name or $styleProperties/@fo:font-family">
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@style:font-name">
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($styleProperties/@style:font-name,' ','_')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($styleProperties/@fo:font-family,' ','_')"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$styleProperties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="$styleProperties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:font-size">
+ <xsl:attribute name="字:字号"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@fo:font-size"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:font-size-asian">
+ <xsl:attribute name="字:字号"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@style:font-size-asian"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$styleProperties/@style:font-size-complex">
+ <xsl:attribute name="字:字号"><xsl:call-template name="convert2pt"><xsl:with-param name="value" select="$styleProperties/@style:font-size-complex"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@style:font-relief">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="Border">
+ <xsl:param name="styleProperties"/>
+ <xsl:if test="style:table-cell-properties/@fo:border and not($styleProperties/@fo:border-top or $styleProperties/@fo:border-left or $styleProperties/@fo:border-bottom or $styleProperties/@fo:border-right)">
+ <xsl:element name="表:边框">
+ <xsl:attribute name="uof:locID">s0022</xsl:attribute>
+ <xsl:variable name="border">
+ <xsl:value-of select="$styleProperties/@fo:border"/>
+ </xsl:variable>
+ <xsl:element name="uof:左">
+ <xsl:attribute name="uof:locID">u0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="uof:上">
+ <xsl:attribute name="uof:locID">u0058</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="uof:右">
+ <xsl:attribute name="uof:locID">u0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) &gt;0 or contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="uof:下">
+ <xsl:attribute name="uof:locID">u0060</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) &gt;0 or contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="$styleProperties/@style:diagonal-bl-tr">
+ <xsl:element name="uof:对角线1">
+ <xsl:attribute name="uof:locID">u0061</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-bl-tr, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线1-->
+ <!--xsl:if test="$styleProperties/@fo:border and $styleProperties/@style:diagonal-tl-br"-->
+ <xsl:if test="$styleProperties/@style:diagonal-tl-br">
+ <xsl:element name="uof:对角线2">
+ <xsl:attribute name="uof:locID">u0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-tl-br, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线2-->
+ </xsl:element>
+ </xsl:if>
+ <!--end of fo:border-->
+ <xsl:if test="$styleProperties/@fo:border-top or $styleProperties/@fo:border-left or $styleProperties/@fo:border-bottom or $styleProperties/@fo:border-right or $styleProperties/@style:diagonal-tl-br or $styleProperties/@style:diagonal-bl-tr">
+ <xsl:element name="表:边框">
+ <xsl:attribute name="uof:locID">s0022</xsl:attribute>
+ <xsl:if test="$styleProperties/@fo:border-left or $styleProperties/@style:shadow">
+ <xsl:element name="uof:左">
+ <xsl:attribute name="uof:locID">u0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="borderleft">
+ <xsl:value-of select="$styleProperties/@fo:border-left"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderleft!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderleft,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderleft,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$borderleft!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderleft,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderleft,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:左-->
+ <xsl:if test="$styleProperties/@fo:border-top or $styleProperties/@style:shadow">
+ <xsl:element name="uof:上">
+ <xsl:attribute name="uof:locID">u0058</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="bordertop">
+ <xsl:value-of select="$styleProperties/@fo:border-top"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$bordertop!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($bordertop,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($bordertop,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$bordertop!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($bordertop,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($bordertop,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:上-->
+ <xsl:if test="$styleProperties/@fo:border-right or $styleProperties/@style:shadow">
+ <xsl:element name="uof:右">
+ <xsl:attribute name="uof:locID">u0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="borderright">
+ <xsl:value-of select="$styleProperties/@fo:border-right"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderright!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderright,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderright,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$borderright!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderright,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderright,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit)&gt;0 or contains(substring-before(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:右-->
+ <xsl:if test="$styleProperties/@fo:border-bottom or $styleProperties/@style:shadow">
+ <xsl:element name="uof:下">
+ <xsl:attribute name="uof:locID">u0060</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="borderbottom">
+ <xsl:value-of select="$styleProperties/@fo:border-bottom"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$borderbottom!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($borderbottom,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($borderbottom,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$borderbottom!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($borderbottom,' '),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($borderbottom,' '),' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),$uofUnit) &gt;0 or contains(substring-after(substring-after($styleProperties/@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uof:下-->
+ <xsl:if test="$styleProperties/@style:diagonal-bl-tr">
+ <xsl:element name="uof:对角线1">
+ <xsl:attribute name="uof:locID">u0061</xsl:attribute>
+ <xsl:attribute name="attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-bl-tr, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-bl-tr, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线1-->
+ <xsl:if test="$styleProperties/@style:diagonal-tl-br">
+ <xsl:element name="uof:对角线2">
+ <xsl:attribute name="uof:locID">u0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($styleProperties/@style:diagonal-tl-br, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($styleProperties/@style:diagonal-tl-br, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:when test="$border-style='solid'">single</xsl:when><xsl:when test="$border-style='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!--end of uo:对角线2-->
+ </xsl:element>
+ <!--end of 表:边框-->
+ </xsl:if>
+ <!--chenjh 边框 E -->
+ </xsl:template>
+ <xsl:template name="border-attributes">
+ <xsl:param name="border_properties"/>
+ <xsl:attribute name="attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:variable name="border-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-before($border_properties, ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style" select="substring-before(substring-after($border_properties, ' '), ' ')"/>
+ <xsl:variable name="border-color" select="substring-after(substring-after($border_properties, ' '), ' ')"/>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border-style = 'none'">none</xsl:when><xsl:otherwise><xsl:value-of select="$border-style"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="$border-width"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:choose><xsl:when test="$border-color"><xsl:value-of select="$border-color"/></xsl:when><xsl:otherwise>Automatic</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="Interior">
+ <xsl:param name="styleProperties"/>
+ <xsl:if test="style:table-cell-properties/@fo:background-color and not($styleProperties/@fo:background-color = 'transparent')">
+ <xsl:element name="表:填充">
+ <!--chenp modify redo0000047-->
+ <xsl:attribute name="uof:locID">s0058</xsl:attribute>
+ <!--0821 by lil -->
+ <xsl:choose>
+ <xsl:when test="$styleProperties/@fo:background-color">
+ <xsl:element name="图:颜色">
+ <xsl:attribute name="uof:locID">g0034</xsl:attribute>
+ <xsl:value-of select="$styleProperties/@fo:background-color"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="表:图案">
+ <xsl:value-of select="' Solid'"/>
+ <xsl:attribute name="xsl:lodID">g0036</xsl:attribute>
+ <xsl:attribute name="attrList">类型 图形引用 前景色 背景色</xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--end-->
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <!--chengxz 0621 E-->
+ <!--xsl:template name="image">
+
+ <xsl:element name="图:图形">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">g0000</xsl:attribute>
+ <xsl:attribute name="uof:attrList">层次 标识符 组合列表 其他对象</xsl:attribute>
+ <xsl:element name="图:预定义图形">
+ <xsl:attribute name="uof:locID">g0005</xsl:attribute>
+ <xsl:element name="图:类别">图片</xsl:element>
+ <xsl:element name="图:生成软件"><xsl:value-of select="office:binary-data" ></xsl:value-of></xsl:element>
+ <xsl:element name="图:属性">
+ <xsl:element name="图:宽度"><xsl:value-of select="substring-before(@svg:width,'cm')"/></xsl:element>
+ <xsl:element name="图:高度"><xsl:value-of select="substring-before(@svg:height,'cm')"/></xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template-->
+ <!--1新增内容-->
+ <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/>
+ <xsl:template name="draw">
+ <xsl:param name="nodename1"/>
+ <xsl:choose>
+ <xsl:when test="substring-after($nodename1,':') = 'a'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="substring-after($nodename1,':') = 'g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:g">
+ <!--xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::draw:g)"/>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat(@draw:style-name,'_',$picnumber1)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:value-of select="@draw:z-index"/></xsl:attribute>
+ <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </图:图形>
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each-->
+ <!--根据新修改的Schema做的修改-->
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:template>
+ <xsl:template name="zuheliebiao">
+ <xsl:param name="allnode"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="../child::*[$pos]">
+ <xsl:for-each select="../child::*[$pos]">
+ <xsl:variable name="nodepos">
+ <!--add by lvxg -->
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--end-->
+ </xsl:variable>
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name1">
+ <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/>
+ </xsl:variable>
+ <xsl:variable name="allnode1">
+ <xsl:value-of select="concat($allnode,',',$pic-name1)"/>
+ </xsl:variable>
+ <xsl:call-template name="zuheliebiao">
+ <xsl:with-param name="allnode" select="$allnode1"/>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$allnode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="creategraphicstyles">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name">
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:when test="./@table:end-cell-address">
+ <xsl:value-of select="@table:end-cell-address"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--end -->
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="pic-process">
+ <xsl:param name="pic-name"/>
+ <xsl:param name="nodename"/>
+ <xsl:param name="picnumber"/>
+ <xsl:variable name="aa">
+ <xsl:choose>
+ <xsl:when test="./@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:when test="./@table:end-cell-address">
+ <xsl:value-of select="@table:end-cell-address"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@draw:id"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="$nodename='draw:g'">
+ <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name | @draw:id"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1 or @draw:id=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </xsl:if>
+ <xsl:if test=".//office:binary-data">
+ <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="arrow-sign">
+ <xsl:choose>
+ <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:value-of select="'1'"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:path'or $nodename='draw:g'">
+ <图:预定义图形 uof:locID="g0005">
+ <图:类别 uof:locID="g0006">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' and $arrow-sign='1'">62</xsl:when>
+ <xsl:when test="$nodename='draw:rect'">11</xsl:when>
+ <xsl:when test="$nodename='draw:line'">61</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">19</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">65</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">66</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">19</xsl:when>
+ <xsl:when test="$nodename='draw:path'">64</xsl:when>
+ <xsl:when test="$nodename='draw:g'">4</xsl:when>
+ </xsl:choose>
+ </图:类别>
+ <图:名称 uof:locID="g0007">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when>
+ <xsl:when test="$nodename='draw:line'">Line</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:path'">Curve</xsl:when>
+ <xsl:when test="$nodename='draw:g'">group</xsl:when>
+ </xsl:choose>
+ </图:名称>
+ <图:生成软件 uof:locID="g0008">PNG</图:生成软件>
+ <xsl:if test="./@draw:points or ./@svg:d">
+ <图:关键点坐标 uof:locID="g0009" uofattrList="路径">
+ <!--xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="./@draw:points"/>
+ </xsl:call-template-->
+ <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute>
+ </图:关键点坐标>
+ </xsl:if>
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$aa]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$aa]) ">
+ <xsl:call-template name="graphicattr"/>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打印对象 uof:locID="g0032">true</图:打印对象>
+ <图:Web文字 uof:locID="g0033"/>
+ <!--0820 by lil -->
+ </图:属性>
+ </图:预定义图形>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="string(.//text:p)">
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接">
+ <xsl:if test="$nodename='draw:text-box'">
+ <xsl:attribute name="图:文本框">true</xsl:attribute>
+ <xsl:if test="./@draw:name = /office:document/office:body
+//draw:text-box/@draw:chain-next-name">
+ <xsl:attribute name="图:前一链接"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./@draw:chain-next-name">
+ <xsl:attribute name="图:后一链接"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body
+//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@fo:padding-left">
+ <xsl:attribute name="图:左边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:右边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:上边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:下边距"><xsl:value-of select="substring-before(style:graphic-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:文字排列方向"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:graphic-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动换行">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' or style:graphic-properties/@draw:auto-grow-height='true'">
+ <xsl:attribute name="图:大小适应文字">true</xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="text:p">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:if test="style:paragraph-properties">
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ </xsl:if>
+ <xsl:call-template name="textp"/>
+ </xsl:for-each>
+ </图:文本内容>
+ </xsl:if>
+ <图:控制点 uof:locID="g0003" uof:attrList="x坐标 y坐标">
+ <xsl:attribute name="图:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ </图:控制点>
+ <!--新增内容-->
+ <xsl:if test="name(..)='draw:g'">
+ <图:组合位置 uof:locID="g0041" uof:attrList="x坐标 y坐标">
+ <xsl:attribute name="图:x坐标"><xsl:variable name="minx"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-minx"><xsl:call-template name="groupminx"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:x][1]/@svg:x,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-minx - $minx"/></xsl:when><xsl:otherwise><xsl:variable name="current-x" select="number(substring-before(@svg:x,$uofUnit))"/><xsl:value-of select="$current-x - $minx"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:y坐标"><xsl:variable name="miny"><xsl:for-each select="parent::node()"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:variable><xsl:choose><xsl:when test="name(.)='draw:g'"><xsl:variable name="current-miny"><xsl:call-template name="groupminy"><xsl:with-param name="value" select="number(substring-before(descendant::node()[@svg:y][1]/@svg:y,$uofUnit))"/><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:variable><xsl:value-of select="$current-miny - $miny"/></xsl:when><xsl:otherwise><xsl:variable name="current-y" select="number(substring-before(@svg:y,$uofUnit))"/><xsl:value-of select="$current-y - $miny"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:组合位置>
+ </xsl:if>
+ <!--Redoffice comment liliang 06.03.28 end-->
+ </图:图形>
+ <xsl:if test="name()='draw:image'">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:if test="./office:binary-data">
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="./office:binary-data"/>
+ </uof:数据>
+ </xsl:if>
+ <xsl:if test="@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:if test="name()='draw:frame'">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:if test="draw:image/office:binary-data">
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="draw:image/office:binary-data"/>
+ </uof:数据>
+ </xsl:if>
+ <xsl:if test="@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@draw:fill-image-name">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="fill-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <uof:数据 uof:locID="u0037">
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]">
+ <xsl:value-of select="office:binary-data"/>
+ </xsl:for-each>
+ </uof:数据>
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <!--Redoffice comment liliang 06.03.29-->
+ <!--新增内容-->
+ <xsl:template name="graphicattr">
+ <xsl:variable name="aa" select="@style:name"/>
+ <xsl:if test="not(style:graphic-properties/@draw:fill='none')">
+ <图:填充 uof:locID="g0012">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:渐变>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name">
+ <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称">
+ <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat($aa,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:名称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色">
+ <xsl:if test="/office:document/office:styles/draw:hatch/@draw:name">
+ <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:图形引用">rogr1</xsl:attribute>
+ <xsl:if test="/office:document/office:styles/draw:hatch/@draw:color">
+ <xsl:attribute name="图:前景色"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:填充>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <图:线颜色 uof:locID="g0013">
+ <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/>
+ </图:线颜色>
+ </xsl:if>
+ <图:线型 uof:locID="g0014">
+ <xsl:call-template name="表:线型"/>
+ </图:线型>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <图:线粗细 uof:locID="g0016">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/>
+ </图:线粗细>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)&gt;0">
+ <图:前端箭头 uof:locID="g0017">
+ <图:式样 uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:式样>
+ <xsl:if test="style:graphic-properties/@draw:marker-start-width">
+ <图:大小 uof:locID="g0019">
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大小>
+ </xsl:if>
+ </图:前端箭头>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-end">
+ <!--0820 by lil -->
+ <图:后端箭头 uof:locID="g0020">
+ <图:式样 uof:locID="g0021">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:式样>
+ <xsl:if test="style:graphic-properties/@draw:marker-end-width">
+ <图:大小 uof:locID="g0022">
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($width&lt;0.05 and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="($width&lt;0.10 and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="($width&lt;0.15 and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="($width&lt;0.20 and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="($width&lt;0.25 and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="($width&lt;0.30 and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="($width&lt;0.35 and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="($width&lt;0.40 and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </图:大小>
+ </xsl:if>
+ </图:后端箭头>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:opacity">
+ <xsl:variable name="trans" select="style:graphic-properties/@draw:opacity"/>
+ <图:透明度 uof:locID="g0038">
+ <xsl:value-of select="substring($trans,1,2)"/>
+ </图:透明度>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="groupminx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.03.29-->
+ <!--Redoffice comment liliang 06.03.29-->
+ <!--新增内容-->
+ <xsl:template name="groupminy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="othervalue" select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$othervalue"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxx">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:x][position()=$pos]">
+ <xsl:variable name="svgx">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:x,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:x][position()=$pos]/@svg:width,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgx + $width"/>
+ <xsl:call-template name="groupminx">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="groupmaxy">
+ <xsl:param name="value"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="descendant::node()[@svg:y][position()=$pos]">
+ <xsl:variable name="svgy">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:y,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:value-of select="number(substring-before(descendant::node()[@svg:y][position()=$pos]/@svg:height,$uofUnit))"/>
+ </xsl:variable>
+ <xsl:variable name="othervalue" select="$svgy + $height"/>
+ <xsl:call-template name="groupminy">
+ <xsl:with-param name="value">
+ <xsl:choose>
+ <xsl:when test="$value&gt;$othervalue">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$othervalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.03.29-->
+ <xsl:template name="draw:points">
+ <xsl:param name="point"/>
+ <xsl:param name="lujing"/>
+ <xsl:choose>
+ <xsl:when test="contains($point,' ' )">
+ <xsl:variable name="first-point" select="substring-before($point,' ')"/>
+ <xsl:variable name="other-point" select="substring-after($point,' ')"/>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="$other-point"/>
+ <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment end liliang-->
+ <!--chenjh add 20050624-->
+ <xsl:template name="creat-page-setting">
+ <xsl:param name="master-page"/>
+ <xsl:param name="page-master-style"/>
+ <xsl:element name="表:页面设置">
+ <xsl:attribute name="uof:locID">s0029</xsl:attribute>
+ <xsl:attribute name="uof:attrList">名称</xsl:attribute>
+ <xsl:attribute name="表:名称"><xsl:value-of select="$master-page/@style:name"/></xsl:attribute>
+ <xsl:element name="表:纸张">
+ <xsl:attribute name="uof:locID">s0030</xsl:attribute>
+ <xsl:attribute name="uof:attrList">纸型 宽度 高度</xsl:attribute>
+ <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="$page-master-style/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="$page-master-style/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$width='29.699cm' and $height='42cm'">A3</xsl:when><xsl:when test="not($page-master-style/@fo:page-height) and not($page-master-style/@fo:page-width)">A4</xsl:when><xsl:when test="$width='14.799cm' and $height='20.999cm'">A5</xsl:when><xsl:when test="$width='25cm' and $height='35.299cm'">B4</xsl:when><xsl:when test="$width='17.598cm' and $height='25cm'">B5</xsl:when><xsl:when test="$width='12.499cm' and $height='17.598cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:choose><xsl:when test="$page-master-style/@fo:page-width"><xsl:value-of select="substring-before($page-master-style/@fo:page-width,$uofUnit)"/></xsl:when><xsl:otherwise><xsl:call-template name="setDefaultPageWidth"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:choose><xsl:when test="$page-master-style/@fo:page-height"><xsl:value-of select="substring-before($page-master-style/@fo:page-height,$uofUnit)"/></xsl:when><xsl:otherwise><xsl:call-template name="setDefaultPageHeight"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="表:纸张方向">
+ <xsl:attribute name="uof:locID">s0031</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$page-master-style/@style:print-orientation">
+ <xsl:value-of select="$page-master-style/@style:print-orientation"/>
+ </xsl:when>
+ <xsl:otherwise>portrait</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:缩放">
+ <xsl:attribute name="uof:locID">s0032</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$page-master-style/@style:scale-to">
+ <xsl:value-of select="$page-master-style/@style:scale-to"/>
+ </xsl:when>
+ <xsl:otherwise>100</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$page-master-style/@fo:margin-left or $page-master-style/@fo:margin-top or $page-master-style/@fo:margin-right or $page-master-style/@fo:margin-bottom">
+ <xsl:element name="表:页边距">
+ <xsl:attribute name="uof:locID">s0033</xsl:attribute>
+ <xsl:attribute name="uof:attrList">左 上 右 下</xsl:attribute>
+ <xsl:attribute name="uof:左"><xsl:value-of select="substring-before($page-master-style/@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:上"><xsl:value-of select="substring-before($page-master-style/@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:右"><xsl:value-of select="substring-before($page-master-style/@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:下"><xsl:value-of select="substring-before($page-master-style/@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="$master-page[@style:page-layout-name='pm1']/style:header/child::*">
+ <表:页眉页脚 uof:locID="s0034" uof:attrList="位置">
+ <xsl:attribute name="表:位置"><xsl:choose><xsl:when test="name()='style:region-left'">headerleft</xsl:when><xsl:when test="name()='style:region-right'">headerright</xsl:when><xsl:otherwise>headercenter</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="create-page-header-footer-paragraph">
+ <xsl:with-param name="paragraph-set" select="text:p"/>
+ </xsl:call-template>
+ </表:页眉页脚>
+ </xsl:for-each>
+ <xsl:for-each select="$master-page[@style:page-layout-name='pm1']/style:footer/child::*">
+ <表:页眉页脚 uof:locID="s0034" uof:attrList="位置">
+ <xsl:attribute name="表:位置"><xsl:choose><xsl:when test="name()='style:region-left'">footerleft</xsl:when><xsl:when test="name()='style:region-right'">footerright</xsl:when><xsl:otherwise>footercenter</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:call-template name="create-page-header-footer-paragraph">
+ <xsl:with-param name="paragraph-set" select="text:p"/>
+ </xsl:call-template>
+ </表:页眉页脚>
+ </xsl:for-each>
+ <xsl:if test="$page-master-style/@style:print-page-order or $page-master-style/@style:print">
+ <表:打印 uof:locID="s126" uof:attrList="网格线 行号列标 按草稿方式 先列后行">
+ <xsl:if test="$page-master-style/@style:print-page-order='ltr'">
+ <xsl:attribute name="表:先列后行">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($page-master-style/@style:print,'grid')">
+ <xsl:attribute name="表:网格线">true</xsl:attribute>
+ </xsl:if>
+ </表:打印>
+ </xsl:if>
+ <xsl:if test="$page-master-style/@style:table-centering='vertical' or $page-master-style/@style:table-centering='both'">
+ <表:垂直对齐 uof:locID="s0128" uof:attrList="对齐方式">
+ <xsl:attribute name="表:对齐方式">center</xsl:attribute>
+ </表:垂直对齐>
+ </xsl:if>
+ <xsl:if test="$page-master-style/@style:table-centering='horizontal' or $page-master-style/@style:table-centering='both'">
+ <表:水平对齐 uof:locID="s0129" uof:attrList="对齐方式">
+ <xsl:attribute name="表:对齐方式">center</xsl:attribute>
+ </表:水平对齐>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-page-header-footer-paragraph">
+ <xsl:param name="paragraph-set"/>
+ <xsl:choose>
+ <xsl:when test="$paragraph-set">
+ <xsl:element name="字:段落">
+ <xsl:attribute name="uof:locID">t0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:element name="字:句">
+ <xsl:attribute name="uof:locID">t0085</xsl:attribute>
+ <xsl:apply-templates select="$paragraph-set//text()">
+ <xsl:with-param name="bText" select="'0'"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ <xsl:call-template name="create-page-header-footer-paragraph">
+ <xsl:with-param name="paragraph-set" select="$paragraph-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:p" name="textp">
+ <xsl:apply-templates select="text()|text:span|text:tab-stop|text:line-break|text:s|text:ruby|text:bookmark|text:bookmark-start|text:bookmark-end|text:a|text:footnote|text:endnote">
+ <xsl:with-param name="bText" select="'1'"/>
+ <xsl:with-param name="sText" select="'1'"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="text:a">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:element name="字:句">
+ <xsl:attribute name="uof:locID">t0085</xsl:attribute>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text()">
+ <xsl:param name="bText"/>
+ <xsl:param name="sText"/>
+ <xsl:if test="normalize-space(.)!=''">
+ <xsl:choose>
+ <xsl:when test="$bText='1' and $sText='1'">
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:文本串 uof:locID="t0109" uof:attrList="udsPath">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:span">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </字:句属性>
+ <xsl:apply-templates select="text:s|text()|text:line-break|text:tab-stop| text:a | text:footnote|text:endnote|draw:image|office:annotation|draw:frame">
+ <xsl:with-param name="bText" select="1"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用" 字:式样引用="{@text:style-name}"/>
+ <xsl:apply-templates select="text:s|text()|text:line-break|text:tab-stop| text:a |text:footnote|text:endnote|draw:image|office:annotation|draw:frame">
+ <xsl:with-param name="bText" select="1"/>
+ </xsl:apply-templates>
+ </字:句>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:variable name="count">
+ <xsl:choose>
+ <xsl:when test="not(@text:c)">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@text:c"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <字:句 uof:locID="t0085">
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:line-break">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <字:句 uof:locID="t0085">
+ <字:换行符 uof:locID="t0124"/>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:换行符 uof:locID="t0124"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:tab-stop">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <字:句 uof:locID="t0085">
+ <字:制表符 uof:locID="t0123"/>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:制表符 uof:locID="t0123"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--chenjh0713-->
+ <!--chenjh0629E-->
+ <!--chenjh add 20050629 -->
+ <!--字符串转换为数字-->
+ <xsl:template name="translate-column-char-to-number">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="string-length($string)=1">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="$string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="tens-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,1,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="units-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,2,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$tens-place * 26 + $units-place"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="char-to-number">
+ <xsl:param name="char"/>
+ <xsl:choose>
+ <xsl:when test="$char='A'">1</xsl:when>
+ <xsl:when test="$char='B'">2</xsl:when>
+ <xsl:when test="$char='C'">3</xsl:when>
+ <xsl:when test="$char='D'">4</xsl:when>
+ <xsl:when test="$char='E'">5</xsl:when>
+ <xsl:when test="$char='F'">6</xsl:when>
+ <xsl:when test="$char='G'">7</xsl:when>
+ <xsl:when test="$char='H'">8</xsl:when>
+ <xsl:when test="$char='I'">9</xsl:when>
+ <xsl:when test="$char='J'">10</xsl:when>
+ <xsl:when test="$char='K'">11</xsl:when>
+ <xsl:when test="$char='L'">12</xsl:when>
+ <xsl:when test="$char='M'">13</xsl:when>
+ <xsl:when test="$char='N'">14</xsl:when>
+ <xsl:when test="$char='O'">15</xsl:when>
+ <xsl:when test="$char='P'">16</xsl:when>
+ <xsl:when test="$char='Q'">17</xsl:when>
+ <xsl:when test="$char='R'">18</xsl:when>
+ <xsl:when test="$char='S'">19</xsl:when>
+ <xsl:when test="$char='T'">20</xsl:when>
+ <xsl:when test="$char='U'">21</xsl:when>
+ <xsl:when test="$char='V'">22</xsl:when>
+ <xsl:when test="$char='W'">23</xsl:when>
+ <xsl:when test="$char='X'">24</xsl:when>
+ <xsl:when test="$char='Y'">25</xsl:when>
+ <xsl:when test="$char='Z'">26</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-filter-conditions">
+ <xsl:param name="filter-condition-set"/>
+ <xsl:param name="zone-left-column-num"/>
+ <xsl:if test="$filter-condition-set">
+ <xsl:variable name="first-condition" select="$filter-condition-set"/>
+ <xsl:element name="表:条件">
+ <xsl:attribute name="uof:locID">s0103</xsl:attribute>
+ <xsl:attribute name="uof:attrList">列号</xsl:attribute>
+ <xsl:attribute name="表:列号"><xsl:value-of select="$zone-left-column-num + $first-condition/@table:field-number"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$first-condition/@table:operator ='top values'">
+ <xsl:element name="表:普通">
+ <xsl:attribute name="uof:locID">s0104</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 值</xsl:attribute>
+ <xsl:attribute name="表:类型">topitem</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="$first-condition/@table:value"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="表:自定义">
+ <xsl:attribute name="uof:locID">s0105</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:element name="表:操作条件">
+ <xsl:attribute name="uof:locID">s0106</xsl:attribute>
+ <!--redoffice comment from lvxg 8.27-->
+ <xsl:if test="$first-condition/@table:operator">
+ <xsl:element name="表:操作码">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:variable name="operator-text" select="$first-condition/@table:operator"/>
+ <xsl:choose>
+ <xsl:when test="$operator-text ='&lt;' ">less than</xsl:when>
+ <xsl:when test="$operator-text ='&gt;' ">greater than</xsl:when>
+ <xsl:when test="$operator-text ='=' ">equal to</xsl:when>
+ <xsl:when test="$operator-text ='&gt;=' ">greater than or equal to</xsl:when>
+ <xsl:when test="$operator-text ='&lt;=' ">less than or equal to</xsl:when>
+ <xsl:when test="$operator-text ='!=' ">not equal to</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:值">
+ <xsl:attribute name="uof:locID">s0107</xsl:attribute>
+ <xsl:value-of select="$first-condition/@table:value"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:call-template name="create-filter-conditions">
+ <xsl:with-param name="filter-condition-set" select="$filter-condition-set[position()!=1]"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-view">
+ <xsl:param name="table-name"/>
+ <xsl:param name="view-id"/>
+ <!--xsl:param name="ActiveTable"/-->
+ <xsl:param name="aaa"/>
+ <!--xsl:variable name="aaa" select="/*/office:settings/config:config-item-set/config:config-item-map-indexed"-->
+ <xsl:element name="表:视图">
+ <xsl:attribute name="uof:locID">s0035</xsl:attribute>
+ <xsl:attribute name="uof:attrList">窗口标识符</xsl:attribute>
+ <xsl:attribute name="表:窗口标识符"><xsl:value-of select="$view-id"/></xsl:attribute>
+ <xsl:if test="$table-name='ActiveTable'">
+ <xsl:element name="表:选中">
+ <xsl:attribute name="uof:locID">s0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值">1</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="name" select="./@table:name"/>
+ <xsl:choose>
+ <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitMode']/text()='2' or $aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=name]/config:config-item[@config:name='VerticalSplitMode']/text()='2' ">
+ <xsl:element name="表:冻结">
+ <xsl:attribute name="uof:locID">s0038</xsl:attribute>
+ <xsl:attribute name="uof:attrList">行号 列号</xsl:attribute>
+ <xsl:attribute name="表:行号"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitPosition']/text()"/></xsl:attribute>
+ <xsl:attribute name="表:列号"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitPosition']/text()"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="表:拆分">
+ <xsl:attribute name="uof:locID">s0037</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 高度</xsl:attribute>
+ <xsl:attribute name="表:宽度"><xsl:choose><xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitMode']/text()='1'"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='HorizontalSplitPosition']/text()"/></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="表:高度"><xsl:choose><xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitMode']/text()='1'"><xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$name]/config:config-item[@config:name='VerticalSplitPosition']/text()"/></xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="表:最上行">
+ <xsl:attribute name="uof:locID">s0039</xsl:attribute>
+ <!--xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$table-name]/config:config-item[@config:name='PositionBottom']/text()+1"/-->
+ <xsl:choose>
+ <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionBottom']/text()">
+ <xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionBottom']/text()"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:最左列">
+ <xsl:attribute name="uof:locID">s0040</xsl:attribute>
+ <!--xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry[@config:name=$table-name]/config:config-item[@config:name='PositionLeft']/text() + 1"/-->
+ <xsl:choose>
+ <xsl:when test="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionRight']/text()">
+ <xsl:value-of select="$aaa/config:config-item-map-named/config:config-item-map-entry/config:config-item[@config:name='PositionRight']/text()"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:当前视图">
+ <xsl:attribute name="uof:locID">s0041</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="$aaa/config:config-item[@config:name='ShowPageBreakPreview']/text()='true'">page</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="表:网格">
+ <xsl:attribute name="uof:locID">s0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:choose><xsl:when test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ShowGrid']/text()='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="表:网格颜色">
+ <xsl:attribute name="uof:locID">s0044</xsl:attribute>
+ <xsl:variable name="GridColor-text">
+ <xsl:value-of select="//config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='GridColor']/text()"/>
+ </xsl:variable>
+ <xsl:variable name="R-color" select="floor($GridColor-text div 65536)"/>
+ <xsl:variable name="G-color" select="floor(($GridColor-text - ($R-color * 65536)) div 256)"/>
+ <xsl:variable name="B-color" select="$GridColor-text - ($R-color * 65536)- ($G-color * 256)"/>
+ <xsl:variable name="R-color-in-16">
+ <xsl:call-template name="transform-decimal-to-hexadecimal">
+ <xsl:with-param name="color-decimal" select="$R-color"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="G-color-in-16">
+ <xsl:call-template name="transform-decimal-to-hexadecimal">
+ <xsl:with-param name="color-decimal" select="$G-color"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="B-color-in-16">
+ <xsl:call-template name="transform-decimal-to-hexadecimal">
+ <xsl:with-param name="color-decimal" select="$B-color"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('#',$R-color-in-16,$G-color-in-16,$B-color-in-16)"/>
+ </xsl:element>
+ <xsl:if test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomType']/text()=0">
+ <xsl:element name="表:缩放">
+ <xsl:attribute name="uof:locID">s0045</xsl:attribute>
+ <xsl:value-of select="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomValue']/text()"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomType']/text()=1">
+ <xsl:element name="表:分页缩放">
+ <xsl:attribute name="uof:locID">s0046</xsl:attribute>
+ <xsl:value-of select="/*/office:settings/config:config-item-set[@config:name='ooo:view-settings']//config:config-item[@config:name='ZoomValue']/text()"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="hexNumber2dec">
+ <xsl:param name="hex-value"/>
+ <xsl:choose>
+ <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hex-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="hex2decimal">
+ <xsl:param name="hex-number"/>
+ <xsl:param name="index"/>
+ <xsl:param name="str-length"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="dec-char">
+ <xsl:call-template name="hexNumber2dec">
+ <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/>
+ <xsl:if test="$index &lt; $str-length">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$hex-number"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="str-length" select="$str-length"/>
+ <xsl:with-param name="last-value" select="$current-value"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $str-length">
+ <xsl:value-of select="$current-value"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="table:calculation-settings" mode="common">
+ <xsl:if test="@table:precision-as-shown">
+ <xsl:element name="表:精确度以显示值为准">
+ <xsl:attribute name="uof:locID">s0002</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="@table:precision-as-shown"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:日期系统-1904">
+ <xsl:attribute name="uof:locID">s0003</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:choose><xsl:when test="table:null-date/@table:date-value='1904-01-01'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="table:iteration/@table:status='enable'">
+ <表:计算设置 uof:locID="s0004" uof:attrList="迭代次数 偏差值">
+ <xsl:attribute name="表:迭代次数"><xsl:value-of select="table:iteration/@table:steps"/></xsl:attribute>
+ <xsl:attribute name="表:偏差值"><xsl:choose><xsl:when test="table:iteration/@table:maximum-difference"><xsl:value-of select="table:iteration/@table:maximum-difference"/></xsl:when><xsl:otherwise>0.001</xsl:otherwise></xsl:choose><!--xsl:value-of select="table:iteration/@table:maximum-difference"/--></xsl:attribute>
+ </表:计算设置>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="office:automatic-styles" mode="common">
+ <xsl:element name="表:条件格式化集">
+ <xsl:attribute name="uof:locID">s0016</xsl:attribute>
+ <xsl:variable name="temp-path" select="../office:automatic-styles/style:style"/>
+ <xsl:for-each select="$temp-path/style:map">
+ <xsl:element name="表:条件格式化">
+ <xsl:attribute name="uof:locID">s0017</xsl:attribute>
+ <xsl:element name="表:区域">
+ <xsl:attribute name="uof:locID">s0007</xsl:attribute>
+ <xsl:variable name="range-name">
+ <xsl:value-of select="substring-before(@style:base-cell-address,'.')"/>
+ </xsl:variable>
+ <xsl:variable name="range-value">
+ <xsl:value-of select="substring-after(@style:base-cell-address,'.')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat(&quot;&apos;&quot;,$range-name,&quot;&apos;&quot;,'!$',substring($range-value,1,1),'$',substring($range-value,2))"/>
+ </xsl:element>
+ <xsl:element name="表:条件">
+ <xsl:attribute name="uof:locID">s0019</xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:choose><xsl:when test="contains(@style:condition,'formula')"><xsl:value-of select="'formula'"/></xsl:when><xsl:otherwise><xsl:value-of select="'cell value'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="表:操作码">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(@style:condition,'!=')">
+ <xsl:value-of select="'not equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&lt;=')">
+ <xsl:value-of select="'less than or equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&gt;=')">
+ <xsl:value-of select="'greater than or equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&lt;')">
+ <xsl:value-of select="'less than'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&gt;')">
+ <xsl:value-of select="'greater than'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'=')">
+ <xsl:value-of select="'equal to'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'not-between')">
+ <xsl:value-of select="'not-between'"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'between')">
+ <xsl:value-of select="'between'"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:第一操作数">
+ <xsl:attribute name="uof:locID">s0010</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(@style:condition,'formula')">
+ <xsl:value-of select="substring-after(substring-before(@style:condition,')'),'(')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'=')">
+ <xsl:value-of select="substring-after(@style:condition,'=')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&lt;') and not(contains(@style:condition,'&lt;='))">
+ <xsl:value-of select="substring-after(@style:condition,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'&gt;') and not(contains(@style:condition,'&gt;='))">
+ <xsl:value-of select="substring-after(@style:condition,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="contains(@style:condition,'between')">
+ <xsl:value-of select="substring-before(substring-after(@style:condition,'('),',')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="contains(@style:condition,',')">
+ <xsl:element name="表:第二操作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(@style:condition,'between')">
+ <xsl:value-of select="substring-before(substring-after(@style:condition,','),')')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:格式">
+ <xsl:attribute name="uof:locID">s0023</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="表:式样引用"><xsl:value-of select="@style:apply-style-name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="table:content-validations" mode="common">
+ <xsl:element name="表:数据有效性集">
+ <xsl:attribute name="uof:locID">s0005</xsl:attribute>
+ <xsl:call-template name="create-validation-set">
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-validation-set">
+ <xsl:for-each select="//table:content-validation">
+ <xsl:element name="表:数据有效性">
+ <xsl:attribute name="uof:locID">s0006</xsl:attribute>
+ <xsl:variable name="conditiontext" select="@table:condition"/>
+ <xsl:variable name="operatortext" select="substring-after($conditiontext,'and ')"/>
+ <xsl:element name="表:区域">
+ <xsl:attribute name="uof:locID">s0007</xsl:attribute>
+ <xsl:variable name="left-top">
+ <xsl:call-template name="search-left-top-validation">
+ <xsl:with-param name="validation-name" select="@table:name"/>
+ <xsl:with-param name="tableslist" select="/*/office:body/office:spreadsheet/table:table"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="after-translated-left-top">
+ <xsl:call-template name="translate-left-top">
+ <xsl:with-param name="left-top" select="$left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="base" select="@table:base-cell-address"/>
+ <xsl:variable name="base-column-and-row" select="substring-after($base,'.')"/>
+ <xsl:variable name="dd" select="number(substring($base-column-and-row,2,1))"/>
+ <xsl:variable name="base-column">
+ <xsl:choose>
+ <xsl:when test="contains($dd,'NaN') ">
+ <xsl:value-of select="substring($base-column-and-row,1,2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($base-column-and-row,1,1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="base-row" select="substring-after($base,$base-column)"/>
+ <xsl:variable name="after-translated-base-left-top">
+ <xsl:value-of select="concat('$',substring-before($base,'.'),'.$',$base-column,'$',$base-row)"/>
+ </xsl:variable>
+ <xsl:value-of select="concat('$',$after-translated-left-top,':',$after-translated-base-left-top)"/>
+ </xsl:element>
+ <xsl:element name="表:校验类型">
+ <xsl:attribute name="uof:locID">s0008</xsl:attribute>
+ <xsl:variable name="listtest">cell-content-is-in-list("</xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($conditiontext,'cell-content-is-whole-number()')">whole number</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-decimal-number()')">decimal</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-date()')">date</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-time()')">time</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-in-list') and not(contains($conditiontext,$listtest))">cell range</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-is-in-list') and contains($conditiontext,$listtest)">list</xsl:when>
+ <xsl:when test="contains($conditiontext,'cell-content-text-length')">text length</xsl:when>
+ <xsl:otherwise>any value</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:操作码">
+ <xsl:attribute name="uof:locID">s0009</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'cell-content()&lt;=')">less than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()&gt;=')">greater than or equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()&lt;')">less than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()&gt;')">greater than</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()!=')">not equal to</xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()=')">equal to</xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length()')">
+ <xsl:variable name="operator" select="substring-after($conditiontext,'oooc:cell-content-text-length()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operator,'&lt;=')">less than or equal to</xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;=')">greater than or equal to</xsl:when>
+ <xsl:when test="starts-with($operator,'&lt;')">less than</xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;')">greater than</xsl:when>
+ <xsl:when test="starts-with($operator,'!=')">not equal to</xsl:when>
+ <xsl:when test="starts-with($operator,'=')">equal to</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains($conditiontext,'is-between')">between</xsl:when>
+ <xsl:when test="contains($conditiontext,'is-not-between')">not between</xsl:when>
+ <!-- 注意:uof有的另几种操作码在oo中没有,他们是contain,not contain,start with,not start with, end with,not end with-->
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="表:第一操作数">
+ <xsl:attribute name="uof:locID">s0010</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="starts-with($operatortext,'cell-content-is-between')">
+ <xsl:value-of select="substring-before(substring-after($operatortext,'cell-content-is-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content-is-not-between')">
+ <xsl:value-of select="substring-before(substring-after($operatortext,'cell-content-is-not-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length()')">
+ <xsl:variable name="operator" select="substring-after($conditiontext,'cell-content-text-length()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operator,'&lt;=')">
+ <xsl:value-of select="substring-after($operator,'&lt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;=')">
+ <xsl:value-of select="substring-after($operator,'&gt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&lt;')">
+ <xsl:value-of select="substring-after($operator,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;')">
+ <xsl:value-of select="substring-after($operator,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'!=')">
+ <xsl:value-of select="substring-after($operator,'!=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'=')">
+ <xsl:value-of select="substring-after($operator,'=')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-is-in-list')">
+ <xsl:value-of select="substring-after($conditiontext,'oooc:cell-content-is-in-list')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length-is-not-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'oooc:cell-content-text-length-is-not-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($conditiontext,'oooc:cell-content-text-length-is-between')">
+ <xsl:value-of select="substring-before(substring-after($conditiontext,'oooc:cell-content-text-length-is-between('),',')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operatortext,'cell-content()')">
+ <xsl:variable name="operator" select="substring-after($conditiontext,'oooc:cell-content()')"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($operator,'&lt;=')">
+ <xsl:value-of select="substring-after($operator,'&lt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;=')">
+ <xsl:value-of select="substring-after($operator,'&gt;=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&lt;')">
+ <xsl:value-of select="substring-after($operator,'&lt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'&gt;')">
+ <xsl:value-of select="substring-after($operator,'&gt;')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'!=')">
+ <xsl:value-of select="substring-after($operator,'!=')"/>
+ </xsl:when>
+ <xsl:when test="starts-with($operator,'=')">
+ <xsl:value-of select="substring-after($operator,'=')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="starts-with($operatortext,'cell-content-is-between') or starts-with($operatortext,'cell-content-is-not-between')">
+ <xsl:element name="表:第二操作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:value-of select="substring-before(substring-after($operatortext,','),')')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="starts-with($conditiontext,'oooc:cell-content-text-length-is-not-between') or starts-with($conditiontext,'oooc:cell-content-text-length-is-between')">
+ <xsl:element name="表:第二操作数">
+ <xsl:attribute name="uof:locID">s0011</xsl:attribute>
+ <xsl:value-of select="substring-before(substring-after($conditiontext,','),')')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="表:忽略空格">
+ <xsl:attribute name="uof:locID">s0012</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值"><xsl:value-of select="@table:allow-empty-cell"/></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="contains($conditiontext,'cell-content-is-in-list') ">
+ <xsl:element name="表:下拉箭头">
+ <xsl:attribute name="uof:locID">s0013</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="表:值">false</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="table:help-message">
+ <xsl:element name="表:输入提示">
+ <xsl:attribute name="uof:locID">s0014</xsl:attribute>
+ <xsl:attribute name="uof:attrList">显示 标题 内容</xsl:attribute>
+ <xsl:attribute name="表:显示"><xsl:value-of select="table:help-message/@table:display"/></xsl:attribute>
+ <xsl:attribute name="表:标题"><xsl:choose><xsl:when test="table:help-message/@table:title"><xsl:value-of select="table:help-message/@table:title"/></xsl:when><xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:variable name="content">
+ <xsl:call-template name="create-help-error-message-content">
+ <xsl:with-param name="text-p-set" select="table:help-message/text:p"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="表:内容"><xsl:value-of select="$content"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="table:error-message">
+ <xsl:element name="表:错误提示">
+ <xsl:attribute name="uof:locID">s0015</xsl:attribute>
+ <xsl:attribute name="uof:attrList">显示 类型 标题 内容</xsl:attribute>
+ <xsl:attribute name="表:显示"><xsl:value-of select="table:error-message/@table:display"/></xsl:attribute>
+ <xsl:attribute name="表:类型"><xsl:value-of select="table:error-message/@table:message-type"/></xsl:attribute>
+ <xsl:attribute name="表:标题"><xsl:choose><xsl:when test="table:error-message/@table:title"><xsl:value-of select="table:error-message/@table:title"/></xsl:when><xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:variable name="content">
+ <xsl:call-template name="create-help-error-message-content">
+ <xsl:with-param name="text-p-set" select="table:error-message/text:p"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="表:内容"><xsl:value-of select="$content"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation">
+ <xsl:param name="validation-name"/>
+ <xsl:param name="tableslist"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$tableslist and $return=''">
+ <xsl:variable name="firsttablerows" select="$tableslist[1]//table:table-row"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-validation-inatable">
+ <xsl:with-param name="row-num" select="'1'"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-validation">
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top!=''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-left-top">
+ <xsl:param name="left-top"/>
+ <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat(substring-before($left-top,'.'),'.','$',$column-character1,$column-character2,'$',substring-after($left-top,' '))"/>
+ </xsl:template>
+ <xsl:template name="create-help-error-message-content">
+ <xsl:param name="text-p-set"/>
+ <xsl:if test="$text-p-set">
+ <!--此处有问题!!!!应该是有一个模块调用等-->
+ <!--xsl:value-of select="'&#10;'"/-->
+ <xsl:value-of select="$text-p-set"/>
+ <xsl:call-template name="create-help-error-message-content">
+ <xsl:with-param name="text-p-set" select="$text-p-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation-inatable">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firsttablerows"/>
+ <xsl:param name="validation-name"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firsttablerows and $return=''">
+ <xsl:variable name="firstcells" select="$firsttablerows[1]/table:table-cell"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-validation-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="'1'"/>
+ <xsl:with-param name="firstcells" select="$firstcells"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="row-num-p">
+ <xsl:choose>
+ <xsl:when test="$firsttablerows[1]/@table:number-rows-repeated">
+ <xsl:value-of select="$row-num+ $firsttablerows[1]/@table:number-rows-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-num+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-validation-inatable">
+ <xsl:with-param name="row-num" select="$row-num-p"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-character">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number = 0"/>
+ <xsl:when test="$number = 1">A</xsl:when>
+ <xsl:when test="$number = 2">B</xsl:when>
+ <xsl:when test="$number = 3">C</xsl:when>
+ <xsl:when test="$number = 4">D</xsl:when>
+ <xsl:when test="$number = 5">E</xsl:when>
+ <xsl:when test="$number = 6">F</xsl:when>
+ <xsl:when test="$number = 7">G</xsl:when>
+ <xsl:when test="$number = 8">H</xsl:when>
+ <xsl:when test="$number = 9">I</xsl:when>
+ <xsl:when test="$number = 10">J</xsl:when>
+ <xsl:when test="$number = 11">K</xsl:when>
+ <xsl:when test="$number = 12">L</xsl:when>
+ <xsl:when test="$number = 13">M</xsl:when>
+ <xsl:when test="$number = 14">N</xsl:when>
+ <xsl:when test="$number = 15">O</xsl:when>
+ <xsl:when test="$number = 16">P</xsl:when>
+ <xsl:when test="$number = 17">Q</xsl:when>
+ <xsl:when test="$number = 18">R</xsl:when>
+ <xsl:when test="$number = 19">S</xsl:when>
+ <xsl:when test="$number = 20">T</xsl:when>
+ <xsl:when test="$number = 21">U</xsl:when>
+ <xsl:when test="$number = 22">V</xsl:when>
+ <xsl:when test="$number = 23">W</xsl:when>
+ <xsl:when test="$number = 24">X</xsl:when>
+ <xsl:when test="$number = 25">Y</xsl:when>
+ <xsl:when test="$number = 26">Z</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation-inacell">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="validation-name"/>
+ <xsl:choose>
+ <xsl:when test="$cell/@table:content-validation-name=$validation-name">
+ <xsl:value-of select="concat($cell/ancestor::table:table/@table:name,'.',$column-num,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="search-left-top-validation-inarow">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="firstcells"/>
+ <xsl:param name="validation-name"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firstcells and $return=''">
+ <xsl:variable name="firstcell" select="$firstcells[1]"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-validation-inacell">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="cell" select="$firstcell"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-num-p">
+ <xsl:choose>
+ <xsl:when test="$firstcell/@table:number-columns-repeated">
+ <xsl:value-of select="$column-num+ $firstcell/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$column-num+ 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-validation-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num-p"/>
+ <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/>
+ <xsl:with-param name="validation-name" select="$validation-name"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/uof/odf2uof_text.xsl b/filter/source/xslt/export/uof/odf2uof_text.xsl
new file mode 100644
index 000000000000..cea93c8a0864
--- /dev/null
+++ b/filter/source/xslt/export/uof/odf2uof_text.xsl
@@ -0,0 +1,4445 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" 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:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0" exclude-result-prefixes="office style text table draw fo xlink dc meta number presentation svg chart dr3d math form script config ooo ooow oooc dom xforms smil anim">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <!--xsl:key name="colWidth" match="/office:automatic/style:style/" use="@style:column-width"/-->
+ <xsl:variable name="swValueWithUnit">
+ <xsl:value-of select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/@fo:page-width"/>
+ </xsl:variable>
+ <xsl:variable name="uofUnit">
+ <xsl:choose>
+ <xsl:when test="contains($swValueWithUnit,'in')">inch</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ooUnit">
+ <xsl:choose>
+ <xsl:when test="contains($swValueWithUnit,'in')">inch</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'cm')">cm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'mm')">mm</xsl:when>
+ <xsl:when test="contains($swValueWithUnit,'pt')">pt</xsl:when>
+ <xsl:otherwise>inch</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:template match="/">
+ <xsl:apply-templates select="office:document"/>
+ </xsl:template>
+ <xsl:template match="office:document">
+ <uof:UOF xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" uof:language="cn" uof:locID="u0000" uof:version="1.0" uof:mimetype="vnd.uof.text">
+ <xsl:apply-templates select="office:meta"/>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:bookmark-start|/office:document/office:body/office:text/text:p/text:bookmark">
+ <uof:书签集 uof:locID="u0027">
+ <xsl:for-each select="/office:document/office:body/office:text/text:p/text:bookmark-start|/office:document/office:body/office:text/text:p/text:bookmark">
+ <uof:书签 uof:locID="u0028" uof:attrList="名称">
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@text:name"/></xsl:attribute>
+ <uof:文本位置 uof:locID="u0029" uof:attrList="区域引用">
+ <xsl:attribute name="字:区域引用"><xsl:value-of select="generate-id()"/></xsl:attribute>
+ </uof:文本位置>
+ </uof:书签>
+ </xsl:for-each>
+ </uof:书签集>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:a | /office:document/office:body/office:text/text:p/draw:a | /office:document/office:body/office:text/table:table/table:table-row/table:table-cell/text:p/text:a | /office:document/office:body/office:text/text:table-of-content/text:index-body/text:p/text:a">
+ <uof:链接集 uof:locID="u0031">
+ <xsl:for-each select="/office:document/office:body/office:text/text:p/text:a | /office:document/office:body/office:text/text:p/draw:a | /office:document/office:body/office:text/table:table/table:table-row/table:table-cell/text:p/text:a | /office:document/office:body/office:text/text:table-of-content/text:index-body/text:p/text:a">
+ <xsl:variable name="hyperStr" select="@xlink:href"/>
+ <uof:超级链接 uof:locID="u0032" uof:attrList="标识符 目标 书签 式样引用 已访问式样引用 提示 链源">
+ <xsl:if test="contains($hyperStr,'#')">
+ <xsl:attribute name="uof:书签"><xsl:value-of select="substring-after($hyperStr,'#')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="num">
+ <xsl:number from="/office:document/office:body/office:text" level="any" count="text:a | table:table/table:table-row/table:table-cell/text:a"/>
+ </xsl:variable>
+ <xsl:attribute name="uof:链源"><xsl:value-of select="concat('hlnk',$num)"/></xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('hyk_','hlnk',$num)"/></xsl:attribute>
+ <xsl:if test="not(contains($hyperStr,'#'))">
+ <xsl:attribute name="uof:目标"><xsl:value-of select="$hyperStr"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@office:name">
+ <xsl:attribute name="uof:提示"><xsl:value-of select="@office:name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:style-name">
+ <xsl:attribute name="uof:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:visited-style-name">
+ <xsl:attribute name="uof:已访问式样引用"><xsl:value-of select="@text:visited-style-name"/></xsl:attribute>
+ </xsl:if>
+ </uof:超级链接>
+ </xsl:for-each>
+ </uof:链接集>
+ </xsl:if>
+ <uof:式样集 uof:locID="u0039">
+ <xsl:apply-templates select="office:font-face-decls"/>
+ <xsl:call-template name="自动编号集"/>
+ <xsl:call-template name="shiyang"/>
+ <xsl:apply-templates select="office:automatic-styles/style:style" mode="style"/>
+ </uof:式样集>
+ <uof:对象集 uof:locID="u0033">
+ <xsl:for-each select="/office:document/office:body/office:text/draw:*">
+ <xsl:variable name="nodename1">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="$nodename1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:apply-templates select="/office:document/office:body/office:text//text:p" mode="styles"/>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page/style:header/text:p" mode="styles"/>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page/style:footer/text:p" mode="styles"/>
+ <xsl:for-each select="(/office:document/office:styles/style:style/style:paragraph-properties/style:background-image) | (/office:document/office:automatic-styles/style:style/style:paragraph-properties/style:background-image) | (/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image) | /office:document/office:automatic-styles/style:style/style:table-cell-properties/style:background-image | /office:document/office:automatic-styles/style:style/style:table-properties/style:background-image | /office:document/office:automatic-styles/style:style/style:graphic-properties/style:background-image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('background-image_',count(preceding::style:background-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:数据>
+ </uof:其他对象>
+ </xsl:for-each>
+ <xsl:for-each select="(/office:document/office:styles/text:list-style/text:list-level-style-image) | (/office:document/office:automatic-styles/text:list-style/text:list-level-style-image)">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:数据>
+ </uof:其他对象>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="@draw:name"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="office:binary-data"/>
+ </uof:数据>
+ </uof:其他对象>
+ </xsl:for-each>
+ <!--xsl:apply-templates select="/office:document/office:automatic-styles/style:style[@style:family = 'graphics']"/>
+ <xsl:apply-templates select="office:styles/style:style[@style:family = 'graphics']"/>
+ <xsl:apply-templates select="office:styles/style:default-style [@style:family = 'graphics']"/-->
+ </uof:对象集>
+ <uof:文字处理 uof:locID="u0047">
+ <字:公用处理规则 uof:locID="t0000">
+ <xsl:apply-templates select="office:settings"/>
+ <xsl:call-template name="GetUsers"/>
+ <xsl:call-template name="GetTrackChanges"/>
+ <xsl:call-template name="GetAnnotations"/>
+ </字:公用处理规则>
+ <字:主体 uof:locID="t0016">
+ <xsl:for-each select="office:automatic-styles/style:page-layout[@style:name='pm1']">
+ <xsl:call-template name="style:page-layout"/>
+ </xsl:for-each>
+ <!--xsl:call-template name="office:automatic-styles/style:page-layout[@style:name='pm1']"/-->
+ <!--xsl:apply-templates select="office:automatic-styles/style:page-layout[@style:name='pm1']"/-->
+ <xsl:apply-templates select="office:body/office:text"/>
+ <xsl:call-template name="logic-chapter"/>
+ </字:主体>
+ </uof:文字处理>
+ </uof:UOF>
+ </xsl:template>
+ <xsl:template name="logic-chapter">
+ <xsl:element name="字:逻辑章节">
+ <xsl:attribute name="uof:locID">t0050</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="GetAnnotations">
+ <xsl:if test="/*/office:body/office:text//office:annotation ">
+ <字:批注集 uof:locID="t0014">
+ <xsl:for-each select="/*/office:body/office:text//office:annotation">
+ <字:批注 uof:locID="t0015" uof:attrList="区域引用 作者 日期 作者缩写">
+ <xsl:attribute name="字:作者"><xsl:value-of select="generate-id()"/></xsl:attribute>
+ <xsl:attribute name="字:日期"><xsl:value-of select="dc:date"/></xsl:attribute>
+ <xsl:attribute name="字:区域引用">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute>
+ <xsl:for-each select="./node()">
+ <xsl:choose>
+ <xsl:when test="name()='text:p'">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='table:table'">
+ <xsl:call-template name="exec_table"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </字:批注>
+ </xsl:for-each>
+ </字:批注集>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="GetTrackChanges">
+ <xsl:if test="/*/office:body/office:text/text:tracked-changes">
+ <字:修订信息集 uof:locID="t0012">
+ <xsl:for-each select="/*/office:body/office:text/text:tracked-changes/text:changed-region">
+ <字:修订信息 字:标识符="{@text:id}" 字:作者="{generate-id()}" 字:日期="{node()//office:change-info/dc:date}" uof:locID="t0013" uof:attrList="标识符 作者 日期"/>
+ </xsl:for-each>
+ </字:修订信息集>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="GetUsers">
+ <xsl:if test="/*/office:body/office:text/text:tracked-changes//office:change-info/dc:creator or //office:annotation/@office:author or //office:annotation/dc:creator">
+ <字:用户集 uof:locID="t0010">
+ <xsl:for-each select="/*/office:body/office:text/text:tracked-changes/text:changed-region">
+ <字:用户 字:标识符="{generate-id()}" 字:姓名="{node()//office:change-info/dc:creator}" uof:locID="t0011" uof:attrList="标识符 姓名"/>
+ </xsl:for-each>
+ <xsl:for-each select="//office:annotation">
+ <字:用户 字:标识符="{generate-id()}" 字:姓名="{dc:creator}" uof:locID="t0011" uof:attrList="标识符 姓名"/>
+ </xsl:for-each>
+ </字:用户集>
+ </xsl:if>
+ </xsl:template>
+ <xsl:key match="/office:document/office:automatic-styles/style:style | /office:document/office:styles/style:style" name="graphicset" use="@style:name"/>
+ <xsl:template match="text:p" mode="styles">
+ <xsl:for-each select="child::*">
+ <xsl:variable name="nodename1">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:if test="(substring-before($nodename1,':') = 'draw')">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename1" select="$nodename1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="draw">
+ <xsl:param name="nodename1"/>
+ <xsl:choose>
+ <xsl:when test="substring-after($nodename1,':') = 'a'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="draw">
+ <xsl:with-param name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="substring-after($nodename1,':') = 'g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="draw:g">
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::draw:g)"/>
+ </xsl:variable>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat(@draw:style-name,'_',$picnumber1)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:choose><xsl:when test="name(parent::node())='draw:g'"><xsl:value-of select="position()"/></xsl:when><xsl:when test="@draw:z-index"><xsl:value-of select="@draw:z-index"/></xsl:when><xsl:otherwise><xsl:value-of select="position()"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:组合列表"><xsl:for-each select="child::*[1]"><xsl:variable name="node1"><xsl:value-of select="@draw:style-name"/></xsl:variable><xsl:variable name="picnumber2"><xsl:value-of select="count(preceding::*[@draw:style-name=$node1])"/></xsl:variable><xsl:call-template name="zuheliebiao"><xsl:with-param name="allnode"><xsl:value-of select="concat($node1,'_',$picnumber2)"/></xsl:with-param><xsl:with-param name="pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ </图:图形>
+ <xsl:for-each select="child::*">
+ <xsl:choose>
+ <xsl:when test="name()='draw:g'">
+ <xsl:call-template name="draw:g"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="creategraphicstyles"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="zuheliebiao">
+ <xsl:param name="allnode"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="../child::*[$pos]">
+ <xsl:for-each select="../child::*[$pos]">
+ <xsl:variable name="nodepos">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber1">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$nodepos])"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name1">
+ <xsl:value-of select="concat($nodepos,'_',$picnumber1)"/>
+ </xsl:variable>
+ <xsl:variable name="allnode1">
+ <xsl:value-of select="concat($allnode,',',$pic-name1)"/>
+ </xsl:variable>
+ <xsl:call-template name="zuheliebiao">
+ <xsl:with-param name="allnode" select="$allnode1"/>
+ <xsl:with-param name="pos" select="$pos+1"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$allnode"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="creategraphicstyles">
+ <xsl:variable name="nodename">
+ <xsl:value-of select="name()"/>
+ </xsl:variable>
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="nodename" select="$nodename"/>
+ <xsl:with-param name="picnumber" select="$picnumber"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!--xsl:key match="/office:document/office:automatic-styles/style:style" name="graphicset" use="@style:name"/>
+
+ <xsl:template match="style:style[@style:family = 'graphics']">
+ <xsl:variable name="pic-name">
+ <xsl:value-of select="@style:name"/>
+ </xsl:variable>
+ <xsl:variable name="pic-num">
+ <xsl:value-of select="count(/descendant::*[@draw:style-name=$pic-name])"/>
+ </xsl:variable>
+ <xsl:call-template name="pic-process">
+ <xsl:with-param name="pic-name" select="$pic-name"/>
+ <xsl:with-param name="pic-num" select="$pic-num"/>
+ <xsl:with-param name="current-num" select="1"/>
+ </xsl:call-template>
+ </xsl:template-->
+ <xsl:template name="pic-process">
+ <xsl:param name="pic-name"/>
+ <xsl:param name="nodename"/>
+ <xsl:param name="picnumber"/>
+ <图:图形 uof:locID="g0000" uof:attrList="层次 标识符 组合列表 其他对象">
+ <xsl:attribute name="图:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="图:层次"><xsl:value-of select="@draw:z-index"/></xsl:attribute>
+ <xsl:if test=".//office:binary-data">
+ <xsl:attribute name="图:其他对象"><xsl:choose><xsl:when test="@draw:name"><xsl:value-of select="@draw:name"/></xsl:when><xsl:otherwise><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="arrow-sign">
+ <xsl:choose>
+ <xsl:when test="key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-start or key('graphicset',$pic-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:value-of select="'1'"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' or $nodename='draw:rect' or $nodename='draw:circle' or $nodename='draw:polygon' or $nodename='draw:polyline' or $nodename='draw:ellipse' or $nodename='draw:path'or $nodename='draw:g' or $nodename='draw:text-box' or child::draw:text-box">
+ <图:预定义图形 uof:locID="g0005">
+ <图:类别 uof:locID="g0006">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:line' and $arrow-sign='1'">62</xsl:when>
+ <xsl:when test="$nodename='draw:rect'">11</xsl:when>
+ <xsl:when test="$nodename='draw:line'">61</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">19</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">65</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">66</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">19</xsl:when>
+ <xsl:when test="child::draw:text-box[@fo:min-height]">22</xsl:when>
+ <xsl:when test="child::draw:text-box">23</xsl:when>
+ </xsl:choose>
+ </图:类别>
+ <图:名称 uof:locID="g0007">
+ <xsl:choose>
+ <xsl:when test="$nodename='draw:rect'">Rectangle</xsl:when>
+ <xsl:when test="$nodename='draw:line'">Line</xsl:when>
+ <xsl:when test="$nodename='draw:circle'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:polygon'">Freeform</xsl:when>
+ <xsl:when test="$nodename='draw:polyline'">Scribble</xsl:when>
+ <xsl:when test="$nodename='draw:ellipse'">Oval</xsl:when>
+ <xsl:when test="$nodename='draw:frame' and child::draw:text-box[@fo:min-height]">排版框</xsl:when>
+ <xsl:when test="$nodename='draw:frame' and child::draw:text-box">排版框</xsl:when>
+ </xsl:choose>
+ </图:名称>
+ <图:生成软件 uof:locID="g0008">PNG</图:生成软件>
+ <xsl:if test="./@draw:points or ./@svg:d">
+ <图:关键点坐标 uof:locID="g0009" uof:attrList="路径">
+ <xsl:attribute name="图:路径"><xsl:choose><xsl:when test="@svg:d"><xsl:value-of select="@svg:d"/></xsl:when><xsl:when test="@draw:points"><xsl:call-template name="draw:points"><xsl:with-param name="point" select="@draw:points"/><xsl:with-param name="lujing"/></xsl:call-template></xsl:when></xsl:choose></xsl:attribute>
+ </图:关键点坐标>
+ </xsl:if>
+ <图:属性 uof:locID="g0011">
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:graphic-properties/@draw:fill-color or style:graphic-properties/@fo:background-color or style:graphic-properties/@draw:fill-image-name or style:graphic-properties/@draw:fill-gradient-name">
+ <图:填充 uof:locID="g0012">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill='gradient'">
+ <xsl:variable name="gradient-name">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-gradient-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/descendant::draw:gradient[@draw:name=$gradient-name]">
+ <图:渐变 uof:locID="g0037" uof:attrList="起始色 终止色 种子类型 起始浓度 终止浓度 渐变方向 边界 种子X位置 种子Y位置 类型">
+ <xsl:attribute name="图:起始色"><xsl:value-of select="@draw:start-color"/></xsl:attribute>
+ <xsl:attribute name="图:终止色"><xsl:value-of select="@draw:end-color"/></xsl:attribute>
+ <xsl:attribute name="图:种子类型"><xsl:choose><xsl:when test="@draw:style='linear' or @draw:style='axial'">linear</xsl:when><xsl:when test="@draw:style='radial'">radar</xsl:when><xsl:when test="@draw:style='ellipsoid'">oval</xsl:when><xsl:when test="@draw:style='square'">square</xsl:when><xsl:when test="@draw:style='rectangular'">rectangle</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:起始浓度"><xsl:value-of select="substring-before(@draw:start-intensity,'%')"/></xsl:attribute>
+ <xsl:attribute name="图:终止浓度"><xsl:value-of select="substring-before(@draw:end-intensity,'%')"/></xsl:attribute>
+ <xsl:variable name="angle">
+ <xsl:value-of select="@draw:angle div 10"/>
+ </xsl:variable>
+ <xsl:attribute name="图:渐变方向"><xsl:choose><xsl:when test="0&lt;$angle and $angle&lt;25">0</xsl:when><xsl:when test="25&lt;$angle and $angle&lt;70">45</xsl:when><xsl:when test="70&lt;$angle and $angle&lt;115">90</xsl:when><xsl:when test="115&lt;$angle and $angle&lt;160">135</xsl:when><xsl:when test="160&lt;$angle and $angle&lt;205">180</xsl:when><xsl:when test="205&lt;$angle and $angle&lt;250">225</xsl:when><xsl:when test="250&lt;$angle and $angle&lt;295">270</xsl:when><xsl:when test="295&lt;$angle and $angle&lt;340">315</xsl:when><xsl:when test="340&lt;$angle and $angle&lt;360">360</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:边界"><xsl:value-of select="substring-before(@draw:border,'%')"/></xsl:attribute>
+ <xsl:if test="@draw:cx">
+ <xsl:attribute name="图:种子X位置"><xsl:value-of select="substring-before(@draw:cx,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:cy">
+ <xsl:attribute name="图:种子Y位置"><xsl:value-of select="substring-before(@draw:cy,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:类型">-2</xsl:attribute>
+ </图:渐变>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name or style:graphic-properties/style:background-image/office:binary-data">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-image-name">
+ <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称">
+ <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:graphic-properties/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:graphic-properties/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:graphic-properties/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat($pic-name,'_b1')"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:名称"><xsl:value-of select="style:graphic-properties/@draw:fill-image-name"/></xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/style:background-image/office:binary-data">
+ <xsl:for-each select="style:graphic-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:fill='hatch'">
+ <图:图案 uof:locID="g0036" uof:attrList="类型 图形引用 前景色 背景色">
+ <xsl:attribute name="图:类型"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:name"/></xsl:attribute>
+ <xsl:attribute name="图:图形引用"/>
+ <xsl:attribute name="图:前景色"><xsl:value-of select="/office:document/office:styles/draw:hatch/@draw:color"/></xsl:attribute>
+ <xsl:attribute name="图:背景色"><xsl:choose><xsl:when test="style:graphic-properties/@draw:fill-color"><xsl:value-of select="style:graphic-properties/@draw:fill-color"/></xsl:when><xsl:otherwise>#ffffff</xsl:otherwise></xsl:choose></xsl:attribute>
+ </图:图案>
+ </xsl:when>
+ <xsl:otherwise>
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@fo:background-color">
+ <xsl:value-of select="style:graphic-properties/@fo:background-color"/>
+ </xsl:when>
+ <xsl:otherwise>#99ccff</xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:填充>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@svg:stroke-color">
+ <图:线颜色 uof:locID="g0013">
+ <xsl:value-of select="style:graphic-properties/@svg:stroke-color"/>
+ </图:线颜色>
+ </xsl:if>
+ <图:线型 uof:locID="g0014">
+ <xsl:variable name="linetype" select="style:graphic-properties/@draw:stroke-dash"/>
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@fo:border='none'">none</xsl:when>
+ <xsl:when test="not(style:graphic-properties/@draw:stroke)">
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@svg:stroke-width)">single</xsl:when>
+ <xsl:otherwise>thick</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:stroke = 'none'">none</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$linetype='Fine_20_Dashed' and style:graphic-properties/@svg:stroke-width">dash-long-heavy</xsl:when>
+ <xsl:when test="$linetype='Fine_20_Dashed'">dash-long</xsl:when>
+ <xsl:when test="$linetype='2 Dots 1 Dash' and style:graphic-properties/@svg:stroke-width">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='2 Dots 1 Dash'">dot-dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine Dashed' and style:graphic-properties/@svg:stroke-width">dashed-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine Dotted (var)'and style:graphic-properties/@svg:stroke-width">dotted-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine Dotted (var)'">dotted</xsl:when>
+ <xsl:when test="$linetype='Line with Fine Dots'">double</xsl:when>
+ <xsl:when test="$linetype='3 Dashes 3 Dots (var)' and style:graphic-properties/@svg:stroke-width">dash-dot-heavy</xsl:when>
+ <xsl:when test="$linetype='3 Dashes 3 Dots (var)'">dot-dash</xsl:when>
+ <xsl:when test="$linetype='Ultrafine 2 Dots 3 Dashes'and style:graphic-properties/@svg:stroke-width">wavy-heavy</xsl:when>
+ <xsl:when test="$linetype='Ultrafine 2 Dots 3 Dashes'">wave</xsl:when>
+ <xsl:when test="$linetype='Fine Dashed (var)'">wavy-double</xsl:when>
+ <xsl:otherwise>dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:线型>
+ <xsl:if test="style:graphic-properties/@svg:stroke-width">
+ <图:线粗细 uof:locID="g0016">
+ <xsl:value-of select="substring-before(style:graphic-properties/@svg:stroke-width,$uofUnit)"/>
+ </图:线粗细>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-start and string-length(style:graphic-properties/@draw:marker-start)&gt;0">
+ <图:前端箭头 uof:locID="g0017">
+ <图:式样 uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-start='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:式样>
+ <图:大小 uof:locID="g0019">
+ <xsl:choose>
+ <xsl:when test="not(style:graphic-properties/@draw:marker-start-width)">4</xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graphsize">
+ <xsl:with-param name="width" select="substring-before(style:graphic-properties/@draw:marker-start-width,$uofUnit)"/>
+ <xsl:with-param name="Unitofsize" select="$uofUnit"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:大小>
+ </图:前端箭头>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:marker-end">
+ <图:后端箭头 uof:locID="g0017">
+ <图:式样 uof:locID="g0018">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow'">normal</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Line Arrow'">open</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Arrow concave'">stealth</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Circle'">oval</xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:marker-end='Square 45'">diamond</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </图:式样>
+ <图:大小 uof:locID="g0022">
+ <xsl:choose>
+ <xsl:when test="not(style:properties/@draw:marker-start-width)">4</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:marker-end-width,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.05) and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="(not($width&gt;0.10) and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="(not($width&gt;0.15) and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="(not($width&gt;0.20) and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="(not($width&gt;0.25) and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="(not($width&gt;0.30) and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="(not($width&gt;0.35) and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="(not($width&gt;0.40) and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:大小>
+ </图:后端箭头>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:opacity or style:graphic-properties/@draw:transparency">
+ <图:透明度 uof:locID="g0038">
+ <xsl:choose>
+ <xsl:when test="style:graphic-properties/@draw:transparency">
+ <xsl:value-of select="substring-before(style:graphic-properties/@draw:transparency,'%')"/>
+ </xsl:when>
+ <xsl:when test="style:graphic-properties/@draw:opacity">
+ <xsl:value-of select="100 - substring-before(style:graphic-properties/@draw:opacity,'%')"/>
+ </xsl:when>
+ </xsl:choose>
+ </图:透明度>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x1">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:x">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="child::draw:text-box/@fo:min-height">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(child::draw:text-box/@fo:min-height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ <xsl:when test="@svg:width">
+ <图:宽度 uof:locID="g0023">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </图:宽度>
+ <图:高度 uof:locID="g0024">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </图:高度>
+ </xsl:when>
+ </xsl:choose>
+ <图:旋转角度 uof:locID="g0025">
+ <xsl:choose>
+ <xsl:when test="@draw:transform">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="@draw:transform"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-temp">
+ <xsl:value-of select="substring-before(substring-after($rotate-angle,'rotate ('),')')"/>
+ </xsl:variable>
+ <xsl:value-of select="($rotate-temp * 360) div (2 * 3.14159265)"/>
+ </xsl:when>
+ <xsl:otherwise>0.0</xsl:otherwise>
+ </xsl:choose>
+ </图:旋转角度>
+ <图:X-缩放比例 uof:locID="g0026">1</图:X-缩放比例>
+ <图:Y-缩放比例 uof:locID="g0027">1</图:Y-缩放比例>
+ <图:锁定纵横比 uof:locID="g0028">0</图:锁定纵横比>
+ <图:相对原始比例 uof:locID="g0029">1</图:相对原始比例>
+ <图:打印对象 uof:locID="g0032">true</图:打印对象>
+ <图:Web文字 uof:locID="g0033"/>
+ </图:属性>
+ </图:预定义图形>
+ </xsl:when>
+ <xsl:when test="name()='draw:path'">
+ <图:svg图形对象 图:version="1.1" 图:xmlns_xlink="http://www.w3.org/1999/xlink">
+ <xsl:attribute name="图:x"><xsl:value-of select="@svg:x"/></xsl:attribute>
+ <xsl:attribute name="图:y"><xsl:value-of select="@svg:y"/></xsl:attribute>
+ <xsl:attribute name="图:width"><xsl:value-of select="@svg:width"/></xsl:attribute>
+ <xsl:attribute name="图:height"><xsl:value-of select="@svg:height"/></xsl:attribute>
+ <xsl:attribute name="图:viewBox"><xsl:value-of select="@svg:viewBox"/></xsl:attribute>
+ <图:path>
+ <xsl:attribute name="图:d"><xsl:value-of select="@svg:d"/></xsl:attribute>
+ </图:path>
+ </图:svg图形对象>
+ </xsl:when>
+ </xsl:choose>
+ <图:文本内容 uof:locID="g0002" uof:attrList="文本框 左边距 右边距 上边距 下边距 水平对齐 垂直对齐 文字排列方向 自动换行 大小适应文字 前一链接 后一链接">
+ <xsl:if test="./draw:text-box">
+ <xsl:attribute name="图:文本框">true</xsl:attribute>
+ <xsl:if test="./@draw:name = /office:document/office:body/office:text//draw:text-box/@draw:chain-next-name">
+ <xsl:attribute name="图:前一链接"><xsl:variable name="drawname"><xsl:value-of select="./@draw:name"/></xsl:variable><xsl:variable name="befor-link-name"><xsl:value-of select="/office:document/office:body/office:text//draw:text-box[@draw:name=$drawname]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($befor-link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="./@draw:chain-next-name">
+ <xsl:attribute name="图:后一链接"><xsl:variable name="next-link"><xsl:value-of select="./@draw:chain-next-name"/></xsl:variable><xsl:variable name="link-name"><xsl:value-of select="/office:document/office:body/office:text//draw:text-box[@draw:name=$next-link]/@draw:style-name"/></xsl:variable><xsl:value-of select="concat($link-name,'_',$picnumber)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:text-properties/@fo:padding-left">
+ <xsl:attribute name="图:左边距"><xsl:value-of select="style:text-properties/@fo:padding-left"/></xsl:attribute>
+ <xsl:attribute name="图:右边距"><xsl:value-of select="style:text-properties/@fo:padding-right"/></xsl:attribute>
+ <xsl:attribute name="图:上边距"><xsl:value-of select="style:text-properties/@fo:padding-top"/></xsl:attribute>
+ <xsl:attribute name="图:下边距"><xsl:value-of select="style:text-properties/@fo:padding-bottom"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="图:文字排列方向"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode"><xsl:choose><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:paragraph-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when></xsl:choose></xsl:when><xsl:when test="style:graphic-properties/@style:writing-mode='tb-lr'">vert-l2r</xsl:when><xsl:when test="style:graphic-properties/@style:writing-mode='tb-rl'">vert-r2l</xsl:when><xsl:when test="style:paragraph-properties/@draw:textarea-horizontal-align='right'">hori-r2l</xsl:when><xsl:otherwise>hori-l2r</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:wrap-option">
+ <xsl:attribute name="图:自动换行">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:textarea-horizontal-align">
+ <xsl:attribute name="图:水平对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-horizontal-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:textarea-vertical-align">
+ <xsl:attribute name="图:垂直对齐"><xsl:value-of select="style:graphic-properties/@draw:textarea-vertical-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'">
+ <xsl:attribute name="图:大小适应文字"><xsl:choose><xsl:when test="style:graphic-properties/@draw:auto-grow-width='true' and style:graphic-properties/@draw:auto-grow-height='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="text:p">
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <xsl:if test="style:paragraph-properties">
+ <字:段落属性 uof:locID="t0052" uof:attrList="式样引用">
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ </字:段落属性>
+ </xsl:if>
+ <xsl:call-template name="textp"/>
+ </字:段落>
+ </xsl:for-each>
+ <xsl:for-each select="draw:text-box/text:p">
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <xsl:if test="style:paragraph-properties">
+ <字:段落属性 uof:locID="t0052" uof:attrList="式样引用">
+ <xsl:apply-templates select="style:paragraph-properties"/>
+ </字:段落属性>
+ </xsl:if>
+ <xsl:call-template name="textp"/>
+ </字:段落>
+ </xsl:for-each>
+ </图:文本内容>
+ <xsl:if test="@svg:x and @svg:y">
+ <图:控制点 uof:locID="g0003" uof:attrList="x坐标 y坐标">
+ <xsl:attribute name="图:x坐标"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="图:y坐标"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:attribute>
+ </图:控制点>
+ </xsl:if>
+ </图:图形>
+ <xsl:if test="name()='draw:frame' and ./draw:image">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'_',$picnumber)"/></xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="pic">
+ <xsl:choose>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.png')">png</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.jpg')">jpg</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.gif')">gif</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.bmp')">bmp</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.pbm')">pbm</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.ras')">ras</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.txt')">text</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.xml')">xml</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.htm')">html</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.html')">html</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.wav')">wav</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.mid')">midi</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.ra')">ra</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.au')">au</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.mp3')">mp3</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.snd')">snd</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.svg')">svg</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.avi')">avi</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.mpeg')">mpeg4</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.qt')">qt</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.rm')">rm</xsl:when>
+ <xsl:when test="contains(./draw:image/@xlink:href,'.asf')">asf</xsl:when>
+ <xsl:otherwise>图片</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$pic!='图片'">
+ <xsl:attribute name="uof:公共类型"><xsl:value-of select="$pic"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:私有类型">图片</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="./draw:image/office:binary-data">
+ <uof:数据 uof:locID="u0037">
+ <xsl:value-of select="./draw:image/office:binary-data"/>
+ </uof:数据>
+ </xsl:if>
+ <xsl:if test="./draw:image/@xlink:href">
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="./draw:image/@xlink:href"/>
+ </uof:路径>
+ </xsl:if>
+ </uof:其他对象>
+ </xsl:if>
+ <xsl:for-each select="(/office:document/office:styles/descendant::*[@style:name=$pic-name]) | (/office:document/office:automatic-styles/descendant::*[@style:name=$pic-name]) ">
+ <xsl:if test="style:text-properties/@draw:fill-image-name">
+ <uof:其他对象 uof:locID="u0036" uof:attrList="标识符 内嵌 公共类型 私有类型">
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="concat($pic-name,'-b1')"/></xsl:attribute>
+ <xsl:attribute name="uof:公共类型">png</xsl:attribute>
+ <xsl:attribute name="uof:内嵌">true</xsl:attribute>
+ <xsl:variable name="fill-name">
+ <xsl:value-of select="style:text-properties/@draw:fill-image-name"/>
+ </xsl:variable>
+ <uof:数据 uof:locID="u0037">
+ <xsl:for-each select="/office:document/office:styles/draw:fill-image[@draw:name=$fill-name]">
+ <xsl:value-of select="office:binary-data"/>
+ </xsl:for-each>
+ </uof:数据>
+ <uof:路径 uof:locID="u0038">
+ <xsl:value-of select="@xlink:href"/>
+ </uof:路径>
+ </uof:其他对象>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="draw:points">
+ <xsl:param name="point"/>
+ <xsl:param name="lujing"/>
+ <xsl:choose>
+ <xsl:when test="contains($point,' ' )">
+ <xsl:variable name="first-point" select="substring-before($point,' ')"/>
+ <xsl:variable name="other-point" select="substring-after($point,' ')"/>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($first-point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:call-template name="draw:points">
+ <xsl:with-param name="point" select="$other-point"/>
+ <xsl:with-param name="lujing" select="concat($lujing,$xzuobiao,' ',$yzuobiao,'lineto')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="xzuobiao">
+ <xsl:value-of select="substring-before($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:variable name="yzuobiao">
+ <xsl:value-of select="substring-after($point,',') div 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($lujing,$xzuobiao,' ',$yzuobiao)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="office:meta">
+ <uof:元数据 uof:locID="u0001">
+ <uof:标题 uof:locID="u0002">
+ <xsl:value-of select="dc:title"/>
+ </uof:标题>
+ <uof:创建应用程序 uof:locID="u0011">
+ <xsl:value-of select="meta:generator"/>
+ </uof:创建应用程序>
+ <uof:摘要 uof:locID="u0007">
+ <xsl:value-of select="dc:description"/>
+ </uof:摘要>
+ <uof:主题 uof:locID="u0003">
+ <xsl:value-of select="dc:subject"/>
+ </uof:主题>
+ <uof:创建者 uof:locID="u0004">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:创建者>
+ <!--uof:作者 uof:locID="u0005">
+ <xsl:value-of select="meta:initial-creator"/>
+ </uof:作者-->
+ <uof:创建日期 uof:locID="u0008">
+ <xsl:value-of select="meta:creation-date"/>
+ </uof:创建日期>
+ <uof:最后作者 uof:locID="u0006">
+ <xsl:value-of select="dc:creator"/>
+ </uof:最后作者>
+ <uof:关键字集 uof:locID="u0014">
+ <xsl:for-each select=".">
+ <uof:关键字 uof:locID="u0015">
+ <xsl:value-of select="meta:keywords/@meta:keyword"/>
+ </uof:关键字>
+ </xsl:for-each>
+ </uof:关键字集>
+ <uof:编辑次数 uof:locID="u0009">
+ <xsl:value-of select="meta:editing-cycles"/>
+ </uof:编辑次数>
+ <xsl:if test="meta:editing-duration">
+ <uof:编辑时间 uof:locID="u0010">
+ <xsl:value-of select="meta:editing-duration"/>
+ </uof:编辑时间>
+ </xsl:if>
+ <xsl:if test="meta:template/@xlink:href">
+ <uof:文档模板 uof:locID="u0013">
+ <xsl:value-of select="meta:template/@xlink:href"/>
+ </uof:文档模板>
+ </xsl:if>
+ <xsl:if test="meta:user-defined/@meta:name">
+ <uof:用户自定义元数据集 uof:locID="u0016">
+ <xsl:for-each select="meta:user-defined">
+ <uof:用户自定义元数据 uof:locID="u0017" uof:attrList="名称 类型">
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@meta:name"/></xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:value-of select="'string'"/></xsl:attribute>
+ </uof:用户自定义元数据>
+ </xsl:for-each>
+ </uof:用户自定义元数据集>
+ </xsl:if>
+ <!--xsl:if test="meta:document-statistic/@meta:page-count"-->
+ <uof:页数 uof:locID="u0020">
+ <xsl:value-of select="meta:document-statistic/@meta:page-count"/>
+ </uof:页数>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:paragraph-count"-->
+ <uof:段落数 uof:locID="u0025">
+ <xsl:value-of select="meta:document-statistic/@meta:paragraph-count"/>
+ </uof:段落数>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:object-count"-->
+ <uof:对象数 uof:locID="u0026">
+ <xsl:value-of select="meta:document-statistic/@meta:object-count"/>
+ </uof:对象数>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:character-count"-->
+ <uof:字数 uof:locID="u0021">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count"/>
+ </uof:字数>
+ <!--/xsl:if-->
+ <!--xsl:if test="meta:document-statistic/@meta:word-count"-->
+ <uof:中文字符数 uof:locID="u0023">
+ <xsl:value-of select="meta:document-statistic/@meta:word-count"/>
+ </uof:中文字符数>
+ <!--/xsl:if-->
+ <uof:英文字符数 uof:locID="u0022">
+ <xsl:value-of select="meta:document-statistic/@meta:character-count - meta:document-statistic/@meta:word-count"/>
+ </uof:英文字符数>
+ <uof:行数 uof:locID="u0024">
+ <xsl:variable name="quzhi">
+ <xsl:value-of select="(meta:document-statistic/@meta:character-count div 39) + 0.9"/>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($quzhi,'.')"/>
+ </uof:行数>
+ <uof:分类 uof:locID="u0012">
+ <xsl:value-of select="meta:user-defined[@meta:name='Category']"/>
+ </uof:分类>
+ <uof:经理名称 uof:locID="u0019">
+ <xsl:value-of select="meta:user-defined[meta:name='Manager']"/>
+ </uof:经理名称>
+ <uof:公司名称 uof:locID="u0018">
+ <xsl:value-of select="meta:user-defined[meta:name='Company']"/>
+ </uof:公司名称>
+ </uof:元数据>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <uof:字体集 uof:locID="u0040">
+ <xsl:for-each select="style:font-face">
+ <xsl:element name="uof:字体声明">
+ <xsl:attribute name="uof:attrList">标识符 名称 字体族</xsl:attribute>
+ <xsl:attribute name="uof:locID">u0041</xsl:attribute>
+ <xsl:attribute name="uof:名称"><xsl:value-of select="@svg:font-family"/></xsl:attribute>
+ <xsl:attribute name="uof:标识符"><xsl:value-of select="translate(@style:name,' ','_')"/></xsl:attribute>
+ <xsl:if test="@style:font-charset= '02'">
+ <xsl:attribute name="uof:字符集">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-family-generic">
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <xsl:attribute name="uof:字体族">Swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='modern'">
+ <xsl:attribute name="uof:字体族">Modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic='roman'">
+ <xsl:attribute name="uof:字体族">Roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='script'">
+ <xsl:attribute name="uof:字体族">Script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='decorative'">
+ <xsl:attribute name="uof:字体族">Decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic ='system'">
+ <xsl:attribute name="uof:字体族">System</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="uof:字体族">System</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="style:font-decl"/>
+ </uof:字体集>
+ </xsl:template>
+ <xsl:template name="自动编号集">
+ <xsl:element name="uof:自动编号集">
+ <xsl:attribute name="uof:locID">u0042</xsl:attribute>
+ <xsl:for-each select="/office:document//text:list-style">
+ <xsl:element name="字:自动编号">
+ <xsl:attribute name="uof:locID">t0169</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 父编号引用 多级编号</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:if test=".//@text:style-name">
+ <xsl:attribute name="字:名称"><xsl:value-of select=".//@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="字:多级编号">true</xsl:attribute>
+ <xsl:for-each select="./* ">
+ <xsl:if test="not(number(@text:level)=10)">
+ <xsl:element name="字:级别">
+ <xsl:attribute name="uof:locID">t0159</xsl:attribute>
+ <xsl:attribute name="uof:attrList">级别值 编号对齐方式 尾随字符</xsl:attribute>
+ <xsl:attribute name="字:级别值"><xsl:value-of select="number(@text:level) - 1"/></xsl:attribute>
+ <xsl:if test="@style:num-suffix">
+ <xsl:attribute name="字:尾随字符"><xsl:choose><xsl:when test="@style:num-suffix=' '">space</xsl:when><xsl:when test="@style:num-suffix=' '">tab</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@fo:text-align">
+ <xsl:attribute name="字:编号对齐方式"><xsl:variable name="vv"><xsl:value-of select="style:list-level-properties/@fo:text-align"/></xsl:variable><xsl:choose><xsl:when test="$vv='center' ">center</xsl:when><xsl:when test="$vv='end' ">right</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:bullet-char">
+ <xsl:element name="字:项目符号">
+ <xsl:attribute name="uof:locID">t0171</xsl:attribute>
+ <xsl:value-of select="@text:bullet-char"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:style-name">
+ <xsl:element name="字:符号字体">
+ <xsl:attribute name="uof:locID">t0160</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@style:num-format">
+ <xsl:choose>
+ <xsl:when test="string(@style:num-format)='a'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>lower-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='A'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>upper-letter</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='i'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>lower-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='I'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>upper-roman</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='①, ②, ③, ...'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>decimal-enclosed-circle</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='甲, 乙, 丙, ...'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>ideograph-traditional</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='子, 丑, 寅, ...'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>ideograph-zodiac</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='一, 二, 三, ...'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>chinese-counting</xsl:element>
+ </xsl:when>
+ <xsl:when test="string(@style:num-format)='壹, 贰, 叁, ...'">
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>chinese-legal-simplified</xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:编号格式">
+ <xsl:attribute name="uof:locID">t0162</xsl:attribute>decimal</xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:variable name="jibie">
+ <xsl:value-of select="position()"/>
+ </xsl:variable>
+ <xsl:variable name="xianshijibie">
+ <xsl:choose>
+ <xsl:when test="@text:display-levels">
+ <xsl:value-of select="@text:display-levels"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="字:编号格式表示">
+ <xsl:attribute name="uof:locID">t0163</xsl:attribute>
+ <xsl:call-template name="字:编号格式表示">
+ <xsl:with-param name="bubianjibie" select="$jibie"/>
+ <xsl:with-param name="jibie" select="$jibie"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie"/>
+ <xsl:with-param name="biaoshi" select="concat(string(@style:num-prefix),'%',$jibie,string(@style:num-suffix))"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:if test="office:binary-data">
+ <xsl:element name="字:图片符号引用">
+ <xsl:attribute name="uof:locID">t0164</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 高度</xsl:attribute>
+ <xsl:if test="style:list-level-properties/@fo:width">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:width,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@fo:height">
+ <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:list-level-properties/@fo:height,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="concat('image_numbering_',count(preceding::text:list-level-style-image))"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-left or style:paragraph-properties/@fo:margin-right or style:paragraph-properties/@fo:text-indent">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0165</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:list-level-properties/@text:min-label-width">
+ <xsl:element name="字:制表符位置">
+ <xsl:attribute name="uof:locID">t0166</xsl:attribute>
+ <xsl:value-of select="substring-before(style:list-level-properties/@text:min-label-width,$uofUnit)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:start-value">
+ <xsl:element name="字:起始编号">
+ <xsl:attribute name="uof:locID">t0167</xsl:attribute>
+ <xsl:value-of select="@text:start-value"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:num-regular-exp">
+ <xsl:element name="字:正规格式">
+ <xsl:attribute name="uof:locID">t0168</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="@text:num-regular-exp"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="shiyang">
+ <xsl:for-each select="office:styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='text'">
+ <xsl:element name="uof:句式样">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name">
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="office:automatic-styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='text'">
+ <xsl:element name="uof:句式样">
+ <xsl:attribute name="uof:locID">u0043</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">custom</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name">
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name and not(@style:parent-style-name='Standard')">
+ <xsl:variable name="stylename" select="@style:parent-style-name"/>
+ <xsl:for-each select="/office:document/office:styles/style:style[@style:name=$stylename]">
+ <xsl:call-template name="字:句属性"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="office:styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='paragraph'">
+ <xsl:element name="uof:段落式样">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:if test="@style:display-name">
+ <xsl:attribute name="字:别名"><xsl:value-of select="@style:display-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ <xsl:call-template name="ParaAttribute"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:for-each select="office:automatic-styles/style:style">
+ <xsl:choose>
+ <xsl:when test="@style:family='paragraph'">
+ <xsl:element name="uof:段落式样">
+ <xsl:attribute name="uof:locID">u0044</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">custom</xsl:attribute>
+ <xsl:if test="@style:parent-style-name">
+ <xsl:attribute name="字:基式样引用"><xsl:value-of select="@style:parent-style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ <xsl:call-template name="ParaAttribute"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="字:编号格式表示">
+ <xsl:param name="bubianjibie"/>
+ <xsl:param name="jibie"/>
+ <xsl:param name="xianshijibie"/>
+ <xsl:param name="biaoshi"/>
+ <xsl:choose>
+ <xsl:when test="number($xianshijibie)= 1">
+ <xsl:value-of select="$biaoshi"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-prefix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-prefix"/>
+ </xsl:variable>
+ <xsl:variable name="num-suffix">
+ <xsl:value-of select="preceding-sibling::*[number($bubianjibie -$jibie +1)]/@style:num-suffix"/>
+ </xsl:variable>
+ <xsl:call-template name="字:编号格式表示">
+ <xsl:with-param name="bubianjibie" select="$bubianjibie"/>
+ <xsl:with-param name="jibie" select="$jibie -1"/>
+ <xsl:with-param name="xianshijibie" select="$xianshijibie -1"/>
+ <xsl:with-param name="biaoshi" select="concat($num-prefix,'%',number($jibie -1),$num-suffix,'.',$biaoshi)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="style:style[ancestor::office:automatic-styles]" mode="style">
+ <xsl:for-each select=".">
+ <xsl:choose>
+ <xsl:when test="@style:family='table' ">
+ <xsl:element name="uof:文字表式样">
+ <xsl:attribute name="uof:locID">u0045</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型 别名 基式样引用 后继式样引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:别名"><xsl:value-of select="@style:name"/></xsl:attribute>
+ <xsl:attribute name="字:类型">auto</xsl:attribute>
+ <xsl:if test="style:table-properties">
+ <xsl:element name="字:宽度">
+ <xsl:attribute name="字:绝对宽度"><xsl:value-of select="substring-before(style:table-properties/@style:width,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0130</xsl:attribute>
+ <xsl:attribute name="uof:attrList">绝对宽度 相对宽度</xsl:attribute>
+ </xsl:element>
+ <字:对齐 uof:locID="t0133">
+ <xsl:choose>
+ <xsl:when test="style:table-properties/@table:align='right'">right</xsl:when>
+ <xsl:when test="style:table-properties/@table:align='center'">center</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </字:对齐>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="office:settings">
+ <字:文档设置 uof:locID="t0001">
+ <字:度量单位 uof:locID="t0006">
+ <xsl:value-of select="$ooUnit"/>
+ </字:度量单位>
+ <字:默认制表位位置 uof:locID="t0004">
+ <xsl:variable name="aa" select="substring-before(/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance,$ooUnit)"/>
+ <xsl:variable name="bb" select="$aa - 0.74"/>
+ <xsl:value-of select="substring($bb,1,4)"/>
+ </字:默认制表位位置>
+ <字:当前视图 uof:locID="t0002">
+ <xsl:choose>
+ <xsl:when test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item[@config:name='InBrowseMode']='false'">page</xsl:when>
+ <xsl:when test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item[@config:name='InBrowseMode']='true'">web</xsl:when>
+ <xsl:otherwise>page</xsl:otherwise>
+ </xsl:choose>
+ </字:当前视图>
+ <xsl:if test="config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry/config:config-item[@config:name='ZoomFactor']">
+ <字:缩放 uof:locID="t0003">
+ <xsl:value-of select="config:config-item-set[@config:name='ooo:view-settings']/config:config-item-map-indexed[@config:name='Views']/config:config-item-map-entry/config:config-item[@config:name='ZoomFactor']"/>
+ </字:缩放>
+ </xsl:if>
+ <字:修订 uof:locID="t0005">
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="/office:document/office:body/office:text/text:tracked-changes">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </字:修订>
+ <xsl:if test="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']">
+ <字:标点禁则 uof:locID="t0007">
+ <字:行首字符 uof:locID="t0008">
+ <xsl:value-of select="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']/config:config-item[@config:name='BeginLine']"/>
+ </字:行首字符>
+ <字:行尾字符 uof:locID="t0009">
+ <xsl:value-of select="config:config-item-set[@config:name='configuration-settings']/config:config-item-map-indexed[@config:name='ForbiddenCharacters']/config:config-item-map-entry[config:config-item='CN']/config:config-item[@config:name='EndLine']"/>
+ </字:行尾字符>
+ </字:标点禁则>
+ <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']">
+ <字:尾注位置 uof:locID="t0210" uof:attrList="位置">
+ <xsl:attribute name="字:位置">doc-end</xsl:attribute>
+ </字:尾注位置>
+ </xsl:if>
+ </xsl:if>
+ </字:文档设置>
+ </xsl:template>
+ <xsl:template name="style:page-layout">
+ <字:分节 uof:locID="t0017" uof:attrList="名称">
+ <xsl:attribute name="字:名称"><xsl:variable name="stylename"><xsl:value-of select="@style:name"/></xsl:variable><xsl:value-of select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$stylename]/@style:name"/></xsl:attribute>
+ <字:节属性 uof:locID="t0018">
+ <字:节类型 uof:locID="t0020">new-page</字:节类型>
+ <xsl:element name="字:页边距">
+ <xsl:attribute name="uof:locID">t0021</xsl:attribute>
+ <xsl:attribute name="uof:attrList">左 上 右 下</xsl:attribute>
+ <xsl:attribute name="uof:上"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:左"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-left,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:下"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:右"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:margin-right,$ooUnit)"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:纸张">
+ <xsl:attribute name="uof:locID">t0022</xsl:attribute>
+ <xsl:attribute name="uof:attrList">纸型 宽度 高度</xsl:attribute>
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-width,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@fo:page-height,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="uof:纸型"><xsl:variable name="height"><xsl:value-of select="style:page-layout-properties/@fo:page-height"/></xsl:variable><xsl:variable name="width"><xsl:value-of select="style:page-layout-properties/@fo:page-width"/></xsl:variable><xsl:choose><xsl:when test="$width='29.702cm' and $height='42cm'">A3</xsl:when><xsl:when test="$width='21.001cm' and $height='29.7cm'">A4</xsl:when><xsl:when test="$width='14.799cm' and $height='20.999cm'">A5</xsl:when><xsl:when test="$width='25cm' and $height='35.3cm'">B4</xsl:when><xsl:when test="$width='17.598cm' and $height='25cm'">B5</xsl:when><xsl:when test="$width='12.5cm' and $height='17.6cm'">B6</xsl:when><xsl:otherwise>使用者</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="/office:document/office:master-styles/style:master-page/style:header-left">
+ <xsl:element name="字:奇偶页页眉页脚不同">
+ <xsl:attribute name="uof:locID">t0023</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:首页页眉页脚不同">
+ <xsl:attribute name="uof:locID">t0024</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:header-style/style:header-footer-properties">
+ <xsl:element name="字:页眉位置">
+ <xsl:attribute name="uof:locID">t0025</xsl:attribute>
+ <xsl:attribute name="uof:attrList">距边界 距版芯</xsl:attribute>
+ <xsl:attribute name="字:距边界"><xsl:value-of select="substring-before(style:header-style/style:header-footer-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="substring-before(style:header-style/style:header-footer-properties/@fo:margin-bottom,$ooUnit)"/>
+ <xsl:variable name="long2" select="substring-before(style:header-style/style:header-footer-properties/@svg:height,$ooUnit)"/>
+ <xsl:attribute name="字:距版芯"><xsl:value-of select="$long2 - $long1"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:footer-style/style:header-footer-properties">
+ <xsl:element name="字:页脚位置">
+ <xsl:attribute name="uof:locID">t0026</xsl:attribute>
+ <xsl:attribute name="uof:attrList">距边界 距版芯</xsl:attribute>
+ <xsl:attribute name="字:距边界"><xsl:value-of select="substring-before(style:footer-style/style:header-footer-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="substring-before(style:footer-style/style:header-footer-properties/@fo:margin-top,$ooUnit)"/>
+ <xsl:variable name="long2" select="substring-before(style:footer-style/style:header-footer-properties/@svg:height,$ooUnit)"/>
+ <xsl:attribute name="字:距版芯"><xsl:value-of select="$long2 - $long1"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="masterPages" select="'Standard'"/>
+ <xsl:variable name="mp">
+ <xsl:value-of select="@style:name"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$mp and @style:name=$masterPages]">
+ <xsl:if test="style:header-left or style:header">
+ <字:页眉 uof:locID="t0027">
+ <xsl:choose>
+ <xsl:when test="style:header-left">
+ <xsl:for-each select="style:header">
+ <字:首页页眉 uof:locID="t0030">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:首页页眉>
+ </xsl:for-each>
+ <xsl:for-each select="style:header-left">
+ <字:偶数页页眉 uof:locID="t0029">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:偶数页页眉>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="style:header">
+ <字:奇数页页眉 uof:locID="t0028">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:奇数页页眉>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:页眉>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:master-styles/style:master-page[@style:page-layout-name=$mp and @style:name=$masterPages]">
+ <xsl:if test="style:footer-left or style:footer">
+ <字:页脚 uof:locID="t0031">
+ <xsl:choose>
+ <xsl:when test="style:footer-left">
+ <xsl:for-each select="style:footer">
+ <字:首页页脚 uof:locID="t0034">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:首页页脚>
+ </xsl:for-each>
+ <xsl:for-each select="style:footer-left">
+ <字:偶数页页脚 uof:locID="t0033">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:偶数页页脚>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="style:footer">
+ <字:奇数页页脚 uof:locID="t0032">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="table:table">
+ <xsl:for-each select="table:table">
+ <xsl:call-template name="exec_table"/>
+ </xsl:for-each>
+ </xsl:if>
+ </字:奇数页页脚>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:页脚>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="@style:page-usage">
+ <字:对称页边距 uof:locID="t0036" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:page-usage='mirrored'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </字:对称页边距>
+ </xsl:if>
+ <xsl:if test="@style:page-usage='mirrored'">
+ <xsl:element name="字:拼页">
+ <xsl:attribute name="uof:locID">t0037</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">1</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:纸张方向">
+ <xsl:attribute name="uof:locID">t0038</xsl:attribute>
+ <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
+ </xsl:element>
+ <xsl:if test="style:page-layout-properties/@style:paper-tray-name">
+ <字:纸张来源 uof:locID="t0039" uof:attrList="首页 其他页" 字:首页="false" 字:其他页="style:page-layout-properties/@style:paper-tray-name"/>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:num-format">
+ <xsl:element name="字:页码设置">
+ <xsl:attribute name="uof:locID">t0042</xsl:attribute>
+ <xsl:attribute name="uof:attrList">首页显示 格式 包含章节号 章节起始样式引用 分隔符 起始编号</xsl:attribute>
+ <xsl:attribute name="字:首页显示">1</xsl:attribute>
+ <xsl:attribute name="字:格式"><xsl:variable name="format"><xsl:value-of select="style:page-layout-properties/@style:num-format"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="style:text-properties/@style:first-page-number">
+ <xsl:attribute name="字:起始编号"><xsl:value-of select="style:text-properties/@style:first-page-number"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="字:包含章节号">false</xsl:attribute>
+ <!--xsl:attribute name="字:章节起始样式引用">false</xsl:attribute-->
+ <xsl:attribute name="字:分隔符">hyphen</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='footnote']">
+ <xsl:element name="字:脚注设置">
+ <xsl:attribute name="uof:locID">t0040</xsl:attribute>
+ <xsl:attribute name="uof:attrList">位置 格式 起始编号 编号方式</xsl:attribute>
+ <xsl:for-each select="/office:document/office:styles/text:notes-configuration[@text:note-class='footnote']">
+ <xsl:attribute name="字:位置"><xsl:choose><xsl:when test="@text:footnotes-position='page'">page-bottom</xsl:when><xsl:when test="@text:footnotes-position='document'">below-text</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:编号方式"><xsl:choose><xsl:when test="@text:start-numbering-at='document'">continuous</xsl:when><xsl:when test="@text:start-numbering-at='chapter'">section</xsl:when><xsl:when test="@text:start-numbering-at='page'">page</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:起始编号"><xsl:value-of select="@text:start-value + 1"/></xsl:attribute>
+ <xsl:attribute name="字:格式"><xsl:variable name="format"><xsl:value-of select="@style:num-format"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']">
+ <字:尾注设置 uof:locID="t0041" uof:attrList="格式 起始编号 编号方式">
+ <xsl:for-each select="/office:document/office:styles/text:notes-configuration[@text:note-class='endnote']">
+ <xsl:attribute name="字:格式"><xsl:variable name="format"><xsl:value-of select="@style:num-format"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="字:起始编号"><xsl:value-of select="@text:start-value + 1"/></xsl:attribute>
+ </xsl:for-each>
+ </字:尾注设置>
+ </xsl:if>
+ <xsl:if test="/office:document/office:styles/text:linenumbering-configuration">
+ <字:行号设置 uof:locID="t0043" uof:attrList="使用行号 编号方式 起始编号 距边界 行号间隔">
+ <xsl:for-each select="/office:document/office:styles/text:linenumbering-configuration">
+ <xsl:choose>
+ <xsl:when test="@text:number-lines='false'">
+ <xsl:attribute name="字:使用行号">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:使用行号">true</xsl:attribute>
+ <xsl:attribute name="字:编号方式"><xsl:choose><xsl:when test="@text:count-in-floating-frames='true'">section</xsl:when><xsl:when test="@text:restart-on-page='true'">page</xsl:when><xsl:when test="@text:count-empty-lines='false'"/><xsl:otherwise>continuous</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@style:num-format">
+ <xsl:attribute name="字:起始编号"><xsl:value-of select="@style:num-format"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:offset">
+ <xsl:attribute name="字:距边界"><xsl:value-of select="substring-before(@text:offset,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:increment">
+ <xsl:attribute name="字:行号间隔"><xsl:value-of select="@text:increment"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </字:行号设置>
+ </xsl:if>
+ <xsl:variable name="aa">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-ruby-height,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-display and $aa='0' ">
+ <字:网格设置 uof:locID="t0044" uof:attrList="网格类型 宽度 高度 显示网格 打印网格">
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-mode">
+ <xsl:attribute name="字:网格类型"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both-nosnap'">line-char</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both'">char</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='line'">line</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='none'">none</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-base-width">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-width,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-base-height">
+ <xsl:attribute name="字:高度"><xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-height,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-display">
+ <xsl:attribute name="字:显示网格"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-display='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-print">
+ <xsl:attribute name="字:打印网格"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-print='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </字:网格设置>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-display and not($aa = '0')">
+ <字:稿纸设置 uof:locID="t0211" uof:attrList="类型 格式 线型 颜色 方向">
+ <xsl:variable name="mode">
+ <xsl:value-of select="style:page-layout-properties/@style:layout-grid-mode"/>
+ </xsl:variable>
+ <xsl:variable name="ruby">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-ruby-height,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-width,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:value-of select="substring-before(style:page-layout-properties/@style:layout-grid-base-height,$ooUnit)"/>
+ </xsl:variable>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='line'">letter-paper</xsl:when><xsl:when test="style:page-layout-properties/@style:layout-grid-mode='both'">draft-paper</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-mode">
+ <xsl:attribute name="字:格式"><xsl:choose><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='0.496' ">fourth-gear</xsl:when><xsl:when test="$mode='both' and $width='0.584' and $height='0.584' and $ruby='0.64' ">third-gear</xsl:when><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='0.905' ">second-gear</xsl:when><xsl:when test="$mode='both' and $width='0.728' and $height='0.728' and $ruby='1.633' ">first-gear</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:layout-grid-color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:page-layout-properties/@style:layout-grid-color"/></xsl:attribute>
+ </xsl:if>
+ </字:稿纸设置>
+ </xsl:if>
+ <xsl:if test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/@style:writing-mode='lr-tb' or style:text-properties/@style:writing-mode='rl-tb'">
+ <字:垂直对齐方式 uof:locID="t0045">
+ <xsl:variable name="path" select="/office:document/office:automatic-styles/style:style/style:paragraph-properties"/>
+ <xsl:choose>
+ <xsl:when test="$path/@fo:text-align='start'">top</xsl:when>
+ <xsl:when test="$path/@fo:text-align='end'">bottom</xsl:when>
+ <xsl:when test="$path/@fo:text-align='center'">center</xsl:when>
+ <xsl:otherwise>justified</xsl:otherwise>
+ </xsl:choose>
+ </字:垂直对齐方式>
+ </xsl:if>
+ <字:文字排列方向 uof:locID="t0046">
+ <xsl:variable name="writing_mode">
+ <xsl:value-of select="style:page-layout-properties/@style:writing-mode"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$writing_mode='lr-tb' or $writing_mode='lr'">hori-l2r</xsl:when>
+ <xsl:when test="$writing_mode='rl-tb' or $writing_mode='rl'">hori-r2l</xsl:when>
+ <xsl:when test="$writing_mode='tb-rl'">vert-r2l</xsl:when>
+ <xsl:when test="$writing_mode='tb-lr'">vert-l2r</xsl:when>
+ <xsl:otherwise>hori-l2r</xsl:otherwise>
+ </xsl:choose>
+ </字:文字排列方向>
+ <xsl:if test="style:page-layout-properties/@fo:border or style:page-layout-properties/@fo:border-top or style:page-layout-properties/@fo:border-bottom or style:page-layout-properties/@fo:border-left or style:page-layout-properties/@fo:border-right or style:page-layout-properties/@style:shadow[.!='none']">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0047</xsl:attribute>
+ <xsl:for-each select="style:page-layout-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:background-color">
+ <xsl:element name="字:填充">
+ <xsl:attribute name="uof:locID">t0048</xsl:attribute>
+ <xsl:for-each select="style:page-layout-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/style:columns">
+ <xsl:element name="字:分栏">
+ <xsl:attribute name="uof:locID">t0049</xsl:attribute>
+ <xsl:attribute name="uof:attrList">栏数 等宽 分隔线 分隔线宽度 分隔线颜色</xsl:attribute>
+ <xsl:if test="//@fo:column-count">
+ <xsl:attribute name="字:栏数"><xsl:choose><xsl:when test="//@fo:column-count='0'">1</xsl:when><xsl:otherwise><xsl:value-of select="//@fo:column-count"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="第一宽度">
+ <xsl:value-of select="style:page-layout-properties/style:columns/style:column/@style:rel-width"/>
+ </xsl:variable>
+ <xsl:variable name="dkm">
+ <xsl:for-each select="style:page-layout-properties/style:columns/style:column">
+ <xsl:if test="$第一宽度 != @style:rel-width">
+ <xsl:value-of select="boolean($第一宽度 = @style:rel-width)"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="style:page-layout-properties/style:columns/@fo:column-gap">
+ <xsl:attribute name="字:等宽">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:等宽">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="style:page-layout-properties/style:columns/style:column-sep">
+ <xsl:attribute name="字:分隔线宽度"><xsl:value-of select="substring-before(style:page-layout-properties/style:columns/style:column-sep/@style:width,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:分隔线颜色"><xsl:value-of select="style:page-layout-properties/style:columns/style:column-sep/@style:color"/></xsl:attribute>
+ <xsl:attribute name="字:分隔线">single</xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="style:page-layout-properties/style:columns/style:column">
+ <xsl:element name="字:栏">
+ <xsl:variable name="left">
+ <xsl:value-of select="substring-before(@fo:start-indent,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="right">
+ <xsl:value-of select="substring-before(@fo:end-indent,$uofUnit)"/>
+ </xsl:variable>
+ <xsl:if test="@style:rel-width">
+ <xsl:attribute name="字:宽度"><xsl:value-of select="substring-before(@style:rel-width,'*')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:start-indent or @fo:end-indent">
+ <xsl:choose>
+ <xsl:when test="parent::style:columns/@fo:column-gap">
+ <xsl:attribute name="字:间距"><xsl:choose><xsl:when test="$left - $right &gt;0 "><xsl:value-of select="$left - $right"/></xsl:when><xsl:when test="$right - $left &gt; 0 "><xsl:value-of select="$right - $left"/></xsl:when><xsl:otherwise><xsl:value-of select="$right"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:间距"><xsl:value-of select="$right"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0050</xsl:attribute>
+ <xsl:attribute name="uof:attrList">宽度 间距</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </字:节属性>
+ </字:分节>
+ </xsl:template>
+ <xsl:template match="office:text">
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name()='text:list'or name()='text:ordered-list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="number('1')"/>
+ <xsl:with-param name="liststylename" select="@text:style-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='text:p'or name()='text:h'">
+ <xsl:variable name="bs" select="./@text:style-name"/>
+ <xsl:if test="/office:document/office:automatic-styles/style:style[@style:name=$bs]/@style:master-page-name">
+ <xsl:variable name="bs1" select="/office:document/office:automatic-styles/style:style[@style:name=$bs]/@style:master-page-name"/>
+ <xsl:if test="/office:document/office:master-styles/style:master-page[@style:name=$bs1]/@style:page-layout-name">
+ <xsl:variable name="bs2" select="/office:document/office:master-styles/style:master-page[@style:name=$bs1]/@style:page-layout-name"/>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:page-layout[@style:name=$bs2]">
+ <xsl:call-template name="style:page-layout"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='table:table'">
+ <xsl:variable name="tbs" select="./@table:style-name"/>
+ <xsl:if test="/office:document/office:automatic-styles/style:style[@style:name=$tbs]/@style:master-page-name">
+ <xsl:variable name="tbs1" select="/office:document/office:automatic-styles/style:style[@style:name=$tbs]/@style:master-page-name"/>
+ <xsl:if test="/office:document/office:master-styles/style:master-page[@style:name=$tbs1]/@style:page-layout-name">
+ <xsl:variable name="tbs2" select="/office:document/office:master-styles/style:master-page[@style:name=$tbs1]/@style:page-layout-name"/>
+ <xsl:for-each select="/office:document/office:automatic-styles/style:page-layout[@style:name=$tbs2]">
+ <xsl:call-template name="style:page-layout"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="exec_table"/>
+ </xsl:when>
+ <xsl:when test="name()='text:table-of-content'">
+ <xsl:call-template name="text:table-of-content"/>
+ </xsl:when>
+ <xsl:when test="name()='text:alphabetical-index'">
+ <xsl:call-template name="text:alphabetical-index"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="jiaozhu">
+ <字:脚注 uof:locID="t0107" uof:attrList="引文体">
+ <xsl:for-each select="text:note-citation">
+ <xsl:attribute name="字:引文体"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:for-each select="text:note-body/text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </字:脚注>
+ </xsl:template>
+ <xsl:template name="weizhu">
+ <字:尾注 uof:locID="t0108" uof:attrList="引文体">
+ <xsl:for-each select="text:note-citation">
+ <xsl:attribute name="字:引文体"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:for-each select="text:note-body/text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </字:尾注>
+ </xsl:template>
+ <xsl:template name="unordered-ordered-list">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <xsl:for-each select="text:list-item">
+ <xsl:if test="text:p">
+ <xsl:for-each select="text:p">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="node( )">
+ <xsl:if test="name()='text:list'">
+ <xsl:call-template name="unordered-ordered-list">
+ <xsl:with-param name="currlistlvl" select="$currlistlvl +1"/>
+ <xsl:with-param name="liststylename" select="$liststylename"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="execParagraph">
+ <xsl:param name="currlistlvl"/>
+ <xsl:param name="liststylename"/>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:if test="@text:style-name">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(number($currlistlvl) =number('0'))">
+ <xsl:variable name="parent-position">
+ <xsl:number from="/office:document/office:body/office:text/text:list" level="any" count="text:list-item/text:p" format="1"/>
+ </xsl:variable>
+ <xsl:element name="字:自动编号信息">
+ <xsl:attribute name="uof:locID">t0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">编号引用 编号级别 重新编号 起始编号</xsl:attribute>
+ <xsl:attribute name="字:编号引用"><xsl:value-of select="$liststylename"/></xsl:attribute>
+ <xsl:attribute name="字:编号级别"><xsl:value-of select="$currlistlvl - 1"/></xsl:attribute>
+ <xsl:attribute name="字:重新编号"><xsl:choose><xsl:when test="number($parent-position)=number('1')">1</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:起始编号"><xsl:for-each select="/office:document//text:list-style[$liststylename=@style:name]/*[number($currlistlvl)=number(@text:level)]"><xsl:choose><xsl:when test="@text:start-value"><xsl:value-of select="@text:start-value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:for-each></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document//style:style">
+ <xsl:if test="@style:name=$stylename">
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="$stylename"/></xsl:attribute>
+ <xsl:call-template name="字:句属性"/>
+ </xsl:element>
+ <xsl:call-template name="ParaAttribute">
+ <xsl:with-param name="text-style-name" select="@style:name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:call-template name="textp"/>
+ <xsl:if test="parent::office:text and not(preceding-sibling::text:p) and preceding-sibling::*[substring-before(name(),':')='draw']">
+ <xsl:for-each select="preceding-sibling::*[substring-before(name(),':')='draw']">
+ <字:句 uof:locID="t0085">
+ <xsl:call-template name="字:锚点"/>
+ </字:句>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="draw:frame/draw:text-box/text:p">
+ <xsl:for-each select="draw:frame/draw:text-box/text:p">
+ <xsl:for-each select="child::*[substring-before(name(),':')='draw']">
+ <字:句 uof:locID="t0085">
+ <xsl:call-template name="字:锚点"/>
+ </字:句>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:if test="//office:document/office:automatic-styles/style:style[@style:name=$aa]/style:paragraph-properties/@fo:break-before='column'">
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:分栏符">
+ <xsl:attribute name="uof:locID">t0125</xsl:attribute>
+ </xsl:element>
+ </字:句>
+ </xsl:if>
+ <xsl:if test="//office:document/office:automatic-styles/style:style[@style:name=$aa]/style:paragraph-properties/@fo:break-before='page'">
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:分页符">
+ <xsl:attribute name="uof:locID">t0127</xsl:attribute>
+ </xsl:element>
+ </字:句>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:initial-creator">
+ <xsl:apply-templates select="text:initial-creator"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:title">
+ <xsl:apply-templates select="text:title"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:subject">
+ <xsl:apply-templates select="text:subject"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:file-name">
+ <xsl:apply-templates select="text:file-name"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:author-name">
+ <xsl:apply-templates select="text:author-name"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:author-initials">
+ <xsl:apply-templates select="text:author-initials"/>
+ </xsl:if>
+ <xsl:if test="/office:document/office:body/office:text/text:p/text:span/text:date">
+ <xsl:apply-templates select="text:date"/>
+ </xsl:if>
+ </字:段落>
+ </xsl:template>
+ <xsl:template name="ParaAttribute">
+ <xsl:param name="text-style-name"/>
+ <xsl:if test="substring-after(@style:display-name,'Heading')">
+ <xsl:element name="字:大纲级别">
+ <xsl:attribute name="uof:locID">t0054</xsl:attribute>
+ <xsl:value-of select="substring-after(@style:display-name,'Heading ')"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:text-align or style:paragraph-properties/@style:vertical-align">
+ <xsl:element name="字:对齐">
+ <xsl:attribute name="uof:locID">t0055</xsl:attribute>
+ <xsl:attribute name="uof:attrList">水平对齐 文字对齐</xsl:attribute>
+ <xsl:attribute name="字:水平对齐"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:text-align='end'">right</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='center'">center</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='justify' and not(style:paragraph-properties/@fo:text-align-last='justify')">justified</xsl:when><xsl:when test="style:paragraph-properties/@fo:text-align='justify' and style:paragraph-properties/@fo:text-align-last='justify'">distributed</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="字:文字对齐"><xsl:choose><xsl:when test="style:paragraph-properties/@style:vertical-align='baseline'">base</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='top'">top</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='middle'">center</xsl:when><xsl:when test="style:paragraph-properties/@style:vertical-align='bottom'">bottom</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-left or style:paragraph-properties/@fo:margin-right or style:paragraph-properties/@fo:text-indent">
+ <xsl:element name="字:缩进">
+ <xsl:attribute name="uof:locID">t0056</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="字:缩进类型"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:行距">
+ <xsl:attribute name="uof:locID">t0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 值</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(style:paragraph-properties/@fo:line-height,$ooUnit)">
+ <xsl:attribute name="字:类型">fixed</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:line-height,$ooUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(style:paragraph-properties/@fo:line-height,'%')">
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:line-height,'%') div 100"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:paragraph-properties/@style:line-height-at-least">
+ <xsl:attribute name="字:类型">at-least</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@style:line-height-at-least,$ooUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="style:paragraph-properties/@style:line-spacing">
+ <xsl:attribute name="字:类型">line-space</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@style:line-spacing,$ooUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">multi-lines</xsl:attribute>
+ <xsl:attribute name="字:值">1.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@fo:widows">
+ <xsl:element name="字:孤行控制">
+ <xsl:attribute name="uof:locID">t0060</xsl:attribute>
+ <xsl:value-of select="style:paragraph-properties/@fo:widows"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:orphans">
+ <xsl:element name="字:寡行控制">
+ <xsl:attribute name="uof:locID">t0061</xsl:attribute>
+ <xsl:value-of select="style:paragraph-properties/@fo:orphans"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:段中不分页">
+ <xsl:attribute name="uof:locID">t0062</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:keep-together='always'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@fo:keep-with-next">
+ <xsl:element name="字:与下段同页">
+ <xsl:attribute name="uof:locID">t0063</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:break-before">
+ <xsl:element name="字:段前分页">
+ <xsl:attribute name="uof:locID">t0064</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@style:snap-to-layout-grid">
+ <xsl:element name="字:对齐网格">
+ <xsl:attribute name="uof:locID">t0069</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:snap-to-layout-grid='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:lines">
+ <xsl:element name="字:首字下沉">
+ <xsl:attribute name="uof:locID">t0070</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 字体引用 字符数 行数 间距</xsl:attribute>
+ <xsl:attribute name="字:类型">dropped</xsl:attribute>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:style-name">
+ <xsl:attribute name="字:字体引用"><xsl:value-of select="translate(style:paragraph-properties/style:drop-cap/@style:style-name,' ','_')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="字:间距"><xsl:choose><xsl:when test="style:paragraph-properties/style:drop-cap/@style:distance"><xsl:value-of select="substring-before(style:paragraph-properties/style:drop-cap/@style:distance,$ooUnit)"/></xsl:when><xsl:otherwise>0.00</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:length">
+ <xsl:attribute name="字:字符数"><xsl:value-of select="style:paragraph-properties/style:drop-cap/@style:length"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/style:drop-cap/@style:lines">
+ <xsl:attribute name="字:行数"><xsl:value-of select="style:paragraph-properties/style:drop-cap/@style:lines"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:取消断字">
+ <xsl:attribute name="uof:locID">t0071</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@fo:hyphenate"><xsl:value-of select="style:paragraph-properties/@fo:hyphenate"/></xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:取消行号">
+ <xsl:attribute name="uof:locID">t0072</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="style:paragraph-properties/@text:number-lines"/>
+ </xsl:variable>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="$aa='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:允许单词断字">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0073</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@style:punctuation-wrap">
+ <xsl:element name="字:行首尾标点控制">
+ <xsl:attribute name="uof:locID">t0074</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:punctuation-wrap='hanging'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:是否行首标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@style:line-break ">
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:line-break='strict'">true</xsl:when><xsl:when test="style:paragraph-properties/@style:line-break='normal'">false</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@style:text-autospace">
+ <xsl:element name="字:自动调整中英文字符间距">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:text-autospace='ideograph-alpha'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0077</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@style:text-autospace">
+ <xsl:element name="字:自动调整中文与数字间距">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:paragraph-properties/@style:text-autospace='ideograph-alpha'">true </xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0078</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:有网格自动调整右缩进">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0195</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="style:paragraph-properties/@fo:border or style:paragraph-properties/@fo:border-top or style:paragraph-properties/@fo:border-bottom or style:paragraph-properties/@fo:border-left or style:paragraph-properties/@fo:border-right or style:paragraph-properties/@style:shadow[.!='none']">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0065</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:background-color">
+ <xsl:element name="字:填充">
+ <xsl:attribute name="uof:locID">t0066</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-top or style:paragraph-properties/@fo:margin-bottom">
+ <字:段间距 uof:locID="t0058">
+ <xsl:if test="style:paragraph-properties/@fo:margin-top">
+ <字:段前距 uof:locID="t0196">
+ <字:绝对值 uof:locID="t0199" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ </字:绝对值>
+ </字:段前距>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/@fo:margin-bottom">
+ <字:段后距 uof:locID="t0197">
+ <字:绝对值 uof:locID="t0202" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(style:paragraph-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ </字:绝对值>
+ </字:段后距>
+ </xsl:if>
+ </字:段间距>
+ </xsl:if>
+ <xsl:if test="style:paragraph-properties/style:tab-stops">
+ <xsl:element name="字:制表位设置">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:for-each select="style:paragraph-properties/style:tab-stops/style:tab-stop">
+ <xsl:element name="字:制表位">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute>
+ <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@style:type"/>
+ </xsl:variable>
+ <xsl:variable name="zbflx">
+ <xsl:choose>
+ <xsl:when test="$aa='right'">right</xsl:when>
+ <xsl:when test="$aa='center'">center</xsl:when>
+ <xsl:when test="$aa='char'and @style:char!=''">decimal</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="字:类型"><xsl:value-of select="$zbflx"/></xsl:attribute>
+ <xsl:attribute name="字:制表位字符"><xsl:value-of select="@style:leader-text"/></xsl:attribute>
+ <xsl:if test="@style:leader-style">
+ <xsl:attribute name="字:前导符"><xsl:value-of select="@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <xsl:param name="bText"/>
+ <xsl:choose>
+ <xsl:when test="$bText='0'">
+ <xsl:variable name="count">
+ <xsl:choose>
+ <xsl:when test="not(@text:c)">1</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@text:c"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <字:句 uof:locID="t0085">
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{$count}"/>
+ </字:句>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:空格符 uof:locID="t0126" uof:attrList="个数" 字:个数="{@text:c}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="textp" match="text:p">
+ <xsl:variable name="parentstyle">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="self::node()[name(.)='text:span']">
+ <xsl:call-template name="textspan"/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:sequence']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()/draw:text-box/text:p/text:sequence">
+ <xsl:for-each select="draw:text-box/text:p/node()">
+ <xsl:choose>
+ <xsl:when test="self::node()[name(.)='text:sequence']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="not(self::node()[substring-before(name(.),':')='draw'])">
+ <xsl:call-template name="字:句">
+ <xsl:with-param name="parentstyle" select="$parentstyle"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:date']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:time']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:s']">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="bText" select="0"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:file-name']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:chapter']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:editing-duration']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:creation-time']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:creation-date']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:character-count']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:page-count']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:page-number']">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="substring-before(name(.),':')='draw' and not(name(.)='draw:a')">
+ <字:句 uof:locID="t0085">
+ <xsl:call-template name="字:锚点"/>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:note']/@text:note-class='footnote'">
+ <字:句 uof:locID="t0085">
+ <xsl:call-template name="jiaozhu"/>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:note']/@text:note-class='endnote'">
+ <字:句 uof:locID="t0085">
+ <xsl:call-template name="weizhu"/>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="name(.)='text:alphabetical-index-mark-start'">
+ <xsl:element name="字:句">
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="uof:locId">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ <xsl:attribute name="字:类型">user-data</xsl:attribute>
+ <xsl:attribute name="字:名称"><xsl:value-of select="@text:string-value-phonetic"/></xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:alphabetical-index-mark-end'">
+ <xsl:element name="字:句">
+ <xsl:element name="字:区域结束" uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:bookmark' ">
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ </xsl:element>
+ <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型" 字:名称="{@text:name}" 字:类型="bookmark" 字:标识符="{generate-id()}"/>
+ <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用" 字:标识符引用="{generate-id()}"/>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="name(.)='text:a'">
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符">hlnk<xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Hyperlink</xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ <xsl:element name="字:区域结束">
+ <xsl:attribute name="字:标识符引用">hlnk<xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="name(.)='office:annotation'">
+ <字:句 uof:locID="t0085">
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Comment</xsl:attribute>
+ <xsl:attribute name="字:类型">annotation</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:区域结束">
+ <xsl:attribute name="字:标识符引用">cmt<xsl:number from="/office:document/office:body/office:text" level="any" count="office:annotation"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ </字:句>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:change-start'] or self::node()[name(.)='text:change'] or self::node()[name(.)='text:change-end']">
+ <xsl:call-template name="xiuding"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="字:句">
+ <xsl:with-param name="parentstyle" select="$parentstyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="xiuding">
+ <xsl:choose>
+ <xsl:when test="self::node()[name(.)='text:change-start']or self::node()[name(.)='text:change']">
+ <xsl:variable name="changeID">
+ <xsl:value-of select="@text:change-id"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:body/office:text/text:tracked-changes/text:changed-region">
+ <xsl:if test="$changeID=@text:id">
+ <xsl:choose>
+ <xsl:when test="text:insertion">
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ <xsl:attribute name="字:类型">insert</xsl:attribute>
+ <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:format-change">
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ <xsl:attribute name="字:类型">format</xsl:attribute>
+ <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:deletion">
+ <xsl:element name="字:修订开始">
+ <xsl:attribute name="uof:locID">t0206</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 类型 修订信息引用</xsl:attribute>
+ <xsl:attribute name="字:标识符"><xsl:value-of select="@text:id"/></xsl:attribute>
+ <xsl:attribute name="字:类型">delete</xsl:attribute>
+ <xsl:attribute name="字:修订信息引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="self::node()[name(.)='text:change-end']">
+ <xsl:variable name="changeendID">
+ <xsl:value-of select="@text:change-id"/>
+ </xsl:variable>
+ <xsl:for-each select="/office:document/office:body/office:text/text:tracked-changes/text:changed-region">
+ <xsl:if test="$changeendID=@text:id">
+ <xsl:choose>
+ <xsl:when test="text:insertion">
+ <xsl:element name="字:修订结束">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:deletion">
+ <xsl:element name="字:修订结束">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="text:format-change">
+ <xsl:element name="字:修订结束">
+ <xsl:attribute name="uof:locID">t0207</xsl:attribute>
+ <xsl:attribute name="uof:attrList">开始标识引用</xsl:attribute>
+ <xsl:attribute name="字:开始标识引用"><xsl:value-of select="@text:id"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:句">
+ <xsl:param name="parentstyle"/>
+ <xsl:if test="not(name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data' or name(.)='text:page-number' or name(.)='text:page-count' or name(.)='text:initial-creator' or name(.)='text:author-name' or name(.)='text:author-initials' or name(.)='text:creation-time' or name(.)='text:creation-date' or name(.)='text:title' or name(.)='text:subject' or name(.)='text:file-name' or name(.)='text:editing-duration' or name(.)='text:character-count' or name(.)='text:chapter')">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用">
+ <xsl:choose>
+ <xsl:when test="@text:style-name">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::text:h/@text:outline-level">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="concat('Heading_20_',parent::text:h/@text:outline-level)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="parent::node()/@text:style-name">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </字:句属性>
+ <xsl:if test="ancestor::text:note-body">
+ <字:引文符号>
+ <xsl:value-of select="ancestor::text:note/text:note-citation"/>
+ </字:引文符号>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::text:bookmark-start) and (following-sibling::text:bookmark-end)">
+ <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="preceding-sibling::text:bookmark-start/@text:name"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="following-sibling::text:bookmark-end/@text:name"/></xsl:attribute>
+ </字:区域结束>
+ </xsl:when>
+ <xsl:when test="name(.)='draw:a'">
+ <xsl:variable name="link-name">
+ <xsl:value-of select="substring-after(@xlink:href,'#')"/>
+ </xsl:variable>
+ <字:区域开始 uof:locID="t0121" uof:attrList="标识符 名称 类型">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="$link-name"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Bookmark</xsl:attribute>
+ <xsl:attribute name="字:类型">bookmark</xsl:attribute>
+ </字:区域开始>
+ <xsl:call-template name="字:锚点"/>
+ <字:区域结束 uof:locID="t0122" uof:attrList="标识符引用">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="$link-name"/></xsl:attribute>
+ </字:区域结束>
+ </xsl:when>
+ <xsl:when test="self::node( )[name(.)='text:tab']">
+ <xsl:element name="字:制表符">
+ <xsl:attribute name="uof:locID">t0123</xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="self::node( )[name(.)='text:line-break']">
+ <xsl:element name="字:换行符">
+ <xsl:attribute name="uof:locID">t0124</xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="name(.)='text:bookmark-start' or name(.)='text:bookmark-end' or name(.)='draw:image' or name(.)='office:binary-data'">
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:句>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="draw:text-box">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template name="text">
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="parent::node( )/@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="textspan">
+ <字:句 uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="./text:note/@text:note-class='footnote'">
+ <xsl:for-each select="text:note">
+ <xsl:call-template name="jiaozhu"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="./text:note/@text:note-class='endnote'">
+ <xsl:for-each select="text:note">
+ <xsl:call-template name="weizhu"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:句属性">
+ <xsl:attribute name="uof:locID">t0086</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:variable name="textstyle">
+ <xsl:value-of select="@text:style-name"/>
+ </xsl:variable>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle and not(@style:parent-style-name='Standard')">
+ <xsl:if test="@style:parent-style-name=/office:document/office:styles/style:style/@style:name">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:parent-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/office:document/office:automatic-styles//style:style[@style:family='text']">
+ <xsl:if test="@style:name=$textstyle">
+ <xsl:call-template name="SentenceXD">
+ <xsl:with-param name="Sentencestyle" select="@style:name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:句>
+ </xsl:template>
+ <xsl:template name="SentenceXD">
+ <xsl:param name="Sentencestyle"/>
+ </xsl:template>
+ <xsl:template name="字:锚点">
+ <xsl:if test="not(name(.)='draw:glue-point')">
+ <xsl:variable name="name">
+ <xsl:value-of select="name(.)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="name='draw:a'">
+ <xsl:for-each select="child::node( )">
+ <xsl:call-template name="字:锚点"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$name = 'draw:g'">
+ <xsl:for-each select="child::*">
+ <xsl:call-template name="字:锚点"/>
+ </xsl:for-each>
+ </xsl:if>
+ <字:锚点 uof:locID="t0110" uof:attrList="标识符 类型">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char'">
+ <xsl:attribute name="字:类型">inline</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">normal</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <字:锚点属性 uof:locID="t0111">
+ <字:宽度 uof:locID="t0112">
+ <xsl:choose>
+ <xsl:when test="@svg:width">
+ <xsl:value-of select="substring-before(@svg:width,$uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="@svg:x1">
+ <xsl:value-of select="substring-before(@svg:x2,$uofUnit) - substring-before(@svg:x1,$uofUnit)"/>
+ </xsl:when>
+ </xsl:choose>
+ </字:宽度>
+ <字:高度 uof:locID="t0113">
+ <xsl:choose>
+ <xsl:when test="@svg:height">
+ <xsl:value-of select="substring-before(@svg:height,$uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="@svg:x1">
+ <xsl:value-of select="substring-before(@svg:y2,$uofUnit) - substring-before(@svg:y1,$uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="child::draw:text-box/@fo:min-height">
+ <xsl:value-of select="substring-before(child::draw:text-box/@fo:min-height,$uofUnit)"/>
+ </xsl:when>
+ </xsl:choose>
+ </字:高度>
+ <xsl:if test="not(@text:anchor-type='as-char')">
+ <字:位置 uof:locID="t0114">
+ <字:水平 uof:locID="t0176" uof:attrList="相对于">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:相对于"><xsl:choose><xsl:when test="@style:horizontal-rel='page'">page</xsl:when><xsl:when test="@style:horizontal-rel='paragraph'">margin</xsl:when><xsl:when test="@style:horizontal-rel='page-content'">margin</xsl:when><xsl:when test="@style:horizontal-rel='paragraph-content'">margin</xsl:when><xsl:when test="@style:horizontal-rel='char'">char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:x or @svg:x1">
+ <字:绝对 uof:locID="t0177" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@svg:x"><xsl:value-of select="substring-before(@svg:x,$uofUnit)"/></xsl:when><xsl:when test="@svg:x1"><xsl:value-of select="substring-before(@svg:x1,$uofUnit)"/></xsl:when></xsl:choose></xsl:attribute>
+ </字:绝对>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:相对 uof:locID="t0178" uof:attrList="参考点 值">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:horizontal-pos='left'">left</xsl:when><xsl:when test="@style:horizontal-pos='right'">right</xsl:when><xsl:when test="@style:horizontal-pos='center'">center</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </字:相对>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:水平>
+ <字:垂直 uof:locID="t0179" uof:attrList="相对于">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:相对于"><xsl:choose><xsl:when test="@style:vertical-rel='page'">page</xsl:when><xsl:when test="@style:vertical-rel='paragraph'">paragraph</xsl:when><xsl:when test="@style:vertical-rel='page-content'">margin</xsl:when><xsl:when test="@style:vertical-rel='paragraph-content'">margin</xsl:when><xsl:when test="@style:vertical-rel='line'">line</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="@svg:y or @svg:y1">
+ <字:绝对 uof:locID="t0180" uof:attrList="值">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@svg:y"><xsl:value-of select="substring-before(@svg:y,$uofUnit)"/></xsl:when><xsl:when test="@svg:y1"><xsl:value-of select="substring-before(@svg:y1,$uofUnit)"/></xsl:when></xsl:choose></xsl:attribute>
+ </字:绝对>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:相对 uof:locID="t0181" uof:attrList="参考点 值">
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:vertical-pos='bottom'">bottom</xsl:when><xsl:when test="@style:vertical-pos='top'">top</xsl:when><xsl:when test="@style:vertical-pos='middle'">center</xsl:when><xsl:when test="@style:vertical-pos='below'">inside</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </字:相对>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:垂直>
+ </字:位置>
+ </xsl:if>
+ <xsl:for-each select="key('graphicset',@draw:style-name)/style:graphic-properties">
+ <字:绕排 uof:locID="t0115" uof:attrList="绕排方式 环绕文字 绕排顶点">
+ <xsl:variable name="wrap_type1">
+ <xsl:value-of select="@style:wrap"/>
+ </xsl:variable>
+ <xsl:variable name="wrap_type2">
+ <xsl:value-of select="@style:run-through"/>
+ </xsl:variable>
+ <xsl:variable name="a">
+ <xsl:value-of select="@style:number-wrapped-paragraphs"/>
+ </xsl:variable>
+ <xsl:if test="$wrap_type1">
+ <xsl:attribute name="字:绕排方式"><xsl:choose><xsl:when test="$wrap_type1='run-through' and $wrap_type2='background' ">behindtext</xsl:when><xsl:when test="$wrap_type1='run-through' and $a='1'">infrontoftext</xsl:when><xsl:when test="$wrap_type1='run-through'">through</xsl:when><xsl:when test="$wrap_type1='dynamic' ">top-bottom</xsl:when><xsl:when test="$wrap_type1='parallel' ">square</xsl:when><xsl:when test="$wrap_type1='left' or $wrap_type1='right'">tight</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$wrap_type1='left' or $wrap_type1='right'">
+ <xsl:attribute name="字:环绕文字"><xsl:choose><xsl:when test="$wrap_type1='left'">left</xsl:when><xsl:when test="$wrap_type1='right'">right</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </字:绕排>
+ <字:边距 uof:locID="t0116" uof:attrList="上 左 右 下">
+ <xsl:choose>
+ <xsl:when test="@fo:margin-top">
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(@fo:margin-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(@fo:margin-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:上">0.0</xsl:attribute>
+ <xsl:attribute name="字:下">0.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@fo:margin-right">
+ <xsl:attribute name="字:右"><xsl:value-of select="substring-before(@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:左"><xsl:value-of select="substring-before(@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:右">0.0</xsl:attribute>
+ <xsl:attribute name="字:左">0.0</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:边距>
+ <字:锁定 uof:attrList="值" uof:locID="t0117">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@draw:move-protect='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </字:锁定>
+ <字:保护 uof:locID="t0118" uof:attrList="值">
+ <xsl:choose>
+ <xsl:when test="$name='draw:image' or $name='draw:text-box'">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:protect = 'content size position' or @style:protect = 'content' or @style:protect = 'content size' or @style:protect = 'size position' or @style:protect = 'size' or @style:protect = 'position' or @style:protect = 'content position' and @draw:size-protect= 'true'and @draw:move-protect= 'true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:protect = 'position size'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:保护>
+ </xsl:for-each>
+ <字:允许重叠 uof:locID="t0119" uof:attrList="值" 字:值="true"/>
+ </字:锚点属性>
+ <字:图形 uof:locID="t0120" uof:attrList="图形引用">
+ <xsl:variable name="refpicname">
+ <xsl:if test="@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="picnumber">
+ <xsl:if test="@draw:style-name">
+ <xsl:value-of select="count(preceding::*[@draw:style-name=$refpicname])"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="字:图形引用"><xsl:value-of select="concat($refpicname,'_',$picnumber)"/></xsl:attribute>
+ </字:图形>
+ </字:锚点>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="liekuan">
+ <xsl:param name="count"/>
+ <xsl:param name="width"/>
+ <xsl:if test="$count &gt; 0">
+ <字:列宽 uof:locID="t0132">
+ <xsl:value-of select="$width"/>
+ </字:列宽>
+ <xsl:call-template name="liekuan">
+ <xsl:with-param name="count" select="$count -1"/>
+ <xsl:with-param name="width" select="$width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="exec_table" match="table:table">
+ <xsl:param name="tabletype"/>
+ <字:文字表 uof:locID="t0128" uof:attrList="类型">
+ <xsl:choose>
+ <xsl:when test="@table:is-sub-table='true'">
+ <xsl:attribute name="字:类型">sub-table</xsl:attribute>
+ <xsl:element name="字:文字表属性">
+ <xsl:attribute name="uof:locID">t0129</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:element name="字:列宽集">
+ <xsl:attribute name="uof:locID">t0131</xsl:attribute>
+ <xsl:for-each select="table:table-column">
+ <xsl:variable name="tableColName" select="@table:style-name"/>
+ <xsl:variable name="colWidth" select="substring-before(//style:style[@style:name=$tableColName and @style:family='table-column']/style:table-column-properties/@style:column-width,$ooUnit)"/>
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="liekuan">
+ <xsl:with-param name="count" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="width" select="$colWidth"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:列宽 uof:locID="t0132">
+ <xsl:value-of select="$colWidth"/>
+ </字:列宽>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:类型">table</xsl:attribute>
+ <xsl:element name="字:文字表属性">
+ <xsl:attribute name="uof:locID">t0129</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@table:style-name"/></xsl:attribute>
+ <xsl:variable name="tableName" select="@table:style-name"/>
+ <xsl:element name="字:列宽集">
+ <xsl:attribute name="uof:locID">t0131</xsl:attribute>
+ <xsl:for-each select="table:table-column">
+ <xsl:variable name="tableColName" select="@table:style-name"/>
+ <xsl:variable name="colWidth" select="substring-before(//style:style[@style:name=$tableColName and @style:family='table-column']/style:table-column-properties/@style:column-width,$ooUnit)"/>
+ <xsl:choose>
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="liekuan">
+ <xsl:with-param name="count" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="width" select="$colWidth"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <字:列宽 uof:locID="t0132">
+ <xsl:value-of select="$colWidth"/>
+ </字:列宽>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:for-each select="key('set_styleStyle',$tableName)">
+ <xsl:element name="字:宽度">
+ <xsl:attribute name="uof:locID">t0130</xsl:attribute>
+ <xsl:attribute name="uof:attrList">绝对宽度 相对宽度</xsl:attribute>
+ <xsl:attribute name="字:绝对宽度"><xsl:value-of select="substring-before(style:table-properties/@style:width,$ooUnit)"/></xsl:attribute>
+ <xsl:if test="style:table-properties/@style:rel-width">
+ <xsl:attribute name="字:相对宽度"><xsl:value-of select="substring-before(style:table-properties/@style:rel-width,'%') div 100"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="字:对齐">
+ <xsl:attribute name="uof:locID">t0133</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:table-properties/@table:align='right'">right</xsl:when>
+ <xsl:when test="style:table-properties/@table:align='center'">center</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:table-properties/@fo:margin-left">
+ <xsl:element name="字:左缩进">
+ <xsl:attribute name="uof:locID">t0134</xsl:attribute>
+ <xsl:value-of select="substring-before(style:table-properties/@fo:margin-left,$ooUnit)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:绕排">
+ <xsl:attribute name="uof:locID">t0135</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">around</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0137</xsl:attribute>
+ <xsl:for-each select="style:table-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:if test="style:table-properties/style:background-image/office:binary-data or style:table-properties/@fo:background-color or style:page-layout-properties/@fo:background-color">
+ <字:填充 uof:locID="t0138">
+ <xsl:for-each select="style:table-properties">
+ <xsl:call-template name="图:填充">
+ <xsl:with-param name="style-name" select="$tableName"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </字:填充>
+ </xsl:if>
+ <xsl:element name="字:绕排边距">
+ <xsl:attribute name="uof:locID">t0139</xsl:attribute>
+ <xsl:attribute name="uof:attrList">上 左 右 下</xsl:attribute>
+ <xsl:if test="style:table-properties/@fo:margin-top">
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-top,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:table-properties/@fo:margin-left">
+ <xsl:attribute name="字:左"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-left,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:table-properties/@fo:margin-right">
+ <xsl:attribute name="字:右"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-right,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:table-properties/@fo:margin-bottom">
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-properties/@fo:margin-bottom,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="字:自动调整大小">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0140</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:默认单元格边距">
+ <xsl:attribute name="uof:locID">t0141</xsl:attribute>
+ <xsl:attribute name="uof:attrList">上 左 右 下</xsl:attribute>
+ <xsl:attribute name="字:上">0.10</xsl:attribute>
+ <xsl:attribute name="字:左">0.10</xsl:attribute>
+ <xsl:attribute name="字:右">0.10</xsl:attribute>
+ <xsl:attribute name="字:下">0.10</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:默认单元格间距">
+ <xsl:attribute name="uof:locID">t0142</xsl:attribute>
+ <xsl:value-of select="'0.00'"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="table:table-header-rows/table:table-row"/>
+ <xsl:apply-templates select="table:table-row"/>
+ </字:文字表>
+ </xsl:template>
+ <xsl:key name="set_colWidth" match="//office:automatic-styles/style:style[@style:family='table-column']" use="@style:name"/>
+ <xsl:key name="set_styleStyle" match="//office:automatic-styles/style:style" use="@style:name"/>
+ <xsl:template match="table:table-row">
+ <xsl:element name="字:行">
+ <xsl:attribute name="uof:locID">t0143</xsl:attribute>
+ <xsl:variable name="rowStyleName" select="@table:style-name|table:table-row/@table:style-name"/>
+ <xsl:element name="字:表行属性">
+ <xsl:attribute name="uof:locID">t0144</xsl:attribute>
+ <xsl:for-each select="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:row-height or @style:min-row-height]">
+ <xsl:element name="字:高度">
+ <xsl:if test="@style:row-height">
+ <xsl:attribute name="字:固定值"><xsl:value-of select="substring-before(@style:row-height,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:min-row-height">
+ <xsl:attribute name="字:最小值"><xsl:value-of select="substring-before(@style:min-row-height,$ooUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0145</xsl:attribute>
+ <xsl:attribute name="uof:attrList">固定值 最小值</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:if test="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:keep-together]">
+ <xsl:element name="字:跨页">
+ <xsl:attribute name="uof:locID">t0146</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:for-each select="key('set_styleStyle',$rowStyleName)/style:table-row-properties[@style:keep-together]">
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="@style:keep-together='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="name(..)='table:table-header-rows'">
+ <xsl:element name="字:表头行">
+ <xsl:attribute name="uof:locID">t0147</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name()='table:table-cell'">
+ <xsl:element name="字:单元格">
+ <xsl:attribute name="uof:locID">t0148</xsl:attribute>
+ <xsl:call-template name="execTableCellAttribute"/>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name()='text:p'">
+ <xsl:call-template name="execParagraph">
+ <xsl:with-param name="currlistlvl" select="number('0')"/>
+ <xsl:with-param name="liststylename" select="string('00000')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name()='table:table' or name()='table:sub-table' or self::node()/@table:is-sub-table='true'">
+ <xsl:call-template name="exec_table">
+ <xsl:with-param name="tabletype" select="name()"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="execTableCellAttribute">
+ <xsl:element name="字:单元格属性">
+ <xsl:attribute name="uof:locID">t0149</xsl:attribute>
+ <xsl:variable name="StyleName" select="@table:style-name"/>
+ <xsl:element name="字:宽度">
+ <xsl:attribute name="uof:locID">t0150</xsl:attribute>
+ <xsl:attribute name="uof:attrList">绝对值 相对值</xsl:attribute>
+ <xsl:variable name="sn">
+ <xsl:number from="/office:document/office:body/office:text" level="single" count="table:table-cell" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="sn1">
+ <xsl:choose>
+ <xsl:when test="../../table:table-column[number($sn)]/@table:style-name">
+ <xsl:value-of select="$sn"/>
+ </xsl:when>
+ <xsl:when test=" name(../..)='table:table-header-rows' and ../../../table:table-column[number($sn)]/@table:style-name">
+ <xsl:value-of select="$sn"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'1'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="KuanDu">
+ <xsl:choose>
+ <xsl:when test=" name(../..)='table:table-header-rows' and ../../../table:table-column[number($sn)]/@table:style-name">
+ <xsl:value-of select="../../../table:table-column[number($sn1)]/@table:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../../table:table-column[number($sn1)]/@table:style-name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="字:绝对值"><xsl:value-of select="substring-before(key('set_colWidth',$KuanDu)/style:table-column-properties/@style:column-width,$ooUnit)"/></xsl:attribute>
+ <xsl:if test="key('set_colWidth',$KuanDu)/style:table-column-properties/@style:rel-column-width">
+ <xsl:attribute name="字:相对值"><xsl:value-of select="substring-before(key('set_colWidth',$KuanDu)/style:table-column-properties/@style:rel-column-width,'*')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="@table:number-columns-spanned">
+ <xsl:element name="字:跨列">
+ <xsl:attribute name="uof:locID">t0156</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="@table:number-columns-spanned"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="key('set_styleStyle',$StyleName)">
+ <xsl:element name="字:单元格边距">
+ <xsl:attribute name="uof:locID">t0151</xsl:attribute>
+ <xsl:attribute name="uof:attrList">上 左 右 下</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="style:table-cell-properties/@fo:padding">
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:左"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:右"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:上"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-top,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:左"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-left,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:右"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-right,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:下"><xsl:value-of select="substring-before(style:table-cell-properties/@fo:padding-bottom,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="style:table-cell-properties/@fo:border or style:table-cell-properties/@fo:border-top or style:table-cell-properties/@fo:border-bottom or style:table-cell-properties/@fo:border-left or style:table-cell-properties/@fo:border-right or style:table-cell-properties/@style:shadow">
+ <xsl:element name="字:边框">
+ <xsl:attribute name="uof:locID">t0152</xsl:attribute>
+ <xsl:for-each select="style:table-cell-properties">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:table-cell-properties/style:background-image/office:binary-data or style:table-cell-properties/@fo:background-color">
+ <字:填充 uof:locID="t0153">
+ <xsl:for-each select="style:table-cell-properties">
+ <xsl:call-template name="图:填充"/>
+ </xsl:for-each>
+ </字:填充>
+ </xsl:if>
+ <字:垂直对齐方式 uof:locID="t0154">
+ <xsl:choose>
+ <xsl:when test="style:table-cell-properties/@style:vertical-align='middle'">center</xsl:when>
+ <xsl:when test="style:table-cell-properties/@style:vertical-align='bottom'">bottom</xsl:when>
+ <xsl:otherwise>top</xsl:otherwise>
+ </xsl:choose>
+ </字:垂直对齐方式>
+ <xsl:element name="字:自动换行">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0157</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:适应文字">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0158</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:key name="bpath" match="//office:document/office:body/office:text/text:p/text:span" use="@text:style-name"/>
+ <xsl:template name="字:句属性">
+ <xsl:element name="字:字体">
+ <xsl:attribute name="uof:locID">t0088</xsl:attribute>
+ <xsl:attribute name="uof:attrList">西文字体引用 中文字体引用 特殊字体引用 西文绘制 字号 相对字号 颜色</xsl:attribute>
+ <xsl:if test="contains(@style:parent-style-name,'Header') or contains(@style:parent-style-name,'Foot') or contains(@style:parent-style-name,'Endnote')">
+ <xsl:attribute name="字:字号">9</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-size or style:text-properties/@style:font-size-asian or style:text-properties/@style:font-size-complex">
+ <xsl:choose>
+ <xsl:when test="contains(style:text-properties/@fo:font-size,'%') or contains(style:text-properties/@style:font-size-asian,'%')">
+ <xsl:attribute name="字:相对字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'%')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'%')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:字号"><xsl:choose><xsl:when test="style:text-properties/@fo:font-size"><xsl:value-of select="substring-before(style:text-properties/@fo:font-size,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-asian"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-asian,'pt')"/></xsl:when><xsl:when test="style:text-properties/@style:font-size-complex"><xsl:value-of select="substring-before(style:text-properties/@style:font-size-complex,'pt')"/></xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name">
+ <xsl:variable name="xiwen" select="style:text-properties/@style:font-name"/>
+ <xsl:attribute name="字:西文字体引用"><xsl:value-of select="translate($xiwen,' ','_')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-name-asian">
+ <xsl:attribute name="字:中文字体引用"><xsl:value-of select="style:text-properties/@style:font-name-asian"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="style:text-properties/@fo:background-color and not(style:text-properties/@style:text-background-color='transparent')">
+ <xsl:element name="字:填充">
+ <xsl:attribute name="uof:locID">t0093</xsl:attribute>
+ <xsl:element name="图:图案">
+ <xsl:attribute name="uof:locID">g0036</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 图形引用 前景色 背景色</xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:background-color">
+ <xsl:attribute name="图:前景色"><xsl:choose><xsl:when test="style:text-properties/@fo:background-color='transparent'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@fo:background-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-weight or style:text-properties/@style:font-weight-asian">
+ <xsl:element name="字:粗体">
+ <xsl:attribute name="uof:locID">t0089</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@style:font-weight-asian='bold' or style:text-properties/@fo:font-weight='bold'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:font-style or style:text-properties/@style:font-style-asian">
+ <xsl:element name="字:斜体">
+ <xsl:attribute name="uof:locID">t0090</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:font-style='italic' or style:text-properties/@style:font-style-asian='italic'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:background-color|style:text-properties/@style:text-background-color">
+ <xsl:element name="字:突出显示">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@fo:background-color='transparent' or style:text-properties/@style:text-background-color='transparent'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@fo:background-color|style:text-properties/@style:text-background-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0091</xsl:attribute>
+ <xsl:attribute name="uof:attrList">颜色</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-line-through-style">
+ <xsl:element name="字:删除线">
+ <xsl:attribute name="uof:locID">t0094</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:删除线类型"><xsl:with-param name="lineType" select="style:text-properties/@style:text-line-through-style"/></xsl:call-template></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-underline-style">
+ <xsl:element name="字:下划线">
+ <xsl:attribute name="uof:locID">t0095</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字下划线</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:线型类型"/></xsl:attribute>
+ <xsl:if test="style:text-properties/@style:text-underline-color">
+ <xsl:attribute name="字:颜色"><xsl:choose><xsl:when test="style:text-properties/@style:text-underline-color='font-color'">auto</xsl:when><xsl:otherwise><xsl:value-of select="style:text-properties/@style:text-underline-color"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-shadow">
+ <xsl:element name="字:阴影">
+ <xsl:attribute name="uof:locID">t0100</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:choose><xsl:when test="style:text-properties/@fo:text-shadow='none'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-emphasize">
+ <xsl:element name="字:着重号">
+ <xsl:attribute name="uof:locID">t0096</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 颜色 字着重号</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:call-template name="uof:着重号类型"><xsl:with-param name="te" select="style:text-properties/@style:text-emphasize"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="style:text-properties/@fo:color">
+ <xsl:attribute name="字:颜色"><xsl:value-of select="style:text-properties/@fo:color"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@text:display">
+ <xsl:element name="字:隐藏文字">
+ <xsl:attribute name="uof:locID">t0097</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-outline">
+ <xsl:element name="字:空心">
+ <xsl:attribute name="uof:locID">t0098</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值"><xsl:value-of select="style:text-properties/@style:text-outline"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:font-relief">
+ <xsl:element name="字:浮雕">
+ <xsl:attribute name="uof:locID">t0099</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@style:font-relief='embossed'">emboss</xsl:when><xsl:when test="style:text-properties/@style:font-relief='engraved'">engrave</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:text-transform or style:text-properties/@fo:font-variant">
+ <xsl:element name="字:醒目字体">
+ <xsl:attribute name="uof:locID">t0101</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型</xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:choose><xsl:when test="style:text-properties/@fo:text-transform='uppercase'">uppercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='lowercase'">lowercase</xsl:when><xsl:when test="style:text-properties/@fo:text-transform='capitalize'">capital</xsl:when><xsl:when test="style:text-properties/@fo:font-variant='small-caps'">small-caps</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-position">
+ <xsl:element name="字:位置">
+ <xsl:attribute name="uof:locID">t0102</xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="style:text-properties/@style:text-position"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($aa,'sub')">
+ <xsl:value-of select="substring-before($aa,' ')"/>
+ </xsl:when>
+ <xsl:when test="contains($aa,'super')">
+ <xsl:value-of select="substring-before($aa,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($aa,'%','')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:text-scale">
+ <xsl:element name="字:缩放">
+ <xsl:attribute name="uof:locID">t0103</xsl:attribute>
+ <xsl:variable name="scale" select="style:text-properties/@style:text-scale"/>
+ <xsl:choose>
+ <xsl:when test="contains($scale,'%')">
+ <xsl:value-of select="substring-before($scale,'%')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="style:text-properties/@style:text-scale"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@fo:letter-spacing">
+ <xsl:element name="字:字符间距">
+ <xsl:attribute name="uof:locID">t0104</xsl:attribute>
+ <xsl:value-of select="substring-before(style:text-properties/@fo:letter-spacing,$uofUnit)"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="style:text-properties/@style:letter-kerning">
+ <xsl:element name="字:调整字间距">
+ <xsl:variable name="tt" select="style:text-properties/@style:letter-kerning"/>
+ <xsl:attribute name="uof:locID">t0105</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$tt='true'">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="字:字符对齐网格">
+ <xsl:attribute name="字:值">false</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0106</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:线型类型">
+ <xsl:variable name="spath" select="style:text-properties/@style:text-underline-style"/>
+ <xsl:variable name="wpath" select="style:text-properties/@style:text-underline-width"/>
+ <xsl:variable name="tpath" select="style:text-properties/@style:text-underline-type"/>
+ <xsl:choose>
+ <xsl:when test="$spath='solid' and not($tpath='double' ) and $wpath='auto' ">single</xsl:when>
+ <xsl:when test="$spath='solid' and $tpath='double' and $wpath='auto' ">double</xsl:when>
+ <xsl:when test="$spath='solid' and not($tpath='double' )and $wpath='bold' ">thick</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='auto' ">dotted</xsl:when>
+ <xsl:when test="$spath='dotted' and not($tpath='double' )and $wpath='bold' ">dotted-heavy</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='auto' ">dash</xsl:when>
+ <xsl:when test="$spath='dash' and not($tpath='double' )and $wpath='bold' ">dashed-heavy</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='auto' ">dash-long</xsl:when>
+ <xsl:when test="$spath='long-dash' and not($tpath='double' )and $wpath='bold' ">dash-long-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-heavy</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='auto' ">dot-dot-dash</xsl:when>
+ <xsl:when test="$spath='dot-dot-dash' and not($tpath='double' )and $wpath='bold' ">dash-dot-dot-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='auto' ">wave</xsl:when>
+ <xsl:when test="$spath='wave' and not($tpath='double' )and $wpath='bold' ">wavy-heavy</xsl:when>
+ <xsl:when test="$spath='wave' and $tpath='double' and $wpath='auto' ">wavy-double</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:删除线类型">
+ <xsl:param name="lineType"/>
+ <xsl:variable name="tw" select="style:text-properties/@style:text-line-through-width"/>
+ <xsl:variable name="tt" select="style:text-properties/@style:text-line-through-text"/>
+ <xsl:variable name="ttp" select="style:text-properties/@style:text-line-through-type"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='solid'and $ttp='double'">double</xsl:when>
+ <xsl:when test="$lineType='solid'and $tw='bold'">bold</xsl:when>
+ <xsl:when test="$lineType='solid'and $tt='X'">xl</xsl:when>
+ <xsl:when test="$lineType='solid'and $tt='/'">/l</xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="not($lineType='none') ">single</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:着重号类型">
+ <xsl:param name="te"/>
+ <xsl:choose>
+ <xsl:when test="$te='disc above' ">disc above</xsl:when>
+ <xsl:when test="$te='circle above' ">circle above</xsl:when>
+ <xsl:when test="$te='dot above' ">dot above</xsl:when>
+ <xsl:when test="$te='accent above' ">accent above</xsl:when>
+ <xsl:when test="$te='dot below' ">dot</xsl:when>
+ <xsl:when test="$te='circle below' ">circle below</xsl:when>
+ <xsl:when test="$te='disc below' ">disc below</xsl:when>
+ <xsl:when test="$te='accent below' ">accent below</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:边框">
+ <xsl:choose>
+ <xsl:when test="@fo:border">
+ <xsl:call-template name="uof:左边框">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ <xsl:call-template name="uof:上边框">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ <xsl:call-template name="uof:右边框">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ <xsl:call-template name="uof:下边框">
+ <xsl:with-param name="border" select="@fo:border"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@fo:border-left or contains(substring-before(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:call-template name="uof:左边框">
+ <xsl:with-param name="border" select="@fo:border-left"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@fo:border-top or contains(substring-after(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:call-template name="uof:上边框">
+ <xsl:with-param name="border" select="@fo:border-top"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@fo:border-right or substring-before(substring-before(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-before(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:call-template name="uof:右边框">
+ <xsl:with-param name="border" select="@fo:border-right"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@fo:border-bottom or substring-before(substring-after(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-after(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:call-template name="uof:下边框">
+ <xsl:with-param name="border" select="@fo:border-bottom"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:左边框">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:左">
+ <xsl:attribute name="uof:locID">u0057</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-left">
+ <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-left"><xsl:value-of select="substring-before(@fo:padding-left,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:上边框">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:上">
+ <xsl:attribute name="uof:locID">u0058</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-top">
+ <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-top"><xsl:value-of select="substring-before(@fo:padding-top,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring-after(substring-after(@style:shadow,' '),' '),'-')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:右边框">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:右">
+ <xsl:attribute name="uof:locID">u0059</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-right">
+ <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-right"><xsl:value-of select="substring-before(@fo:padding-right,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-before(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-before(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="uof:下边框">
+ <xsl:param name="border"/>
+ <xsl:element name="uof:下">
+ <xsl:attribute name="uof:locID">u0060</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 宽度 边距 颜色 阴影</xsl:attribute>
+ <xsl:attribute name="uof:类型"><xsl:choose><xsl:when test="$border!='none'"><xsl:choose><xsl:when test="substring-before(substring-after($border,' '),' ')='solid'">single</xsl:when><xsl:when test="substring-before(substring-after($border,' '),' ')='double'">double</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$border!='none'">
+ <xsl:attribute name="uof:宽度"><xsl:value-of select="substring-before(substring-before($border,' '),substring($ooUnit,1,2))"/></xsl:attribute>
+ <xsl:attribute name="uof:颜色"><xsl:value-of select="substring-after(substring-after($border,' '),' ')"/></xsl:attribute>
+ <xsl:if test="@fo:padding or @fo:padding-bottom">
+ <xsl:attribute name="uof:边距"><xsl:choose><xsl:when test="@fo:padding-bottom"><xsl:value-of select="substring-before(@fo:padding-bottom,$ooUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-before(@fo:padding,$ooUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="substring-before(substring-after(substring-after(@style:shadow,' '),' '),$ooUnit) &gt;0 or contains(substring-after(substring-after(@style:shadow,' '),' '),'+')">
+ <xsl:attribute name="uof:阴影">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:key name="geshi" match="//office:document/office:automatic-styles/number:date-style | //office:document/office:automatic-styles/number:time-style" use="@style:name"/>
+ <xsl:template name="inline-text">
+ <xsl:param name="pStyleName"/>
+ <xsl:param name="bText"/>
+ <xsl:apply-templates select="text()|textspan|jiaozhu|weizhu|office:annotation|text:sequence|text:date|text:time|text:page-number|text:page-count|text:subject|text:title|text:initial-creator|text:author-name|text:author-initials|text:file-name|text:change-start|text:change-end|text:change">
+ <xsl:with-param name="pStyleName" select="$pStyleName"/>
+ <xsl:with-param name="bText" select="$bText"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="text:sequence">
+ <xsl:param name="tStyle"/>
+ <xsl:if test="@text:name='Illustration' or @text:name='Text' or @text:name='Drawing' or @text:name='Table'">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'seq'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <xsl:if test="$tStyle!=''">
+ <字:句属性 字:式样引用="{$tStyle}" uof:locID="t0086" uof:attrList="式样引用"/>
+ </xsl:if>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('SEQ ',@text:name,' \* ',$fmt,' \f ',@text:formula)"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:time">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'time'"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="timefmt">
+ <xsl:variable name="aa" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('TIME \@ ',$quote,$timefmt,$quote)"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:date">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'date'"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="datefmt">
+ <xsl:variable name="bb" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$bb)/number:year | key('geshi',$bb)/number:month | key('geshi',$bb)/number:day | key('geshi',$bb)/number:hours | key('geshi',$bb)/number:minutes | key('geshi',$bb)/number:seconds | key('geshi',$bb)/number:quarter | key('geshi',$bb)/number:day-of-week | key('geshi',$bb)/number:week-of-year | key('geshi',$bb)/number:text | key('geshi',$bb)/number:am-pm">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:year']">yyyy</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:month']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day']">dd</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">hh</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">mm</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">ss</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:quarter']">第QQ季度</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day-of-week']">星期N</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:week-of-year']">WW</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:year']">yy</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:month']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day']">d</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">h</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">m</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">s</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:quarter']">Q季</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:day-of-week']">星期N</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:week-of-year']">WW</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('CREATEDATE \@ ',$quote,$datefmt,$quote)"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="oo数字格式域开关">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='1'">Arabic</xsl:when>
+ <xsl:when test="$oo_format='I'">ROMAN</xsl:when>
+ <xsl:when test="$oo_format='i'">roman</xsl:when>
+ <xsl:when test="$oo_format='A'">ALPHABETIC</xsl:when>
+ <xsl:when test="$oo_format='a'">alphabetic</xsl:when>
+ <xsl:when test="$oo_format='1, 2, 3, ...'">GB1</xsl:when>
+ <xsl:when test="$oo_format='①, ②, ③, ...'">GB3</xsl:when>
+ <xsl:when test="$oo_format='一, 二, 三, ...'">CHINESENUM3</xsl:when>
+ <xsl:when test="$oo_format='壹, 贰, 叁, ...'">CHINESENUM2</xsl:when>
+ <xsl:when test="$oo_format='甲, 乙, 丙, ...'">ZODIAC1</xsl:when>
+ <xsl:when test="$oo_format='子, 丑, 寅, ...'">ZODIAC2</xsl:when>
+ <xsl:otherwise>Arabic</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:page-number">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'page'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:num-format">
+ <xsl:value-of select="concat('PAGE \* ',$fmt)"/>
+ </xsl:when>
+ <xsl:otherwise>PAGE</xsl:otherwise>
+ </xsl:choose>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:page-count">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'numpages'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@style:num-format">
+ <xsl:value-of select="concat('NumPages \* ',$fmt,' \* Upper')"/>
+ </xsl:when>
+ <xsl:otherwise>NumPages</xsl:otherwise>
+ </xsl:choose>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:initial-creator">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'author'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <!--xsl:value-of select="concat('AUTHOR \* ','Caps',' \* MERGEFORMAT')"/-->
+ <xsl:value-of select="'AUTHOR'"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="string(.)"/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:author-name">
+ <xsl:param name="tStyle"/>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'username'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <xsl:if test="$tStyle!=''">
+ <字:句属性 字:式样引用="{$tStyle}" uof:locID="t0086" uof:attrList="式样引用"/>
+ </xsl:if>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">AUTHOR</字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:author-initials">
+ <xsl:param name="tStyle"/>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'userinitials'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <xsl:if test="$tStyle!=''">
+ <字:句属性 字:式样引用="{$tStyle}" uof:locID="t0086" uof:attrList="式样引用"/>
+ </xsl:if>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">AUTHOR</字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:title">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'title'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="titlename" select="/office:document/office:meta/dc:title"/>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="concat('TITLE',' \* Upper')"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:subject">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'subject'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="concat('SUBJECT \* ','Caps',' \* MERGEFORMAT')"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:file-name">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'filename'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <!--xsl:value-of select="concat('FILENAME \* ','Caps',' \* MERGEFORMAT')"/-->
+ <xsl:value-of select="concat('FILENAME',' \p')"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="text:editing-duration">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'edittime'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="timefmt">
+ <xsl:variable name="aa" select="@style:data-style-name"/>
+ <xsl:for-each select="key('geshi',$aa)/number:hours | key('geshi',$aa)/number:minutes | key('geshi',$aa)/number:am-pm | key('geshi',$aa)/number:seconds | key('geshi',$aa)/number:text">
+ <xsl:choose>
+ <xsl:when test="@number:style='long' ">
+ <xsl:if test="self::node( )[name(.)='number:hours']">HH</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">MM</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">SS</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="self::node( )[name(.)='number:text']">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:hours']">H</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:minutes']">M</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:seconds']">S</xsl:if>
+ <xsl:if test="self::node( )[name(.)='number:am-pm']">am/pm</xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="quote">"</xsl:variable>
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="concat('EDITTIME \@ ',$quote,$timefmt,$quote,' \* MERGEFORMAT ')"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:key name="path" match="//office:document/office:automatic-styles/style:style" use="@style:name"/>
+ <xsl:template name="text:table-of-content">
+ <xsl:element name="字:段落">
+ <xsl:attribute name="uof:locID">t0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="text:index-body/text:p/@text:style-name"/></xsl:attribute>
+ <xsl:element name="字:制表位设置">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="字:制表位">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute>
+ <xsl:variable name="aa" select="text:index-body/text:p/@text:style-name"/>
+ <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="字:是否行首标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'REF'"/></xsl:attribute>
+ <xsl:if test="@text:protected">
+ <xsl:attribute name="字:锁定"><xsl:value-of select="@text:protected"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="'TOC \o 1-10 \h \z'"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ <xsl:for-each select="text:index-body/text:index-title/text:p">
+ <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:句">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </字:句属性>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="self::node()"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="text:index-body/text:p">
+ <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:element name="字:制表位设置">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="字:制表位">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">位置 类型 前导符</xsl:attribute>
+ <xsl:variable name="aa" select="@text:style-name"/>
+ <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="字:是否行首标点压缩">
+ <xsl:attribute name="uof:locID">t0075</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:中文习惯首尾字符">
+ <xsl:attribute name="字:值">true</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0076</xsl:attribute>
+ <xsl:attribute name="uof:attrList">值</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ <xsl:if test="self::node()/text:a">
+ <字:句 uof:locID="t0085">
+ <xsl:variable name="num">
+ <xsl:number from="/office:document/office:body/office:text" level="any" count="text:a"/>
+ </xsl:variable>
+ <xsl:element name="字:区域开始">
+ <xsl:attribute name="字:标识符"><xsl:value-of select="concat('hlnk',$num + 1)"/></xsl:attribute>
+ <xsl:attribute name="字:名称">Hyperlink</xsl:attribute>
+ <xsl:attribute name="字:类型">hyperlink</xsl:attribute>
+ <xsl:attribute name="uof:locID">t0121</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符 名称 类型</xsl:attribute>
+ </xsl:element>
+ <xsl:for-each select="text:a/node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='text:tab-stop' or name(.)='text:tab'">
+ <xsl:element name="字:制表符" uof:locID="t0123"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:element name="字:区域结束">
+ <xsl:attribute name="字:标识符引用"><xsl:value-of select="concat('hlnk',$num + 1)"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0122</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符引用</xsl:attribute>
+ </xsl:element>
+ <xsl:variable name="stt">
+ <xsl:value-of select="./text:a"/>
+ </xsl:variable>
+ <xsl:variable name="end">
+ <xsl:value-of select="."/>
+ </xsl:variable>
+ <xsl:variable name="bijiao">
+ <xsl:value-of select="substring-after($end,$stt)"/>
+ </xsl:variable>
+ <xsl:if test="not($bijiao='')">
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:variable name="stt">
+ <xsl:value-of select="./text:a"/>
+ </xsl:variable>
+ <xsl:variable name="end">
+ <xsl:value-of select="."/>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($end,$stt)"/>
+ </xsl:element>
+ </xsl:if>
+ </字:句>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="text:alphabetical-index">
+ <xsl:element name="字:段落">
+ <xsl:attribute name="uof:locID">t0051</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="text:index-body/text:p/@text:style-name"/></xsl:attribute>
+ <xsl:element name="字:制表位设置">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="字:制表位">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute>
+ <xsl:variable name="aa" select="text:index-body/text:p/@text:style-name"/>
+ <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'INDEX'"/></xsl:attribute>
+ <xsl:if test="@text:protected">
+ <xsl:attribute name="字:锁定"><xsl:value-of select="@text:protected"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:文本串>
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="'TOC \o 1-10 \h \z'"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ <xsl:for-each select="text:index-body/text:index-title/text:p">
+ <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="字:句">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用">
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ </字:句属性>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="self::node()"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="text:index-body/text:p">
+ <xsl:element name="字:段落" uof:locID="t0051" uof:attrList="标识符">
+ <xsl:element name="字:段落属性">
+ <xsl:attribute name="uof:locID">t0052</xsl:attribute>
+ <xsl:attribute name="uof:attrList">式样引用</xsl:attribute>
+ <xsl:attribute name="字:式样引用"><xsl:value-of select="@text:style-name"/></xsl:attribute>
+ <xsl:element name="字:制表位设置">
+ <xsl:attribute name="uof:locID">t0067</xsl:attribute>
+ <xsl:element name="字:制表位">
+ <xsl:attribute name="uof:locID">t0068</xsl:attribute>
+ <xsl:attribute name="uof:attrList">位置 类型 前导符 制表位字符</xsl:attribute>
+ <xsl:variable name="aa" select="@text:style-name"/>
+ <xsl:attribute name="字:位置"><xsl:value-of select="substring-before(key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:position,$ooUnit)"/></xsl:attribute>
+ <xsl:attribute name="字:类型"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:type"/></xsl:attribute>
+ <xsl:attribute name="字:制表位字符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-text"/></xsl:attribute>
+ <xsl:if test="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style">
+ <xsl:attribute name="字:前导符"><xsl:value-of select="key('path',$aa)/style:paragraph-properties/style:tab-stops/style:tab-stop/@style:leader-style"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ <xsl:for-each select="node()">
+ <字:句 uof:locID="t0085">
+ <xsl:choose>
+ <xsl:when test="name(.)='text:tab-stop' or name(.)='text:tab'">
+ <xsl:element name="字:制表符" uof:locID="t0123"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="字:文本串">
+ <xsl:attribute name="uof:locID">t0109</xsl:attribute>
+ <xsl:attribute name="uof:attrList">标识符</xsl:attribute>
+ <xsl:value-of select="."/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </字:句>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="oo数字格式">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='1'">decimal</xsl:when>
+ <xsl:when test="$oo_format='I'">upper-roman</xsl:when>
+ <xsl:when test="$oo_format='i'">lower-roman</xsl:when>
+ <xsl:when test="$oo_format='A'">upper-letter</xsl:when>
+ <xsl:when test="$oo_format='a'">lower-letter</xsl:when>
+ <xsl:when test="$oo_format='1, 2, 3, ...'">decimal-full-width</xsl:when>
+ <xsl:when test="$oo_format='①, ②, ③, ...'">decimal-enclosed-circle</xsl:when>
+ <xsl:when test="$oo_format='一, 二, 三, ...'">chinese-counting</xsl:when>
+ <xsl:when test="$oo_format='壹, 贰, 叁, ...'">chinese-legal-simplified</xsl:when>
+ <xsl:when test="$oo_format='甲, 乙, 丙, ...'">ideograph-traditional</xsl:when>
+ <xsl:when test="$oo_format='子, 丑, 寅, ...'">ideograph-zodiac</xsl:when>
+ <xsl:otherwise>decimal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="图:填充">
+ <xsl:param name="style-name"/>
+ <xsl:choose>
+ <xsl:when test="style:background-image/office:binary-data">
+ <图:图片 uof:locID="g0035" uof:attrList="位置 图形引用 类型 名称">
+ <xsl:attribute name="图:位置"><xsl:choose><xsl:when test="not(style:background-image/@style:repeat)">tile</xsl:when><xsl:otherwise><xsl:choose><xsl:when test="style:background-image/@style:repeat = 'stretch'">stretch</xsl:when><xsl:when test="style:background-image/@style:repeat = 'repeat'">tile</xsl:when><xsl:when test="style:background-image/@style:repeat = 'no-repeat'">center</xsl:when></xsl:choose></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="图:图形引用"><xsl:value-of select="concat('background-image_',count(preceding::style:background-image))"/></xsl:attribute>
+ <xsl:attribute name="图:类型">png</xsl:attribute>
+ <xsl:attribute name="图:名称">background-image</xsl:attribute>
+ </图:图片>
+ </xsl:when>
+ <xsl:when test="@fo:background-color">
+ <图:颜色 uof:locID="g0034">
+ <xsl:choose>
+ <xsl:when test="@fo:background-color='transparent' ">auto</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@fo:background-color"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </图:颜色>
+ </xsl:when>
+ <xsl:when test="@draw:fill='gradient'">
+ </xsl:when>
+ <xsl:when test="@draw:fill='hatch'">
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="字:缩进类型">
+ <xsl:if test="@text:space-before or @fo:margin-left">
+ <字:左 uof:locID="t0182">
+ <字:绝对 uof:locID="t0185" uof:attrList="值">
+ <xsl:if test="@text:space-before">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:space-before,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:margin-left">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:margin-left,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </字:绝对>
+ </字:左>
+ </xsl:if>
+ <xsl:if test="@text:min-label-width or @fo:margin-right">
+ <字:右 uof:locID="t0183">
+ <字:绝对 uof:locID="t0187" uof:attrList="值">
+ <xsl:if test="@text:min-label-width">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:min-label-width,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:margin-right">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:margin-right,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </字:绝对>
+ </字:右>
+ </xsl:if>
+ <xsl:if test="@text:min-label-distance or @fo:text-indent">
+ <字:首行 uof:locID="t0184">
+ <字:绝对 uof:locID="t0189" uof:attrList="值">
+ <xsl:if test="@text:min-label-distance">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@text:min-label-distance,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:text-indent">
+ <xsl:attribute name="字:值"><xsl:value-of select="substring-before(@fo:text-indent,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </字:绝对>
+ </字:首行>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="graphsize">
+ <xsl:param name="width"/>
+ <xsl:param name="Unitofsize"/>
+ <xsl:if test="$Unitofsize='pt'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;1.42) and 0&lt;$width)">1</xsl:when>
+ <xsl:when test="(not($width&gt;2.84) and 1.42&lt;$width)">2</xsl:when>
+ <xsl:when test="(not($width&gt;4.26) and 2.84&lt;$width)">3</xsl:when>
+ <xsl:when test="(not($width&gt;5.68) and 4.26&lt;$width)">4</xsl:when>
+ <xsl:when test="(not($width&gt;7.10) and 5.68&lt;$width)">5</xsl:when>
+ <xsl:when test="(not($width&gt;8.52) and 7.10&lt;$width)">6</xsl:when>
+ <xsl:when test="(not($width&gt;9.94) and 8.52&lt;$width)">7</xsl:when>
+ <xsl:when test="(not($width&gt;11.36) and 9.94&lt;$width)">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$uofUnit='in'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.02) and 0&lt;$width)">1</xsl:when>
+ <xsl:when test="(not($width&gt;0.04) and 0.02&lt;$width)">2</xsl:when>
+ <xsl:when test="(not($width&gt;0.06) and 0.04&lt;$width)">3</xsl:when>
+ <xsl:when test="(not($width&gt;0.08) and 0.06&lt;$width)">4</xsl:when>
+ <xsl:when test="(not($width&gt;0.10) and 0.08&lt;$width)">5</xsl:when>
+ <xsl:when test="(not($width&gt;0.12) and 0.10&lt;$width)">6</xsl:when>
+ <xsl:when test="(not($width&gt;0.14) and 0.12&lt;$width)">7</xsl:when>
+ <xsl:when test="(not($width&gt;0.16) and 0.14&lt;$width)">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$uofUnit='mm'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.5) and 0&lt;$width) or $width=0.5">1</xsl:when>
+ <xsl:when test="(not($width&gt;1.0) and 0.5&lt;$width) or $width=1.0">2</xsl:when>
+ <xsl:when test="(not($width&gt;1.5) and 0.10&lt;$width) or $width=1.5">3</xsl:when>
+ <xsl:when test="(not($width&gt;2.0) and 1.5&lt;$width) or $width=2.0">4</xsl:when>
+ <xsl:when test="(not($width&gt;2.5) and 2.0&lt;$width) or $width=2.5">5</xsl:when>
+ <xsl:when test="(not($width&gt;3.0) and 2.5&lt;$width) or $width=3.0">6</xsl:when>
+ <xsl:when test="(not($width&gt;3.5) and 3.0&lt;$width) or $width=3.5">7</xsl:when>
+ <xsl:when test="(not($width&gt;4.0) and 3.5&lt;$width) or $width=4.0">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$uofUnit='cm'">
+ <xsl:choose>
+ <xsl:when test="(not($width&gt;0.05) and 0&lt;$width) or $width=0.05">1</xsl:when>
+ <xsl:when test="(not($width&gt;0.10) and 0.05&lt;$width) or $width=0.10">2</xsl:when>
+ <xsl:when test="(not($width&gt;0.15) and 0.10&lt;$width) or $width=0.15">3</xsl:when>
+ <xsl:when test="(not($width&gt;0.20) and 0.15&lt;$width) or $width=0.20">4</xsl:when>
+ <xsl:when test="(not($width&gt;0.25) and 0.20&lt;$width) or $width=0.25">5</xsl:when>
+ <xsl:when test="(not($width&gt;0.30) and 0.25&lt;$width) or $width=0.30">6</xsl:when>
+ <xsl:when test="(not($width&gt;0.35) and 0.30&lt;$width) or $width=0.35">7</xsl:when>
+ <xsl:when test="(not($width&gt;0.40) and 0.35&lt;$width) or $width=0.40">8</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:character-count">
+ <xsl:element name="字:域开始">
+ <xsl:attribute name="字:类型"><xsl:value-of select="'numchars'"/></xsl:attribute>
+ <xsl:attribute name="uof:locID">t0079</xsl:attribute>
+ <xsl:attribute name="uof:attrList">类型 锁定</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="text:fixed='1'or text:fixed='true'">
+ <xsl:attribute name="字:锁定">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="字:锁定">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="字:域代码">
+ <xsl:attribute name="uof:locID">t0080</xsl:attribute>
+ <字:段落 uof:locID="t0051" uof:attrList="标识符">
+ <字:句 uof:locID="t0085">
+ <字:句属性 uof:locID="t0086" uof:attrList="式样引用"/>
+ <xsl:variable name="quote" select="'&quot;'"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="concat('NUMCHARS \* ',$fmt,' \# ',$quote,0,$quote)"/>
+ </字:文本串>
+ </字:句>
+ </字:段落>
+ </xsl:element>
+ <字:句 uof:locID="t0085">
+ <字:文本串 uof:locID="t0109" uof:attrList="标识符">
+ <xsl:value-of select="."/>
+ </字:文本串>
+ </字:句>
+ <xsl:element name="字:域结束">
+ <xsl:attribute name="uof:locID">t0081</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <!-- measure_conversion.xsl Begin-->
+ <!--xsl:param name="dpi" select="111"/>
+ <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-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/-->
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 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="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, $uofUnit)">
+ <xsl:value-of select="substring-before($value, $uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template-->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wiki/mediawiki.ott b/filter/source/xslt/export/wiki/mediawiki.ott
new file mode 100644
index 000000000000..eb94e9607bc0
--- /dev/null
+++ b/filter/source/xslt/export/wiki/mediawiki.ott
Binary files differ
diff --git a/filter/source/xslt/export/wiki/odt2mediawiki.xsl b/filter/source/xslt/export/wiki/odt2mediawiki.xsl
new file mode 100755
index 000000000000..8d21a1cda1fd
--- /dev/null
+++ b/filter/source/xslt/export/wiki/odt2mediawiki.xsl
@@ -0,0 +1,1567 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ odt2wiki: OpenDocument to WikiMedia transformation
+ Copyright (C) 2007 Bernhard Haumacher (haui at haumacher dot de)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+-->
+<stylesheet version="1.0"
+ xmlns="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="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ 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"
+>
+
+ <!--
+ == Customization options ==
+ -->
+
+ <!-- Constant defining the newline token. -->
+ <param name="NL" select="'&#10;'"/>
+
+ <!-- String that a tabulator is expanded with in preformatted paragraphs. -->
+
+ <variable name="codetabdocument-value"
+ select="/office:document/office:meta/meta:user-defined[@meta:name='CODE_TAB_REPLACEMENT']"/>
+
+ <param name="CODE_TAB_REPLACEMENT">
+
+ <choose>
+
+ <when test="boolean($codetabdocument-value)">
+ <value-of select="$codetabdocument-value"/>
+ </when>
+
+ <otherwise>
+ <value-of select="' '"/>
+ </otherwise>
+ </choose>
+ </param>
+
+ <!--
+ Switch that suppresses separation of paragraphs with empty lines.
+ (Set to 1 to activate) -->
+ <param name="CODE_JOIN_PARAGRAPHS"
+ select="boolean(string(/office:document/office:meta/meta:user-defined[@meta:name='CODE_JOIN_PARAGRAPHS']) != 'false')"/>
+
+ <variable name="document-value"
+ select="/office:document/office:meta/meta:user-defined[@meta:name='CODE_STYLES']"/>
+
+ <param name="CODE_STYLES">
+
+ <choose>
+ <when test="boolean($document-value)">
+ <value-of select="$document-value"/>
+ </when>
+
+ <otherwise>
+ <value-of select="''"/>
+ </otherwise>
+ </choose>
+ </param>
+
+ <variable name="table-class"
+ select="/office:document/office:meta/meta:user-defined[@meta:name='TABLE_CLASS']"/>
+
+ <param name="TABLE_CLASS">
+ <choose>
+ <when test="boolean($table-class)">
+ <value-of select="$table-class"/>
+ </when>
+
+ <otherwise>
+ <value-of select="''"/>
+ </otherwise>
+ </choose>
+ </param>
+
+ <variable name="USE_DEFAULT_TABLE_CLASS" select="string-length($TABLE_CLASS) &gt; 0"/>
+
+
+ <!--
+ == Wiki style constants ==
+ -->
+
+ <!-- Bold character style. -->
+ <variable name="BOLD_BIT" select="1"/>
+
+ <!-- Italic character style. -->
+ <variable name="ITALIC_BIT" select="2"/>
+
+ <!-- Subscript character style. -->
+ <variable name="SUBSCRIPT_BIT" select="4"/>
+
+ <!-- Superscript character style. -->
+ <variable name="SUPERSCRIPT_BIT" select="8"/>
+
+ <!-- Typewriter character style. -->
+ <variable name="TYPEWRITER_BIT" select="16"/>
+
+ <!-- Preformatted text paragraph style. -->
+ <variable name="CODE_BIT" select="32"/>
+
+ <!-- Centered paragraph style. -->
+ <variable name="CENTER_BIT" select="64"/>
+
+ <!-- Right aligned paragraph style. -->
+ <variable name="RIGHT_BIT" select="128"/>
+
+ <!-- Constant defining the empty style. -->
+ <variable name="NO_STYLE" select="0"/>
+
+
+
+ <output
+ method="text"
+ media-type="text/plain"
+ encoding="UTF-8"
+ />
+
+
+ <!--
+ == Reference resolution ==
+ -->
+
+ <key
+ name="style-ref"
+ match="//style:style"
+ use="@style:name"
+ />
+
+ <key
+ name="list-style-ref"
+ match="//text:list-style"
+ use="@style:name"
+ />
+
+ <key
+ name="font-face-ref"
+ match="//style:font-face"
+ use="@style:name"
+ />
+
+ <key
+ name="reference-resolution"
+ match="//text:reference-mark | //text:reference-mark-start"
+ use="@text:name"
+ />
+
+
+ <!--
+ Multiple pages (draw only)
+ -->
+
+ <template match="draw:page">
+ <value-of select="concat('&#10;&lt;!-- Page ', @draw:name, '--&gt;&#10;')"/>
+ <apply-templates/>
+ <value-of select="'&#10;----&#10;&#10;'"/>
+ </template>
+
+
+ <!--
+ == Lists ==
+ -->
+
+ <template match="text:list">
+ <!--
+ Check, whether this list is used to implement the outline numbering
+ for headings. Such list must not be exported, because within the wiki,
+ automatic outline numbering is performed. An outline list has a single
+ text:h element as its single leaf grandchild.
+
+ This method of section numbering seems not to be used when creating new
+ documents with OpenOffice.org 2.2, but the document containing the
+ OpenDocument specification version 1.1 uses such numbering through nested
+ lists.
+ -->
+ <choose>
+ <when test="boolean(./descendant::node()[not(./self::text:list) and not(./self::text:list-item) and not(./ancestor-or-self::text:h)])">
+ <apply-templates/>
+ </when>
+
+ <otherwise>
+ <apply-templates select=".//text:h"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template match="text:list-item">
+ <if test="position() &gt; 1 or boolean(ancestor::text:list-item)">
+ <value-of select="$NL"/>
+ </if>
+ <variable name="list-style"
+ select="key('list-style-ref',ancestor::text:list[boolean(@text:style-name)][1]/@text:style-name)"/>
+ <call-template name="mk-list-token">
+ <with-param name="list-style" select="$list-style"/>
+ <with-param name="level" select="count(ancestor::text:list)"/>
+ </call-template>
+ <text> </text>
+ <apply-templates/>
+ <if test="position() = last() and not(boolean(ancestor::text:list-item))">
+ <!-- End of (potentially nested) list is marked with a double newline. -->
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </if>
+ </template>
+
+ <template name="mk-list-token">
+ <param name="list-style"/>
+ <param name="level"/>
+
+ <if test="$level &gt; 1">
+ <call-template name="mk-list-token">
+ <with-param name="list-style" select="$list-style"/>
+ <with-param name="level" select="$level - 1"/>
+ </call-template>
+ </if>
+
+ <variable name="number-style" select="$list-style/text:list-level-style-number[@text:level=$level]"/>
+ <variable name="bullet-style" select="$list-style/text:list-level-style-bullet[@text:level=$level]"/>
+ <choose>
+ <when test="boolean($number-style)">
+ <choose>
+ <when test="string-length($number-style/@style:num-format) &gt; 0">
+ <text>#</text>
+ </when>
+ <otherwise>
+ <text>:</text>
+ </otherwise>
+ </choose>
+ </when>
+ <when test="boolean($bullet-style)">
+ <text>*</text>
+ </when>
+ </choose>
+ </template>
+
+
+ <!--
+ == Headings ==
+ -->
+
+ <template match="text:h">
+ <if test="string-length(.) &gt; 0">
+ <variable name="token">
+ <call-template name="mk-heading-prefix">
+ <with-param name="level" select="@text:outline-level"/>
+ </call-template>
+ </variable>
+ <value-of select="$token"/>
+ <text> </text>
+ <apply-templates/>
+ <text> </text>
+ <value-of select="$token"/>
+ <value-of select="$NL"/>
+ </if>
+ </template>
+
+ <template match="text:index-title">
+ <text>== </text>
+ <apply-templates/>
+ <text> ==</text>
+ <value-of select="$NL"/>
+ </template>
+
+ <!--
+ Function generating a wiki heading prefix.
+
+ @param level
+ The heading level. The value must be between 1 and 5.
+ -->
+ <template name="mk-heading-prefix">
+ <param name="level"/>
+ <choose>
+ <when test="$level &gt; 5">
+ <call-template name="mk-heading-prefix">
+ <with-param name="level" select="5"/>
+ </call-template>
+ </when>
+ <when test="$level &gt; 0">
+ <text>=</text>
+ <call-template name="mk-heading-prefix">
+ <with-param name="level" select="$level - 1"/>
+ </call-template>
+ </when>
+ </choose>
+ </template>
+
+ <!--
+ Funktion generating a token consisting of the given character
+ repeated 'level' times.
+
+ @param level
+ The lengh of the result.
+ @param char
+ The character that should be repeated 'level' times.
+ -->
+ <template name="mk-token">
+ <param name="level"/>
+ <param name="char"/>
+ <if test="$level &gt; 0">
+ <value-of select="$char"/>
+ <call-template name="mk-token">
+ <with-param name="level" select="$level - 1"/>
+ <with-param name="char" select="$char"/>
+ </call-template>
+ </if>
+ </template>
+
+
+ <!--
+ == Tables ==
+ -->
+
+ <template match="table:table">
+ <text>&#10;</text>
+ <text>{|</text>
+
+ <choose>
+ <when test="$USE_DEFAULT_TABLE_CLASS">
+ <text> class="</text>
+ <value-of select="$TABLE_CLASS"/>
+ <text>"</text>
+ </when>
+
+ <otherwise>
+ <!-- Default setting to translate detailed office table cell styles correctly. -->
+ <text> style="border-spacing:0;"</text>
+ </otherwise>
+ </choose>
+
+ <text>&#10;</text>
+ <apply-templates/>
+ <text>&#10;</text>
+ <text>|}</text>
+ <text>&#10;</text>
+ </template>
+
+ <template match="table:table-header-rows">
+ <apply-templates/>
+ </template>
+
+ <template match="table:table-row[position() &lt; last()] | table:table-header-rows/table:table-row">
+ <apply-templates/>
+ <text>&#10;</text>
+ <text>|-</text>
+ <text>&#10;</text>
+ </template>
+
+ <template match="table:table-row">
+ <apply-templates/>
+ </template>
+
+ <template match="table:table-header-rows//table:table-cell">
+ <text>! </text>
+ <if test="@table:number-columns-spanned">
+ <text>colspan="</text>
+ <value-of select="@table:number-columns-spanned"/>
+ <text>" | </text>
+ </if>
+ <apply-templates/>
+ <value-of select="$NL"/>
+ </template>
+
+ <template match="table:table-cell">
+ <text>|</text>
+ <if test="@table:number-columns-spanned">
+ <text> colspan="</text>
+ <value-of select="@table:number-columns-spanned"/>
+ <text>" </text>
+ </if>
+ <if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(@table:style-name)">
+ <variable name="style-element" select="key('style-ref', @table:style-name)"/>
+
+ <variable name="style">
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'background-color'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
+ </call-template>
+
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-top'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-bottom'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-left'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-right'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
+ </call-template>
+
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-top'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-bottom'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-left'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-right'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
+ </call-template>
+ </variable>
+
+ <if test="string-length($style) &gt; 0">
+ <text> style="</text>
+ <value-of select="$style"/>
+ <text>"</text>
+ </if>
+ </if>
+ <text>| </text>
+ <apply-templates/>
+ <value-of select="$NL"/>
+ </template>
+
+ <template name="translate-style-property">
+ <param name="style-name"/>
+ <param name="style-property"/>
+
+ <if test="boolean($style-property)">
+ <value-of select="$style-name"/>
+ <text>:</text>
+ <value-of select="string($style-property)"/>
+ <text>;</text>
+ </if>
+ </template>
+
+ <!--
+ == WikiMath ==
+ -->
+
+ <template match="text:span[@text:style-name='WikiMath']">
+ <value-of select="'&lt;math&gt;'"/>
+ <apply-templates/>
+ <value-of select="'&lt;/math&gt;'"/>
+ </template>
+
+
+ <!--
+ == Native links ==
+ -->
+
+ <template match="text:a">
+ <variable name="link-ref" select="@xlink:href"/>
+ <choose>
+ <when test="string-length($link-ref) &gt; 0">
+ <variable name="link-label" select="string(.)"/>
+ <text>[</text>
+ <value-of select="$link-ref"/>
+ <text> </text>
+ <value-of select="$link-label"/>
+ <text>]</text>
+ </when>
+
+ <otherwise>
+ <apply-templates/>
+ </otherwise>
+ </choose>
+ </template>
+
+
+ <!--
+ == WikiLink ==
+ -->
+
+ <template match="text:span[@text:style-name='WikiLink']">
+ <value-of select="'[['"/>
+ <variable name="link-def" select="string(.)"/>
+ <variable name="link-label" select="normalize-space(substring-before($link-def, '['))"/>
+ <variable name="link-ref" select="normalize-space(substring-before(substring-after($link-def, '['), ']'))"/>
+ <choose>
+ <when test="boolean($link-ref)">
+ <value-of select="concat($link-ref, '|', $link-label)"/>
+ </when>
+ <otherwise>
+ <value-of select="$link-def"/>
+ </otherwise>
+ </choose>
+ <value-of select="']]'"/>
+ </template>
+
+
+ <!--
+ == Paragraphs ==
+ -->
+
+ <template match="text:p[string-length(.) &gt; 0]">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+ <variable name="center"
+ select="($style mod (2 * $CENTER_BIT)) - ($style mod ($CENTER_BIT)) != 0"/>
+ <variable name="right"
+ select="($style mod (2 * $RIGHT_BIT)) - ($style mod ($RIGHT_BIT)) != 0"/>
+
+ <choose>
+ <when test="$center">
+ <text>&lt;center&gt;</text>
+ </when>
+ <when test="$right">
+ <text>&lt;div align="right"&gt;</text>
+ </when>
+ <when test="$code">
+ <value-of select="' '"/>
+ </when>
+ </choose>
+
+ <apply-templates/>
+
+ <choose>
+ <when test="$center">
+ <text>&lt;/center&gt;</text>
+ </when>
+ <when test="$right">
+ <text>&lt;/div&gt;</text>
+ </when>
+ </choose>
+
+ <variable name="paragraph-right"
+ select="./following-sibling::*[1]/self::text:p"/>
+
+ <choose>
+ <when test="boolean($paragraph-right)">
+ <!--
+ Insert end of line only if not within a list. Within wiki lists,
+ a line break leaves the current list item.
+ -->
+ <choose>
+ <when test="boolean(ancestor::text:list-item)">
+ <text>&lt;br/&gt; </text>
+ </when>
+ <when test="$code">
+ <variable name="style-right">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="$paragraph-right"/>
+ </call-template>
+ </variable>
+
+ <variable name="code-right"
+ select="($style-right mod (2 * $CODE_BIT)) - ($style-right mod ($CODE_BIT)) != 0"/>
+
+ <choose>
+ <when test="$code-right">
+ <choose>
+ <when test="$CODE_JOIN_PARAGRAPHS">
+ <value-of select="$NL"/>
+ </when>
+
+ <otherwise>
+ <value-of select="$NL"/>
+ <value-of select="' '"/>
+ <value-of select="$NL"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </otherwise>
+ </choose>
+ </when>
+ <when test="boolean(./following-sibling::*[1]/self::text:h) or boolean(./following-sibling::*[1]/self::table:table) or boolean(./following-sibling::*[1]/self::text:bibliography)">
+ <!-- Newline before following heading or table. -->
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </when>
+ <when test="./following-sibling::*[1]/self::text:list and not(ancestor::text:list-item)">
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </when>
+ </choose>
+ </template>
+
+ <template match="text:p[string-length(.) = 0 and string-length(preceding-sibling::*[1]/self::text:p) &gt; 0]">
+ <value-of select="$NL"/>
+ </template>
+
+
+ <!--
+ == Preformatted text ==
+ -->
+
+ <template match="text:s">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+
+ <if test="$code">
+ <choose>
+ <when test="@text:c">
+ <call-template name="mk-token">
+ <with-param name="level" select="@text:c"/>
+ <with-param name="char" select="' '"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="' '"/>
+ </otherwise>
+ </choose>
+ </if>
+ </template>
+
+ <template match="text:tab">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+
+ <if test="$code">
+ <value-of select="$CODE_TAB_REPLACEMENT"/>
+ </if>
+ </template>
+
+ <template match="text:line-break">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+
+ <if test="$code">
+ <value-of select="$NL"/>
+ <value-of select="' '"/>
+ </if>
+ </template>
+
+ <!--
+ Footnotes
+ -->
+
+ <template match="text:note-body">
+ <variable name="note" select="./parent::text:note"/>
+
+ <if test="$note/@text:note-class = 'footnote'">
+ <text>&lt;ref name="</text>
+ <value-of select="$note/@text:id"/>
+ <text>"&gt;</text>
+ <apply-templates/>
+ <text>&lt;/ref&gt;</text>
+ </if>
+ </template>
+
+ <template match="text:note-ref[@text:note-class='footnote']">
+ <text>&lt;ref name="</text>
+ <value-of select="@text:ref-name"/>
+ <text>"/&gt;</text>
+ </template>
+
+
+ <!--
+ == Images ==
+ -->
+
+ <template match="draw:text-box[boolean(.//draw:image)]">
+ <variable name="image" select=".//draw:image[1]"/>
+
+ <variable name="image-description">
+ <apply-templates/>
+ </variable>
+
+ <text>[[</text>
+ <call-template name="mk-image-name">
+ <with-param name="image" select="$image"/>
+ </call-template>
+ <text>|thumb|</text>
+ <value-of select="normalize-space($image-description)"/>
+ <text>]]</text>
+ </template>
+
+ <template match="draw:image[not(boolean(ancestor::draw:text-box))]">
+ <text>[[</text>
+ <call-template name="mk-image-name">
+ <with-param name="image" select="."/>
+ </call-template>
+ <text>]]</text>
+ </template>
+
+ <template name="mk-image-name">
+ <param name="image"/>
+
+ <variable name="base-name">
+ <call-template name="mk-base-name">
+ <with-param name="href" select="$image/@xlink:href"/>
+ </call-template>
+ </variable>
+
+ <if test="not(starts-with($base-name, 'Image:'))">
+ <value-of select="'Image:'"/>
+ </if>
+ <value-of select="$base-name"/>
+ </template>
+
+ <template name="mk-base-name">
+ <param name="href"/>
+
+ <variable name="result" select="substring-after($href, '/')"/>
+ <choose>
+ <when test="boolean($result)">
+ <call-template name="mk-base-name">
+ <with-param name="href" select="$result"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$href"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <!-- Frames -->
+
+ <template match="draw:frame">
+ <choose>
+ <when test="draw:object/math:math">
+ <apply-templates select="draw:object/math:math[1]"/>
+ </when>
+
+ <when test="draw:image">
+ <apply-templates select="draw:image[1]"/>
+ </when>
+
+ <otherwise>
+ <apply-templates select="./*[1]"/>
+ </otherwise>
+ </choose>
+
+ </template>
+
+ <!-- Formulas (Objects) -->
+
+ <include href="math/mmltex.xsl"/>
+
+ <template match="math:math" priority="1">
+ <text>&lt;math&gt;</text>
+ <apply-templates/>
+ <text>&lt;/math&gt;</text>
+ </template>
+
+
+ <!--
+ References
+ -->
+
+ <!-- TODO: text:bibliography-mark -->
+
+ <template match="text:reference-ref">
+ <variable name="reference-mark" select="key('reference-resolution', @text:ref-name)"/>
+
+ <choose>
+ <when test="boolean($reference-mark)">
+ <!--
+ In wiki syntax, only a local reference to a heading can be inserted.
+ If the link target is a descendant of a heading element, a link can be
+ inserted in the result. -->
+ <variable name="header-anchor" select="$reference-mark/ancestor::text:h[1]"/>
+ <if test="boolean($header-anchor)">
+ <text>[[#</text>
+ <value-of select="string($header-anchor)"/>
+ <text>|</text>
+ </if>
+
+ <variable name="reference-text" select="string(.)"/>
+
+ <choose>
+ <!-- Check, whether the reference text is cached in the document. -->
+ <when test="string-length($reference-text) &gt; 0">
+ <value-of select="$reference-text"/>
+ </when>
+
+ <otherwise>
+ <!--
+ TODO: Evaluate the @text:reference-format attribute and
+ generate the replacement text (difficult).-->
+ <text>(REFERENCE TEXT UNAVAILABLE: "</text>
+ <value-of select="@text:ref-name"/>
+ <text>")</text>
+ </otherwise>
+ </choose>
+
+ <if test="boolean($header-anchor)">
+ <text>]]</text>
+ </if>
+ </when>
+
+ <otherwise>
+ <text>(UNDEFINED REFERENCE: "</text>
+ <value-of select="@text:ref-name"/>
+ <text>")</text>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template match="text:reference-mark">
+ <!-- TODO: Output an anchor. -->
+ <apply-templates/>
+ </template>
+
+ <template match="text:reference-mark-start">
+ <!-- TODO: Output an anchor. -->
+ </template>
+
+ <!--
+ == Plain text ==
+ -->
+
+ <template match="text:p/text() | text:h/text() | text:span/text() | text:sequence/text() | text:sequence-ref/text() | text:a/text() | text:bookmark-ref/text() | text:reference-mark/text() | text:date/text() | text:time/text() | text:page-number/text() | text:sender-firstname/text() | text:sender-lastname/text() | text:sender-initials/text() | text:sender-title/text() | text:sender-position/text() | text:sender-email/text() | text:sender-phone-private/text() | text:sender-fax/text() | text:sender-company/text() | text:sender-phone-work/text() | text:sender-street/text() | text:sender-city/text() | text:sender-postal-code/text() | text:sender-country/text() | text:sender-state-or-province/text() | text:author-name/text() | text:author-initials/text() | text:chapter/text() | text:file-name/text() | text:template-name/text() | text:sheet-name/text() | text:variable-get/text() | text:variable-input/text() | text:user-field-get/text() | text:user-field-input/text() | text:expression/text() | text:text-input/text() | text:initial-creator/text() | text:creation-date/text() | text:creation-time/text() | text:description/text() | text:user-defined/text() | text:print-date/text() | text:printed-by/text() | text:title/text() | text:subject/text() | text:keywords/text() | text:editing-cycles/text() | text:editing-duration/text() | text:modification-date/text() | text:creator/text() | text:modification-time/text() | text:page-count/text() | text:paragraph-count/text() | text:word-count/text() | text:character-count/text() | text:table-count/text() | text:image-count/text() | text:object-count/text() | text:database-display/text() | text:database-row-number/text() | text:database-name/text() | text:page-variable-get/text() | text:placeholder/text() | text:conditional-text/text() | text:hidden-text/text() | text:execute-macro/text() | text:dde-connection/text() | text:measure/text() | text:table-formula/text()">
+ <choose>
+ <when test="boolean(./ancestor::table:table-header-rows | ./ancestor::text:h)">
+ <!--
+ No explicit styles within table headings or section headings,
+ because those styles are consistently declared by the Wiki engine. -->
+ <value-of select="."/>
+ </when>
+
+ <when test="string-length(.) &gt; 0">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="current-paragraph"
+ select="./ancestor::text:p[1]"/>
+ <variable name="paragraph-id"
+ select="generate-id($current-paragraph)"/>
+ <variable name="frames"
+ select="$current-paragraph/descendant::draw:frame"/>
+ <variable name="frame-count"
+ select="count($frames)"/>
+
+ <!--
+ The current style context consists of all text nodes that are
+ descendants of the paragraph ancestor of this text node but not
+ descendants of any frame nodes that are descendants of the current
+ text nodes paragraph.
+ -->
+ <variable name="context"
+ select="$current-paragraph//text()[not(boolean(./ancestor::draw:frame[1]) and count(./ancestor::draw:frame[1] | $frames) = $frame-count)]"/>
+ <variable name="context-size" select="count($context)"/>
+
+ <variable name="context-index">
+ <call-template name="mk-context-index">
+ <with-param name="current-id" select="generate-id(.)"/>
+ <with-param name="context" select="$context"/>
+ <with-param name="test-index" select="1"/>
+ </call-template>
+ </variable>
+
+ <variable name="style-left">
+ <choose>
+ <when test="$context-index &gt; 1">
+ <variable name="left" select="$context[$context-index - 1]"/>
+ <!--
+ The preceding text node is a child of this nodes topmost
+ styled ancestor. This means that the result of the
+ transformation will be directly concatenated.
+ -->
+ <call-template name="mk-style-set">
+ <with-param name="node" select="$left"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="style-right">
+ <choose>
+ <when test="$context-index &lt; count($context)">
+ <variable name="right" select="$context[$context-index + 1]"/>
+ <!--
+ The preceding text node is a child of this nodes topmost
+ styled ancestor. This means that the result of the
+ transformation will be directly concatenated.
+ -->
+ <call-template name="mk-style-set">
+ <with-param name="node" select="$right"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="bold"
+ select="($style mod (2 * $BOLD_BIT)) != 0"/>
+ <variable name="italic"
+ select="($style mod (2 * $ITALIC_BIT)) - ($style mod ($ITALIC_BIT)) != 0"/>
+ <variable name="superscript"
+ select="($style mod (2 * $SUPERSCRIPT_BIT)) - ($style mod ($SUPERSCRIPT_BIT)) != 0"/>
+ <variable name="subscript"
+ select="($style mod (2 * $SUBSCRIPT_BIT)) - ($style mod ($SUBSCRIPT_BIT)) != 0"/>
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+ <variable name="typewriter"
+ select="($style mod (2 * $TYPEWRITER_BIT)) - ($style mod ($TYPEWRITER_BIT)) != 0"/>
+
+ <variable name="bold-left"
+ select="($style-left mod (2 * $BOLD_BIT)) != 0"/>
+ <variable name="italic-left"
+ select="($style-left mod (2 * $ITALIC_BIT)) - ($style-left mod ($ITALIC_BIT)) != 0"/>
+ <variable name="superscript-left"
+ select="($style-left mod (2 * $SUPERSCRIPT_BIT)) - ($style-left mod ($SUPERSCRIPT_BIT)) != 0"/>
+ <variable name="subscript-left"
+ select="($style-left mod (2 * $SUBSCRIPT_BIT)) - ($style-left mod ($SUBSCRIPT_BIT)) != 0"/>
+ <variable name="typewriter-left"
+ select="($style-left mod (2 * $TYPEWRITER_BIT)) - ($style-left mod ($TYPEWRITER_BIT)) != 0"/>
+
+ <variable name="bold-right"
+ select="($style-right mod (2 * $BOLD_BIT)) != 0"/>
+ <variable name="italic-right"
+ select="($style-right mod (2 * $ITALIC_BIT)) - ($style-right mod ($ITALIC_BIT)) != 0"/>
+ <variable name="superscript-right"
+ select="($style-right mod (2 * $SUPERSCRIPT_BIT)) - ($style-right mod ($SUPERSCRIPT_BIT)) != 0"/>
+ <variable name="subscript-right"
+ select="($style-right mod (2 * $SUBSCRIPT_BIT)) - ($style-right mod ($SUBSCRIPT_BIT)) != 0"/>
+ <variable name="typewriter-right"
+ select="($style-right mod (2 * $TYPEWRITER_BIT)) - ($style-right mod ($TYPEWRITER_BIT)) != 0"/>
+
+ <!-- Debugging: Add style infos to the output. -->
+ <!--
+ <value-of select="'{'"/>
+ <value-of select="$style-left"/>
+ <value-of select="'-'"/>
+ <value-of select="$style"/>
+ <value-of select="','"/>
+ <value-of select="$context-size"/>
+ <value-of select="'}'"/>
+ -->
+
+ <if test="$superscript and not($superscript-left)">
+ <text>&lt;sup&gt;</text>
+ </if>
+ <if test="$subscript and not($subscript-left)">
+ <text>&lt;sub&gt;</text>
+ </if>
+ <if test="not($code) and $typewriter and not($typewriter-left)">
+ <text>&lt;tt&gt;</text>
+ </if>
+ <if test="$bold and not($bold-left)">
+ <text>'''</text>
+ </if>
+ <if test="$italic and not($italic-left)">
+ <text>''</text>
+ </if>
+
+ <call-template name="render-quoted-text">
+ <with-param name="text" select="."/>
+ </call-template>
+
+ <if test="$italic and not($italic-right)">
+ <text>''</text>
+ </if>
+ <if test="$bold and not($bold-right)">
+ <text>'''</text>
+ </if>
+ <if test="not($code) and $typewriter and not($typewriter-right)">
+ <text>&lt;/tt&gt;</text>
+ </if>
+ <if test="$subscript and not($subscript-right)">
+ <text>&lt;/sub&gt;</text>
+ </if>
+ <if test="$superscript and not($superscript-right)">
+ <text>&lt;/sup&gt;</text>
+ </if>
+
+ <!-- Debugging: Add style details to the output. -->
+ <!--
+ <value-of select="'{'"/>
+ <value-of select="$style"/>
+ <value-of select="'-'"/>
+ <value-of select="$style-right"/>
+ <value-of select="'}'"/>
+ -->
+
+ </when>
+ </choose>
+ </template>
+
+ <!--
+ Function for looking up the position of a node identified by the given
+ 'current-id' within a node set 'context'.
+
+ The search starts with the the index 'test-index'. The search is recursive
+ in the 'test-index' argument. To save recursion depth, each recursive call
+ iteratively tests a fixed number of indexes (by loop unrolling).
+ -->
+ <template name="mk-context-index">
+ <param name="current-id"/>
+ <param name="context"/>
+ <param name="test-index"/>
+
+ <variable name="context-size" select="count($context)"/>
+
+ <choose>
+ <when test="context-size &lt; $test-index">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index])">
+ <value-of select="$test-index"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 1)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 1])">
+ <value-of select="$test-index + 1"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 2)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 2])">
+ <value-of select="$test-index + 2"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 3)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 3])">
+ <value-of select="$test-index + 3"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 4)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 4])">
+ <value-of select="$test-index + 4"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 5)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 5])">
+ <value-of select="$test-index + 5"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 6)">
+ </when>
+ <otherwise>
+ <call-template name="mk-context-index">
+ <with-param name="current-id" select="$current-id"/>
+ <with-param name="context" select="$context"/>
+ <with-param name="test-index" select="$test-index + 6"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template name="render-quoted-text">
+ <param name="text"/>
+
+ <choose>
+ <when test="contains($text, '&lt;') or contains($text, '[') or starts-with($text, '----') or starts-with($text, '=') or starts-with($text, '*') or starts-with($text, ';') or starts-with($text, '#')">
+ <text>&lt;nowiki&gt;</text>
+ <choose>
+ <when test="contains($text, '&lt;/nowiki&gt;')">
+ <call-template name="render-escaped-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ <text>&lt;/nowiki&gt;</text>
+ </when>
+ <otherwise>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template name="render-escaped-text">
+ <param name="text"/>
+
+ <choose>
+ <when test="contains($text, '&lt;')">
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="substring-before($text, '&lt;')"/>
+ </call-template>
+ <value-of select="'&amp;lt;'"/>
+ <call-template name="render-escaped-text">
+ <with-param name="text" select="substring-after($text, '&lt;')"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template name="render-encoded-text">
+ <param name="text"/>
+
+ <choose>
+ <when test="contains($text, '&#160;')">
+ <value-of select="substring-before($text, '&#160;')"/>
+ <value-of select="'&amp;nbsp;'"/>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="substring-after($text, '&#160;')"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$text"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <!--
+ == Wiki styles: bold, italics, ... ==
+ -->
+
+ <template name="mk-style-set">
+ <param name="node"/>
+
+ <variable
+ name="context"
+ select="$node/ancestor-or-self::*[@text:style-name][1]"
+ />
+
+ <choose>
+ <when test="boolean($context)">
+ <variable
+ name="style"
+ select="key('style-ref', $context/@text:style-name)"
+ />
+
+ <!-- Debugging: Print inspected styles. -->
+ <!--
+ <message>
+ <value-of select="'=== '"/>
+ <value-of select="$style/@style:name"/>
+ <value-of select="' ==='"/>
+ </message>
+ -->
+
+ <call-template name="mk-style-set-internal">
+ <with-param name="node" select="$context"/>
+ <with-param name="style" select="$style"/>
+ <with-param name="style-set" select="$NO_STYLE"/>
+ <with-param name="style-mask" select="$NO_STYLE"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <!--
+ Compute the wiki style set that corresponds
+ to the given office style at the given context node.
+
+ @param node
+ A node in which context the style is computed. If neither the given style
+ nor one of its linked styles does specify a style of the given type,
+ ancestor nodes of the given context node are considered.
+ @param style
+ A style:style element node. The style of the requested type is searched
+ in the given style and its linked styles.
+ @style-set
+ A bit set of styles already defined by the context.
+ @style-mask
+ A bit set of styles that must not be taken from the currently inspected
+ style, because those styles are already defined by the context.
+
+ @return A bit set composed of the wiki style constants.
+ -->
+ <template name="mk-style-set-internal">
+ <param name="node"/>
+ <param name="style"/>
+ <param name="style-set"/>
+ <param name="style-mask"/>
+
+ <variable name="text-properties" select="$style/style:text-properties"/>
+
+ <!-- Decompose style-mask into individual bits. -->
+ <variable name="bold-requested"
+ select="($style-mask mod (2 * $BOLD_BIT)) = 0"/>
+ <variable name="italic-requested"
+ select="($style-mask mod (2 * $ITALIC_BIT)) - ($style-mask mod ($ITALIC_BIT)) = 0"/>
+ <variable name="superscript-requested"
+ select="($style-mask mod (2 * $SUPERSCRIPT_BIT)) - ($style-mask mod ($SUPERSCRIPT_BIT)) = 0"/>
+ <variable name="subscript-requested"
+ select="($style-mask mod (2 * $SUBSCRIPT_BIT)) - ($style-mask mod ($SUBSCRIPT_BIT)) = 0"/>
+ <variable name="typewriter-requested"
+ select="($style-mask mod (2 * $TYPEWRITER_BIT)) - ($style-mask mod ($TYPEWRITER_BIT)) = 0"/>
+ <variable name="code-requested"
+ select="($style-mask mod (2 * $CODE_BIT)) - ($style-mask mod ($CODE_BIT)) = 0"/>
+ <variable name="center-requested"
+ select="($style-mask mod (2 * $CENTER_BIT)) - ($style-mask mod ($CENTER_BIT)) = 0"/>
+ <variable name="right-requested"
+ select="($style-mask mod (2 * $RIGHT_BIT)) - ($style-mask mod ($RIGHT_BIT)) = 0"/>
+
+ <!-- Extract styles that are not already defined by the context. -->
+ <variable name="bold-style">
+ <choose>
+ <when test="$bold-requested and boolean($text-properties/@fo:font-weight='bold')">
+ <!-- Bold found in current style. -->
+ <value-of select="$BOLD_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="bold-mask">
+ <choose>
+ <when test="$bold-requested and boolean($text-properties/@fo:font-weight)">
+ <!--
+ Other value than "bold" means that the character style is not
+ bold and no parent style must be considered.
+ -->
+ <value-of select="$BOLD_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="italic-style">
+ <choose>
+ <when test="$italic-requested and boolean($text-properties/@fo:font-style='italic')">
+ <!-- Italic found in current style. -->
+ <value-of select="$ITALIC_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="italic-mask">
+ <choose>
+ <when test="$italic-requested and boolean($text-properties/@fo:font-style)">
+ <!--
+ Other value than "italic" means that the character style is not
+ italic and no parent style must be considered.
+ -->
+ <value-of select="$ITALIC_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="superscript-style">
+ <choose>
+ <when test="$superscript-requested and contains($text-properties/@style:text-position, 'super')">
+ <value-of select="$SUPERSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="superscript-mask">
+ <choose>
+ <when test="$superscript-requested and boolean($text-properties/@style:text-position)">
+ <value-of select="$SUPERSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="subscript-style">
+ <choose>
+ <when test="$subscript-requested and contains($text-properties/@style:text-position, 'sub')">
+ <value-of select="$SUBSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="subscript-mask">
+ <choose>
+ <when test="$subscript-requested and boolean($text-properties/@style:text-position)">
+ <value-of select="$SUBSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="typewriter-style">
+ <choose>
+ <when test="$typewriter-requested and ($style/@style:family='text') and boolean($text-properties/@style:font-name)">
+ <variable name="font-face"
+ select="key('font-face-ref', $text-properties/@style:font-name)"/>
+ <choose>
+ <when test="$font-face/@style:font-pitch='fixed'">
+ <value-of select="$TYPEWRITER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="typewriter-mask">
+ <choose>
+ <!-- Note: Suppress the typewriter style on text within a code paragraph. -->
+ <when test="$typewriter-requested and boolean($text-properties/@style:font-name)">
+ <value-of select="$TYPEWRITER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="code-style">
+ <choose>
+ <when test="$code-requested and ($style/@style:family='paragraph') and boolean($text-properties/@style:font-name)">
+ <variable name="font-face"
+ select="key('font-face-ref', $text-properties/@style:font-name)"/>
+ <choose>
+ <when test="$font-face/@style:font-pitch='fixed' or (boolean(@style:display-name) and contains($CODE_STYLES, $style/@style:display-name))">
+ <value-of select="$CODE_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="code-mask">
+ <choose>
+ <when test="$code-requested and ($style/@style:family='paragraph') and boolean($text-properties/@style:font-name)">
+ <value-of select="$CODE_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="center-style">
+ <choose>
+ <when test="$center-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align='center')">
+ <value-of select="$CENTER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="center-mask">
+ <choose>
+ <when test="$center-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align)">
+ <value-of select="$CENTER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="right-style">
+ <choose>
+ <when test="$right-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align='end')">
+ <value-of select="$RIGHT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="right-mask">
+ <choose>
+ <when test="$center-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align)">
+ <value-of select="$RIGHT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+
+ <!-- Compute the updated styles and mask. -->
+ <!--
+ Note: The bit masks style-mask, bold-style, italic-style,... are
+ guaranteed to be disjoint, therefore, addition can be use instead
+ of bitwise or (which is missing in XPath). -->
+ <variable name="updated-style"
+ select="$style-set + $bold-style + $italic-style + $superscript-style + $subscript-style + $code-style + $typewriter-style + $center-style + $right-style"/>
+ <variable name="updated-mask"
+ select="$style-mask + $bold-mask + $italic-mask + $superscript-mask + $subscript-mask + $code-mask + $typewriter-mask + $center-mask + $right-mask"/>
+
+ <!-- Inspect linked and nested styles. -->
+ <choose>
+ <when test="boolean($style/@style:parent-style-name)">
+ <!-- Look through the style, the current style is based on. -->
+ <call-template name="mk-style-set-internal">
+ <with-param name="node" select="$node"/>
+ <with-param name="style" select="key('style-ref', $style/@style:parent-style-name)"/>
+ <with-param name="style-set" select="$updated-style"/>
+ <with-param name="style-mask" select="$updated-mask"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <variable name="ancestors" select="$node/ancestor::*[@text:style-name][1]"/>
+
+ <!-- Debugging: Print currently inspected style. -->
+ <!--
+ <message>
+ <value-of select="'{'"/>
+ <value-of select="$style/@style:name"/>
+ <value-of select="','"/>
+ <value-of select="$updated-style"/>
+ <value-of select="','"/>
+ <value-of select="$updated-mask"/>
+ <value-of select="','"/>
+ <value-of select="local-name($ancestors)"/>
+ <value-of select="',('"/>
+ <value-of select="$node"/>
+ <value-of select="')'"/>
+ <value-of select="'}'"/>
+ </message>
+ -->
+
+ <!--
+ If there is an ancestor that has a style, use that style,
+ otherwise, a style is not found. -->
+ <choose>
+ <when test="boolean($ancestors)">
+ <!-- Look through the style of the nearest ancestor that has a style. -->
+ <call-template name="mk-style-set-internal">
+ <with-param name="node" select="$ancestors"/>
+ <with-param name="style" select="key('style-ref', $ancestors/@text:style-name)"/>
+ <with-param name="style-set" select="$updated-style"/>
+ <with-param name="style-mask" select="$updated-mask"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <!-- No more styles to inspect. Return the result. -->
+ <value-of select="$updated-style"/>
+ </otherwise>
+ </choose>
+ </otherwise>
+ </choose>
+ </template>
+
+
+ <!--
+ == Descending the tree ==
+ -->
+
+ <template match="/">
+ <apply-templates/>
+ <value-of select="$NL"/>
+ <if test="boolean(//text:note[@text:note-class='footnote'])">
+ <value-of select="$NL"/>
+ <text>----</text>
+ <value-of select="$NL"/>
+ <text>&lt;references/&gt;</text>
+ <value-of select="$NL"/>
+ </if>
+ </template>
+
+ <template match="office:document-content">
+ <apply-templates/>
+ </template>
+
+ <template match="office:body">
+ <apply-templates/>
+ </template>
+
+ <template match="text:tracked-changes">
+ <!-- Ignore change history. -->
+ </template>
+
+ <template match="office:* | text:* | draw:text-box | draw:a">
+ <apply-templates/>
+ </template>
+
+ <template match="node()">
+ </template>
+</stylesheet>
+
+<!--
+ Local Variables:
+ tab-width: 4
+ sgml-indent-step: 4
+ End:
+-->
diff --git a/filter/source/xslt/export/wordml/ooo2wordml.xsl b/filter/source/xslt/export/wordml/ooo2wordml.xsl
new file mode 100644
index 000000000000..da9efc1e889b
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml.xsl
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml.xsl,v $
+
+ $Revision: 1.10 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="yes"/>
+ <xsl:include href="../../common/measure_conversion.xsl"/>
+ <xsl:include href="../common/ooo2ms_docpr.xsl"/>
+ <xsl:include href="ooo2wordml_settings.xsl"/>
+ <xsl:include href="ooo2wordml_border.xsl"/>
+ <xsl:include href="ooo2wordml_page.xsl"/>
+ <xsl:include href="ooo2wordml_text.xsl"/>
+ <xsl:include href="ooo2wordml_list.xsl"/>
+ <xsl:include href="ooo2wordml_field.xsl"/>
+ <xsl:include href="ooo2wordml_table.xsl"/>
+ <xsl:include href="ooo2wordml_draw.xsl"/>
+ <xsl:include href="ooo2wordml_path.xsl"/>
+ <xsl:key name="paragraph-style" match="style:style[@style:family='paragraph']" use="@style:name"/>
+ <xsl:key name="text-style" match="style:style[@style:family='text']" use="@style:name"/>
+ <xsl:key name="section-style" match="style:style[@style:family='section']" use="@style:name"/>
+ <xsl:key name="master-page" match="style:master-page" use="@style:name"/>
+ <xsl:key name="page-layout" match="style:page-layout" use="@style:name"/>
+ <xsl:key name="slave-style" match="style:style[string-length(normalize-space(@style:master-page-name)) &gt; 0]" use="@style:name"/>
+ <xsl:key name="list-style" match="office:styles/text:list-style | office:automatic-styles/text:list-style" use="@style:name"/>
+ <xsl:key name="graphics-style" match="style:style[@style:family='graphic']" use="@style:name"/>
+ <xsl:template match="/">
+ <xsl:apply-templates select="office:document"/>
+ </xsl:template>
+ <xsl:template match="office:document">
+ <xsl:processing-instruction name="mso-application">progid="Word.Document"</xsl:processing-instruction>
+ <xsl:variable name="embeddedObjPresent">
+ <xsl:choose>
+ <xsl:when test="//draw:object-ole[1]">yes</xsl:when>
+ <xsl:otherwise>no</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:wordDocument xml:space="preserve" w:embeddedObjPresent="{$embeddedObjPresent}">
+ <xsl:apply-templates select="office:meta"/>
+ <xsl:apply-templates select="office:font-face-decls"/>
+ <xsl:if test="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
+ <xsl:call-template name="ListStyles"/>
+ </xsl:if>
+ <w:styles>
+ <xsl:apply-templates select="office:styles"/>
+ <xsl:apply-templates select="office:automatic-styles"/>
+ <xsl:call-template name="add_hyperlink_style"/>
+ <!--add for hyperlink character style G.Y.-->
+ <xsl:call-template name="add_comments_style"/>
+ <!--add for comments style G.Y.-->
+ </w:styles>
+ <xsl:call-template name="export-oledata"/>
+ <xsl:apply-templates select="office:settings"/>
+ <xsl:apply-templates select="office:body"/>
+ </w:wordDocument>
+ </xsl:template>
+ <xsl:template match="office:body">
+ <xsl:call-template name="page-background"/>
+ <xsl:apply-templates select="office:text"/>
+ </xsl:template>
+ <xsl:template match="office:font-face-decls">
+ <!-- get default font from default paragraph properties -->
+ <w:fonts>
+ <xsl:variable name="default-paragraph-properties" select="/office:document/office:styles/style:default-style[@style:family = 'paragraph']/style:paragraph-properties"/>
+ <w:defaultFonts w:ascii="{$default-paragraph-properties/@style:font-name}" w:h-ansi="{$default-paragraph-properties/@style:font-name}" w:fareast="{$default-paragraph-properties/@style:font-name-asian}" w:cs="{$default-paragraph-properties/@style:font-name-complex}"/>
+ <xsl:for-each select="style:font-face">
+ <w:font w:name="{@style:name}">
+ <xsl:if test="@style:font-charset = 'x-symbol'">
+ <w:charset w:val="02"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@style:font-family-generic = 'swiss'">
+ <w:family w:val="Swiss"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'modern'">
+ <w:family w:val="Modern"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'roman'">
+ <w:family w:val="Roman"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'script'">
+ <w:family w:val="Script"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'decorative'">
+ <w:family w:val="Decorative"/>
+ </xsl:when>
+ <xsl:when test="@style:font-family-generic = 'system'">
+ <w:family w:val="System"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:family w:val="System"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <w:pitch w:val="{@style:font-pitch}"/>
+ </w:font>
+ </xsl:for-each>
+ </w:fonts>
+ </xsl:template>
+ <xsl:template match="office:styles | office:automatic-styles">
+ <xsl:for-each select="*[(name()='style:style' or name()='style:default-style') and (@style:family= 'paragraph' or @style:family= 'text' or @style:family='table')]">
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="name() = 'style:default-style'">
+ <xsl:value-of select="concat('default-', @style:family, '-style')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@style:name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:style w:styleId="{$style-name}">
+ <xsl:choose>
+ <xsl:when test="@style:family = 'paragraph'">
+ <xsl:attribute name="w:type">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:family = 'text'">
+ <xsl:attribute name="w:type">character</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:family = 'table'">
+ <xsl:attribute name="w:type">table</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="name() = 'style:default-style'">
+ <xsl:attribute name="w:default">on</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@style:parent-style-name">
+ <w:basedOn w:val="{@style:parent-style-name}"/>
+ </xsl:when>
+ <xsl:when test="name() = 'style:style' and @style:family= 'paragraph'">
+ <w:basedOn w:val="{concat('default-', @style:family, '-style')}"/>
+ </xsl:when>
+ </xsl:choose>
+ <w:name w:val="{$style-name}"/>
+ <xsl:if test="parent::office:automatic-styles">
+ <w:hidden w:val="on"/>
+ </xsl:if>
+ <xsl:if test="@style:next-style-name">
+ <w:next w:val="{@style:next-style-name}"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@style:family = 'paragraph'">
+ <xsl:apply-templates select="style:paragraph-properties" mode="paragraph"/>
+ </xsl:when>
+ <xsl:when test="@style:family = 'table'">
+ <w:tblPr>
+ <xsl:apply-templates select="style:table-properties" mode="table"/>
+ </w:tblPr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="style:text-properties" mode="character"/>
+ </w:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="office:text">
+ <w:body>
+ <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list |table:table"/>
+ <xsl:variable name="paragraph-heading-table" select=".//*[name() = 'text:p' or name() = 'text:h' or name() = 'table:table']"/>
+ <xsl:variable name="page" select="$paragraph-heading-table[key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/>
+ <w:sectPr>
+ <!--w:type w:val="continuous"/ -->
+ <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="count($page) &gt; 0">
+ <xsl:apply-templates select="key('master-page', key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/@style:master-page-name)"/>
+ <xsl:if test="key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number">
+ <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page -->
+ <xsl:variable name="pagenumber_start">
+ <xsl:value-of select=" key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/>
+ </xsl:variable>
+ <xsl:if test=" number($pagenumber_start) &gt; 0 ">
+ <w:pgNumType w:start="{$pagenumber_start}"/>
+ </xsl:if>
+ <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 -->
+ <!-- w:pgNumType w:start="{key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/-->
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$paragraph-heading-table[last()]/ancestor::text:section">
+ <xsl:apply-templates select="key('section-style',$paragraph-heading-table[last()]/ancestor::text:section[1]/@text:style-name)" mode="section"/>
+ </xsl:if>
+ </w:sectPr>
+ </w:body>
+ </xsl:template>
+ <xsl:template match="text:section">
+ <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list | table:table"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_border.xsl b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl
new file mode 100644
index 000000000000..2e628d921b7e
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_border.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <!-- multiple usage: get size, type, color of table-cell, paragraph, and page borders. -->
+ <xsl:template name="get-border-size">
+ <xsl:param name="border"/>
+ <xsl:param name="border-line-width"/>
+ <xsl:choose>
+ <xsl:when test="$border = 'none' or $border = 'hidden'">
+ <xsl:text>none;0</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="border-value">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$border"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="border-style">
+ <xsl:choose>
+ <xsl:when test="contains($border,'solid')">solid</xsl:when>
+ <xsl:when test="contains($border,'double')">double</xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- MS word and SO wirter borders Mapping
+ MS word Borders SO borders
+ w:val="single" w:sz="0" 0.05pt(0.002cm);solid
+ w:val="single" w:sz="12" 1.00pt(0.035cm);solid
+ w:val="single" w:sz="18" 2.50pt(0.088cm);solid
+ w:val="single" w:sz="36" 4.00pt(0.141cm);solid
+ w:val="single" w:sz="48" 5.00pt(0.176cm);solid
+ w:val="double" w:sz="2" 1.10pt(0.039cm);double
+ w:val="double" w:sz="6" 2.60pt(0.092cm);double
+ w:val="thin-thick-small-gap" w:sz="12" 3.00pt(0.105cm);double
+ w:val="thin-thick-large-gap" w:sz="18" 3.55pt(0.125cm);double
+ w:val="thick-thin-medium-gap" w:sz="24" 4.50pt(0.158cm);double
+ w:val="thin-thick-medium-gap" w:sz="24" 5.05pt(0.178cm);double
+ w:val="thin-thick-small-gap" w:sz="24" 6.00pt(0.211cm);double
+ w:val="thin-thick-medium-gap" w:sz="36 " 6.55pt(0.231cm);double
+ w:val="double" w:sz="18" 7.50pt(0.264cm);double
+ w:val="thin-thick-medium-gap" w:sz="48" 9.00pt(0.317cm);double;style:border-line-width="0.088cm 0.088cm 0.141cm"
+ w:val="double" w:sz="24" 9.00pt(0.317cm);double;style:border-line-width="0.141cm 0.088cm 0.088cm"
+ we adjust the criteria by adding about 1/2 range of this current criteria and next criteria. Gary. Yang -->
+ <xsl:variable name="microsoft-border-style-size">
+ <xsl:choose>
+ <xsl:when test=" $border-style = 'solid'">
+ <xsl:choose>
+ <xsl:when test="$border-value &lt;= 0.018">single;0</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.055">single;12</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.110">single;18</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.155">single;36</xsl:when>
+ <xsl:when test="$border-value &lt;= 0.198">single;48</xsl:when>
+ <xsl:otherwise>single;48</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'double'">
+ <xsl:choose>
+ <xsl:when test="$border-value &lt; 0.064">double;2</xsl:when>
+ <xsl:when test="$border-value &lt; 0.098">double;6</xsl:when>
+ <xsl:when test="$border-value &lt; 0.115">thin-thick-small-gap;12</xsl:when>
+ <xsl:when test="$border-value &lt; 0.135">thin-thick-large-gap;18</xsl:when>
+ <xsl:when test="$border-value &lt; 0.168">thick-thin-medium-gap;24</xsl:when>
+ <xsl:when test="$border-value &lt; 0.190">thin-thick-medium-gap;24</xsl:when>
+ <xsl:when test="$border-value &lt; 0.221">thin-thick-small-gap;24</xsl:when>
+ <xsl:when test="$border-value &lt; 0.241">thin-thick-medium-gap;36</xsl:when>
+ <xsl:when test="$border-value &lt; 0.300">double;18</xsl:when>
+ <xsl:when test="$border-value &lt; 0.430">
+ <xsl:variable name="border-inner-line-value">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$border-line-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$border-inner-line-value &lt; 0.10">thin-thick-medium-gap;48</xsl:if>
+ <xsl:if test="$border-inner-line-value &gt; 0.10">double;24</xsl:if>
+ </xsl:when>
+ <xsl:otherwise>double;24</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>none;0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$microsoft-border-style-size"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- get bottom and right border style, size, color -->
+ <xsl:template name="get-border">
+ <xsl:param name="so-border"/>
+ <xsl:param name="so-border-line-width"/>
+ <xsl:param name="so-border-position"/>
+ <xsl:variable name="ms-style-width">
+ <xsl:call-template name="get-border-size">
+ <xsl:with-param name="border" select="$so-border"/>
+ <xsl:with-param name="border-line-width" select="$so-border-line-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$so-border-position = 'bottom' or $so-border-position = 'right'">
+ <!-- if border style is bottom or right border we need to change the thin-thick to thick-thin; Vice Versa -->
+ <xsl:choose>
+ <xsl:when test="substring-before($ms-style-width, '-')='thin'">
+ <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thick-thin', substring-after(substring-before($ms-style-width, ';'), 'k' ))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="substring-before($ms-style-width, '-')='thick'">
+ <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thin-thick', substring-after(substring-before($ms-style-width, ';'), 'n' ))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width, ';')"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$so-border-position = 'top' or $so-border-position = 'left'">
+ <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width,';')"/></xsl:attribute>
+ <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!--get border color -->
+ <xsl:choose>
+ <xsl:when test="contains($so-border,'#')">
+ <xsl:attribute name="w:color"><xsl:value-of select="substring-after($so-border, '#')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:color">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl
new file mode 100644
index 000000000000..9f2015f30337
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl
@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_custom_draw.xsl,v $
+
+ $Revision: 1.7 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template name="ooo_custom_draw2ms_word_draw_map">
+ <xsl:param name="ooo_predefined_type"/>
+ <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
+ <xsl:choose>
+ <xsl:when test="$ooo_predefined_type = 'isosceles-triangle' ">
+ <xsl:value-of select=" '#_x0000_t5' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-triangle' ">
+ <xsl:value-of select=" '#_x0000_t6' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'trapezoid' ">
+ <xsl:value-of select=" '#_x0000_t8' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'diamond' ">
+ <xsl:value-of select=" '#_x0000_t4' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'hexagon' ">
+ <xsl:value-of select=" '#_x0000_t9' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'parallelogram' ">
+ <xsl:value-of select=" '#_x0000_t7' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'pentagon' ">
+ <xsl:value-of select=" '#_x0000_t56' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'octagon' ">
+ <xsl:value-of select=" '#_x0000_t10' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'cross' ">
+ <xsl:value-of select=" '#_x0000_t11' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'ring' ">
+ <xsl:value-of select=" '#_x0000_t23' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'block-arc' ">
+ <xsl:value-of select=" '#_x0000_t95' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'can' ">
+ <xsl:value-of select=" '#_x0000_t22' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'cube' ">
+ <xsl:value-of select=" '#_x0000_t16' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'paper' ">
+ <xsl:value-of select=" '#_x0000_t65' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'smiley' ">
+ <xsl:value-of select=" '#_x0000_t96' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'sun' ">
+ <xsl:value-of select=" '#_x0000_t183' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'moon' ">
+ <xsl:value-of select=" '#_x0000_t184' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'heart' ">
+ <xsl:value-of select=" '#_x0000_t74' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'forbidden' ">
+ <xsl:value-of select=" '#_x0000_t57' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-bracket' ">
+ <xsl:value-of select=" '#_x0000_t85' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-bracket' ">
+ <xsl:value-of select=" '#_x0000_t86' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-brace' ">
+ <xsl:value-of select=" '#_x0000_t87' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-brace' ">
+ <xsl:value-of select=" '#_x0000_t88' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'bracket-pair' ">
+ <xsl:value-of select=" '#_x0000_t185' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'brace-pair' ">
+ <xsl:value-of select=" '#_x0000_t186' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'quad-bevel' ">
+ <xsl:value-of select=" '#_x0000_t189' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-arrow' ">
+ <xsl:value-of select=" '#_x0000_t66' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'down-arrow' ">
+ <xsl:value-of select=" '#_x0000_t67' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-arrow' ">
+ <xsl:value-of select=" '#_x0000_t68' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'right-arrow' ">
+ <xsl:value-of select=" '#_x0000_t13' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'left-right-arrow' ">
+ <xsl:value-of select=" '#_x0000_t69' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-down-arrow' ">
+ <xsl:value-of select=" '#_x0000_t70' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'mso-spt89' ">
+ <xsl:value-of select=" '#_x0000_t89' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'quad-arrow' ">
+ <xsl:value-of select=" '#_x0000_t76' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'notched-right-arrow' ">
+ <xsl:value-of select=" '#_x0000_t94' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'pentagon-right' ">
+ <xsl:value-of select=" '#_x0000_t177' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'chevron' ">
+ <xsl:value-of select=" '#_x0000_t55' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-arrow-callout' ">
+ <xsl:value-of select=" '#_x0000_t79' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'down-arrow-callout' ">
+ <xsl:value-of select=" '#_x0000_t80' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'up-down-arrow-callout' ">
+ <xsl:value-of select=" '#_x0000_t82' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'circular-arrow' ">
+ <xsl:value-of select=" '#_x0000_t103' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-process' ">
+ <xsl:value-of select=" '#_x0000_t109' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-alternate-process' ">
+ <xsl:value-of select=" '#_x0000_t116' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-decision' ">
+ <xsl:value-of select=" '#_x0000_t110' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-data' ">
+ <xsl:value-of select=" '#_x0000_t111' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-predefined-process' ">
+ <xsl:value-of select=" '#_x0000_t112' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-internal-storage' ">
+ <xsl:value-of select=" '#_x0000_t113' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-document' ">
+ <xsl:value-of select=" '#_x0000_t114' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-multidocument' ">
+ <xsl:value-of select=" '#_x0000_t115' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-terminator' ">
+ <xsl:value-of select=" '#_x0000_t116' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-preparation' ">
+ <xsl:value-of select=" '#_x0000_t117' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-manual-input' ">
+ <xsl:value-of select=" '#_x0000_t118' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-manual-operation' ">
+ <xsl:value-of select=" '#_x0000_t119' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-connector' ">
+ <xsl:value-of select=" '#_x0000_t120' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-off-page-connector' ">
+ <xsl:value-of select=" '#_x0000_t177' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-card' ">
+ <xsl:value-of select=" '#_x0000_t121' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-punched-tape' ">
+ <xsl:value-of select=" '#_x0000_t122' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-summing-junction' ">
+ <xsl:value-of select=" '#_x0000_t123' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-or' ">
+ <xsl:value-of select=" '#_x0000_t124' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-collate' ">
+ <xsl:value-of select=" '#_x0000_t125' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-sort' ">
+ <xsl:value-of select=" '#_x0000_t126' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-extract' ">
+ <xsl:value-of select=" '#_x0000_t127' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-merge' ">
+ <xsl:value-of select=" '#_x0000_t128' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-stored-data' ">
+ <xsl:value-of select=" '#_x0000_t130' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-delay' ">
+ <xsl:value-of select=" '#_x0000_t135' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-sequential-access' ">
+ <xsl:value-of select=" '#_x0000_t131' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-magnetic-disk' ">
+ <xsl:value-of select=" '#_x0000_t132' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-direct-access-storage' ">
+ <xsl:value-of select=" '#_x0000_t133' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'flowchart-display' ">
+ <xsl:value-of select=" '#_x0000_t134' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'rectangular-callout' ">
+ <xsl:value-of select=" '#_x0000_t61' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'round-rectangular-callout' ">
+ <xsl:value-of select=" '#_x0000_t62' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'round-callout' ">
+ <xsl:value-of select=" '#_x0000_t63' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'cloud-callout' ">
+ <xsl:value-of select=" '#_x0000_t106' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'line-callout-1' ">
+ <xsl:value-of select=" '#_x0000_t50' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'line-callout-2' ">
+ <xsl:value-of select=" '#_x0000_t51' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'line-callout-3' ">
+ <xsl:value-of select=" '#_x0000_t47' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'bang' ">
+ <xsl:value-of select=" '#_x0000_t72' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star4' ">
+ <xsl:value-of select=" '#_x0000_t187' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star5' ">
+ <xsl:value-of select=" '#_x0000_t12' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star8' ">
+ <xsl:value-of select=" '#_x0000_t58' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'star24' ">
+ <xsl:value-of select=" '#_x0000_t92' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'vertical-scroll' ">
+ <xsl:value-of select=" '#_x0000_t97' "/>
+ </xsl:when>
+ <xsl:when test="$ooo_predefined_type = 'horizontal-scroll' ">
+ <xsl:value-of select=" '#_x0000_t98' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl
new file mode 100644
index 000000000000..9143ef6f1ff2
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl
@@ -0,0 +1,1889 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_draw.xsl,v $
+
+ $Revision: 1.10 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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:xalan="http://xml.apache.org/xalan" xmlns:oleextracter="MyOleExtracter" xmlns:ole="java:XSLTFilterOLEExtracter" xmlns:java="http://saxon.sf.net/java-type" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw xalan ole oleextracter java" extension-element-prefixes="oleextracter">
+ <xsl:include href="ooo2wordml_custom_draw.xsl"/>
+ <xsl:param name="oleExtractor" as="java:XSLTFilterOLEExtracter" select="ole:new()"/>
+ <xsl:param name="XMultiServiceFactory" as="java:com.sun.star.lang.XMultiServiceFactory" select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+
+ <xsl:key name="stroke-dash-style" match="draw:stroke-dash" use="@draw:name"/>
+ <xsl:key name="fill-image" match="draw:fill-image" use="@draw:name"/>
+ <xsl:key name="draw-gradient" match="draw:gradient " use="@draw:name"/>
+ <xsl:template name="PageLevelGraphic">
+ <xsl:for-each select="//draw:*[@text:anchor-type='page']">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="draw:*">
+ <xsl:param name="TargetMeasure" select="'pt'"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:param name="force-draw" select="'false'"/>
+ <xsl:variable name="MeasureMark">
+ <xsl:choose>
+ <xsl:when test="$TargetMeasure = 'twip'"/>
+ <xsl:otherwise>
+ <xsl:value-of select="$TargetMeasure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <!--
+ deal with captions and frames first. draw:text-box is a powerfull element in OOo, its GUI name is frame. And OOo use it to contain Captions
+ Since there is not a corresponding object in word, so we draw the text-box itself and its children separately. If it look like a Caption only frame
+ we'll adjust the text-box position to make it look pretty
+ -->
+ <!-- skip all not force draw children , must be first case -->
+ <xsl:when test="ancestor::draw:text-box and $force-draw='false' "/>
+ <xsl:when test="name() = 'draw:text-box'">
+ <!-- draw the text-box itself -->
+ <w:r>
+ <w:pict>
+ <xsl:variable name="text-y-adjust">
+ <xsl:choose>
+ <xsl:when test="count(text:p/draw:*) = 1 and (string-length(text:p/draw:*[position()=1]/@svg:x) =0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0) and (string-length(text:p/draw:*[position()=1]/@svg:y)=0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0 ) ">
+ <xsl:variable name="pic-height">
+ <xsl:choose>
+ <xsl:when test="name(text:p/draw:*[position()=1]) = 'draw:g' or name(text:p/draw:*[position()=1]) = 'draw:a'">
+ <xsl:variable name="BigestWindow">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="text:p/draw:*[position()=1]/draw:*"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')) + number(concat('0',translate($y-adjust,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','')))"/>
+ </xsl:when>
+ <xsl:when test="text:p/draw:*[position()=1]/@svg:height">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@svg:height"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="text:p/draw:*[position()=1]/@fo:min-height">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@fo:min-height"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="ancestor::draw:frame">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="ancestor::draw:frame/@svg:height"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min-height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$min-height - $pic-height &lt; 0.001">
+ <!-- If control goes here, it much like that this text-box is used for containt graphic caption only -->
+ <xsl:value-of select="$pic-height - 0.1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="shape-type">
+ <xsl:choose>
+ <xsl:when test="$text-y-adjust = $y-adjust">
+ <xsl:value-of select="'#_x0000_t202'"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="DrawElements">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$text-y-adjust"/>
+ <xsl:with-param name="force-draw" select="'true'"/>
+ <xsl:with-param name="shape-type" select="$shape-type"/>
+ </xsl:call-template>
+ </w:pict>
+ </w:r>
+ <!-- draw the real object first -->
+ <xsl:if test="./text:p/draw:*">
+ <xsl:apply-templates select="./text:p/draw:*">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="@svg:x"/>
+ <xsl:with-param name="value2" select="$x-adjust"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="y-adjust">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="@svg:y"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="force-draw" select="'true'"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:when>
+ <!-- end deal with captions and frames -->
+ <xsl:when test=" name() = 'draw:frame' ">
+ <xsl:variable name="BigestWindow">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="."/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:apply-templates select="draw:* ">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/>
+ <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="name() = 'draw:g'">
+ <w:r>
+ <w:pict>
+ <xsl:element name="v:group">
+ <xsl:variable name="BigestWindow">
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:g'">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="draw:*"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'draw:frame'">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="."/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(number(substring-after(substring-before($BigestWindow,';y2'), 'x2:')) - number(substring-after(substring-before($BigestWindow,';y1'), 'x1:')) , 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat(number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')), 'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="id">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:attribute>
+ <xsl:variable name="absolute">
+ <xsl:choose>
+ <xsl:when test="ancestor::draw:a"/>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/>
+ <xsl:otherwise>position:absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$TargetMeasure= 'pt'">
+ <xsl:attribute name="style">
+ <xsl:if test="string-length($absolute) &gt; 0">
+ <xsl:value-of select="concat($absolute, ';')"/>
+ </xsl:if>
+ <xsl:value-of select="concat('margin-left:',$x ,$MeasureMark,';margin-top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/>
+ </xsl:attribute>
+ <xsl:attribute name="coordorigin">
+ <xsl:choose>
+ <!-- if we are in a text-box then oo will use comparative positions on us-->
+ <xsl:when test="name() = 'draw:frame' ">
+ <xsl:value-of select=" '0 0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(round($x * 20), ',' , round($y * 20))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="coordsize">
+ <xsl:value-of select="concat(round($width * 20),',', round($height * 20) )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$TargetMeasure= 'twip' ">
+ <xsl:attribute name="style">
+ <xsl:if test="string-length($absolute) &gt; 0">
+ <xsl:value-of select="concat($absolute, ';')"/>
+ </xsl:if>
+ <xsl:value-of select="concat('left:',$x ,$MeasureMark,';top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/>
+ </xsl:attribute>
+ <xsl:attribute name="coordorigin">
+ <xsl:choose>
+ <!-- if we are in a text-box then oo will use comparative positions on us-->
+ <xsl:when test="name() = 'draw:frame' ">
+ <xsl:value-of select=" '0 0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($x , ',' , $y)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="coordsize">
+ <xsl:value-of select="concat($width,',', $height )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <!-- if we are in a text-box then oo will use comparative positions on us-->
+ <xsl:when test="ancestor::draw:text-box">
+ <xsl:apply-templates select="draw:*">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/>
+ <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="draw:*">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </w:pict>
+ </w:r>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:a'">
+ <xsl:call-template name="export_hyoerlink">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:r>
+ <w:pict>
+ <xsl:call-template name="DrawElements">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:call-template>
+ </w:pict>
+ </w:r>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetWindowSize">
+ <xsl:param name="CurrPos" select="1"/>
+ <xsl:param name="nodeSet"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:variable name="CurrNodeWindow">
+ <xsl:call-template name="GetNodeWindow">
+ <xsl:with-param name="CurrNode" select=" $nodeSet[ $CurrPos ]"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- if we got to the last node, return it directly, or return the max window of current one and follwing ones -->
+ <xsl:when test="$CurrPos = count($nodeSet)">
+ <xsl:value-of select="$CurrNodeWindow"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="CurrentWindow">
+ <xsl:variable name="FollowingWindow">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="$nodeSet"/>
+ <xsl:with-param name="CurrPos" select="$CurrPos + 1"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="GetBigestWindows">
+ <xsl:with-param name="Window1" select="$CurrNodeWindow"/>
+ <xsl:with-param name="Window2" select="$FollowingWindow"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$CurrentWindow"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetNodeWindow">
+ <xsl:param name="CurrNode"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:choose>
+ <xsl:when test="name($CurrNode)='draw:g'">
+ <xsl:call-template name="GetWindowSize">
+ <xsl:with-param name="nodeSet" select="$CurrNode/draw:*"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="x">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="$CurrNode/@svg:x"/>
+ <xsl:with-param name="value2" select="$x-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:call-template name="Add-With-Measure">
+ <xsl:with-param name="value1" select="$CurrNode/@svg:y"/>
+ <xsl:with-param name="value2" select="$y-adjust"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$CurrNode/@svg:width"/>
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:choose>
+ <xsl:when test="$CurrNode/@svg:height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$CurrNode/@svg:height"/>
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$CurrNode/@fo:min-height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$CurrNode/@fo:min-height"/>
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('x1:' , $x, ';y1:' , $y, ';x2:' , string($x + $width), ';y2:', string($y + $height) ) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetBigestWindows">
+ <xsl:param name="Window1"/>
+ <xsl:param name="Window2"/>
+ <xsl:variable name="w1x1" select="substring-after( substring-before($Window1,';y1'),'x1:') "/>
+ <xsl:variable name="w2x1" select="substring-after( substring-before($Window2,';y1'),'x1:') "/>
+ <xsl:variable name="w1y1" select="substring-after( substring-before($Window1,';x2'),'y1:') "/>
+ <xsl:variable name="w2y1" select="substring-after( substring-before($Window2,';x2'),'y1:') "/>
+ <xsl:variable name="w1x2" select="substring-after( substring-before($Window1,';y2'),'x2:') "/>
+ <xsl:variable name="w2x2" select="substring-after( substring-before($Window2,';y2'),'x2:') "/>
+ <xsl:variable name="w1y2" select="substring-after( $Window1,';y2:') "/>
+ <xsl:variable name="w2y2" select="substring-after( $Window2,';y2:') "/>
+ <xsl:variable name="x1">
+ <xsl:choose>
+ <xsl:when test="$w1x1 &gt; $w2x1">
+ <xsl:value-of select="$w2x1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w1x1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y1">
+ <xsl:choose>
+ <xsl:when test="$w1y1 &gt; $w2y1">
+ <xsl:value-of select="$w2y1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w1y1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="x2">
+ <xsl:choose>
+ <xsl:when test="$w1x2 &gt; $w2x2">
+ <xsl:value-of select="$w1x2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w2x2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y2">
+ <xsl:choose>
+ <xsl:when test="$w1y2 &gt; $w2y2">
+ <xsl:value-of select="$w1y2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$w2y2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('x1:' , $x1 , ';y1:' , $y1 , ';x2:' , $x2, ';y2:' , $y2)"/>
+ </xsl:template>
+ <!-- convert percent value to x% numeric x/100 -->
+ <xsl:template name="ValueOfPercent">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, '%')">
+ <xsl:value-of select="substring-before($value, '%') div 100"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="points2points">
+ <xsl:param name="input_points"/>
+ <xsl:param name="input_x"/>
+ <xsl:param name="input_y"/>
+ <xsl:param name="input_width"/>
+ <xsl:param name="input_height"/>
+ <xsl:param name="input_boxwidth"/>
+ <xsl:param name="input_boxheight"/>
+ <xsl:variable name="onepoint" select="substring($input_points,1,string-length($input_points) - string-length(substring-after($input_points,' ')) )"/>
+ <xsl:if test="substring-before($input_points,' ')">
+ <xsl:value-of select="round($input_x + (($input_boxwidth - number(substring-before($onepoint,','))) ) * $input_width div $input_boxwidth)"/>
+ <xsl:value-of select="'pt,'"/>
+ <xsl:value-of select="round($input_y + ((number(substring-after($onepoint,',')) ) ) * $input_height div $input_boxheight)"/>
+ <xsl:value-of select="'pt'"/>
+ </xsl:if>
+ <xsl:if test="string-length(substring($input_points,string-length($onepoint) + 1)) &gt; 0">
+ <xsl:value-of select="','"/>
+ <xsl:call-template name="points2points">
+ <xsl:with-param name="input_points" select="substring($input_points,string-length($onepoint) + 1)"/>
+ <xsl:with-param name="input_x" select="$input_x"/>
+ <xsl:with-param name="input_y" select="$input_y"/>
+ <xsl:with-param name="input_width" select="$input_width"/>
+ <xsl:with-param name="input_height" select="$input_height"/>
+ <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/>
+ <xsl:with-param name="input_boxheight" select="$input_boxheight"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="path2path">
+ <xsl:param name="input_points"/>
+ <xsl:param name="x_or_y" select="'x'"/>
+ <xsl:param name="input_x"/>
+ <xsl:param name="input_y"/>
+ <xsl:param name="input_width"/>
+ <xsl:param name="input_height"/>
+ <xsl:param name="input_boxwidth"/>
+ <xsl:param name="input_boxheight"/>
+ <xsl:variable name="space-pos" select="string-length($input_points) - string-length(substring-after($input_points,' '))"/>
+ <xsl:variable name="minus-pos" select="string-length($input_points) - string-length(substring-after($input_points,'-'))"/>
+ <xsl:variable name="m-pos" select="string-length($input_points) - string-length(substring-after($input_points,'m'))"/>
+ <xsl:variable name="c-pos" select="string-length($input_points) - string-length(substring-after($input_points,'c'))"/>
+ <xsl:variable name="e-pos" select="string-length($input_points) - string-length(substring-after($input_points,'e'))"/>
+ <xsl:variable name="min1">
+ <xsl:choose>
+ <xsl:when test="$space-pos &lt; $minus-pos">
+ <xsl:value-of select="$space-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minus-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min2">
+ <xsl:choose>
+ <xsl:when test="$m-pos &lt; $min1">
+ <xsl:value-of select="$m-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$min1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min3">
+ <xsl:choose>
+ <xsl:when test="$c-pos &lt; $min2">
+ <xsl:value-of select="$c-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$min2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min4">
+ <xsl:choose>
+ <xsl:when test="$e-pos &lt; $min3">
+ <xsl:value-of select="$e-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$min3"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="min-special-char-pos" select="$min4"/>
+ <xsl:variable name="special-char" select="substring($input_points,$min-special-char-pos,1)"/>
+ <xsl:variable name="one-value" select="substring($input_points,1,$min-special-char-pos - 1)"/>
+ <xsl:variable name="left-points" select="substring($input_points,$min-special-char-pos + 1)"/>
+ <xsl:if test="not($special-char = 'm')">
+ <xsl:if test="$x_or_y = 'x'">
+ <xsl:value-of select="round($input_x + $one-value * $input_width div $input_boxwidth)"/>
+ </xsl:if>
+ <xsl:if test="$x_or_y = 'y'">
+ <xsl:value-of select="round($input_y + $one-value * $input_height div $input_boxheight)"/>
+ </xsl:if>
+ </xsl:if>
+ <!-- output the separator-->
+ <xsl:choose>
+ <xsl:when test="$special-char = '-' or $special-char = ' ' ">
+ <xsl:value-of select="','"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$special-char"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="next-xy">
+ <xsl:if test="$x_or_y = 'x'">
+ <xsl:value-of select="'y'"/>
+ </xsl:if>
+ <xsl:if test="$x_or_y = 'y'">
+ <xsl:value-of select="'x'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="string-length($left-points) &gt; 0">
+ <xsl:call-template name="path2path">
+ <xsl:with-param name="input_points" select="$left-points"/>
+ <xsl:with-param name="x_or_y" select="$next-xy"/>
+ <xsl:with-param name="input_x" select="$input_x"/>
+ <xsl:with-param name="input_y" select="$input_y"/>
+ <xsl:with-param name="input_width" select="$input_width"/>
+ <xsl:with-param name="input_height" select="$input_height"/>
+ <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/>
+ <xsl:with-param name="input_boxheight" select="$input_boxheight"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get_dashstyle">
+ <xsl:param name="stroke-width" select="0.1"/>
+ <xsl:param name="style-name" select="@draw:style-name"/>
+ <xsl:variable name="graph-style" select="key('graphics-style', $style-name)/style:graphic-properties"/>
+ <xsl:variable name="dash-style" select="key('stroke-dash-style', $graph-style/@draw:stroke-dash)"/>
+ <xsl:variable name="stroke">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:stroke">
+ <xsl:value-of select="$graph-style/@draw:stroke"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:stroke">
+ <xsl:value-of select="$dash-style/@draw:stroke"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$stroke = 'solid' ">
+ <xsl:value-of select="$stroke"/>
+ </xsl:when>
+ <xsl:when test="$stroke = 'dash'">
+ <xsl:variable name="dots1">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots1">
+ <xsl:value-of select="$graph-style/@draw:dots1"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots1">
+ <xsl:value-of select="$dash-style/@draw:dots1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dots2">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots1">
+ <xsl:value-of select="$graph-style/@draw:dots2"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots1">
+ <xsl:value-of select="$dash-style/@draw:dots2"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dots1-length">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots1-length">
+ <xsl:value-of select="$graph-style/@draw:dots1-length"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots1-length">
+ <xsl:value-of select="$dash-style/@draw:dots1-length"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dots2-length">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:dots2-length">
+ <xsl:value-of select="$graph-style/@draw:dots2-length"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:dots2-length">
+ <xsl:value-of select="$dash-style/@draw:dots2-length"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="distance">
+ <xsl:choose>
+ <xsl:when test="$graph-style/@draw:distance">
+ <xsl:value-of select="$graph-style/@draw:distance"/>
+ </xsl:when>
+ <xsl:when test="$dash-style/@draw:distance">
+ <xsl:value-of select="$dash-style/@draw:distance"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot1-step">
+ <xsl:choose>
+ <xsl:when test="contains($dots1-length,'%')">
+ <xsl:variable name="dots-percent">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="$dots1-length"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round($dots-percent)"/>
+ </xsl:when>
+ <xsl:when test="contains($dots1-length , 'in' ) and $stroke-width &gt; 0">
+ <xsl:value-of select="round( number(substring-before($dots1-length,'in' )) div $stroke-width )"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot2-step">
+ <xsl:choose>
+ <xsl:when test="contains($dots2-length,'%')">
+ <xsl:variable name="dots-percent">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="$dots2-length"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round($dots-percent)"/>
+ </xsl:when>
+ <xsl:when test="contains($dots2-length,'in') and $stroke-width &gt; 0">
+ <xsl:value-of select="round(number(substring-before($dots2-length,'in')) div $stroke-width)"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="distance-step">
+ <xsl:choose>
+ <xsl:when test="contains($distance,'%')">
+ <xsl:variable name="dots-percent">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="$distance"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round($dots-percent)"/>
+ </xsl:when>
+ <xsl:when test="contains($distance,'in') and $stroke-width &gt; 0">
+ <xsl:value-of select="round(number(substring-before($distance,'in')) div $stroke-width)"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dashstyle">
+ <xsl:choose>
+ <xsl:when test="$dots1 = 1 and $dots2 = 1 and $dot1-step = 0 and $dot2-step = 0 and $distance-step = 0">
+ <xsl:value-of select="'ShortDot'"/>
+ </xsl:when>
+ <xsl:when test="$dots2 = 0 and $dot1-step = 0 and $dot2-step = 0 and $distance-step &gt; 0">
+ <xsl:value-of select="concat('0 ', $distance-step)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create_dashstyle">
+ <xsl:with-param name="dot-count" select="$dots1"/>
+ <xsl:with-param name="dot-step" select="$dot1-step"/>
+ <xsl:with-param name="distance-step" select="$distance-step"/>
+ </xsl:call-template>
+ <xsl:value-of select="' '"/>
+ <xsl:call-template name="create_dashstyle">
+ <xsl:with-param name="dot-count" select="$dots2"/>
+ <xsl:with-param name="dot-step" select="$dot2-step"/>
+ <xsl:with-param name="distance-step" select="$distance-step"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$dashstyle"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create_dashstyle">
+ <xsl:param name="dot-count"/>
+ <xsl:param name="dot-step"/>
+ <xsl:param name="distance-step"/>
+ <xsl:if test="$dot-count &gt; 0">
+ <xsl:value-of select="concat($dot-step, ' ' , $distance-step )"/>
+ <xsl:if test="$dot-count - 1 &gt; 0">
+ <xsl:value-of select="' '"/>
+ <xsl:call-template name="create_dashstyle">
+ <xsl:with-param name="dot-count" select="$dot-count - 1"/>
+ <xsl:with-param name="dot-step" select="$dot-step"/>
+ <xsl:with-param name="distance-step" select="$distance-step"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get_borderstyle">
+ <xsl:param name="border"/>
+ <xsl:param name="border-line-width"/>
+ <xsl:choose>
+ <xsl:when test="contains($border,'solid')">
+ <xsl:variable name="strokeweight">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before($border, ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat ( 'strokeweight:', $strokeweight)"/>
+ </xsl:when>
+ <xsl:when test="contains($border,'double')">
+ <xsl:variable name="outside">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after(substring-after($border-line-width, ' ') , ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inside">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before($border-line-width, ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="space">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(substring-after($border-line-width, ' ') , ' ')"/>
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="linestyle">
+ <xsl:choose>
+ <xsl:when test="$outside = $inside">
+ <xsl:value-of select="'thinThin'"/>
+ </xsl:when>
+ <xsl:when test="$outside &gt; $inside">
+ <xsl:value-of select="'thickThin'"/>
+ </xsl:when>
+ <xsl:when test="$outside &lt; $inside">
+ <xsl:value-of select="'thinThick'"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="strokeweight" select="$inside + $outside + $space"/>
+ <xsl:value-of select="concat( 'linestyle:' , $linestyle , ';' , 'strokeweight:' , $strokeweight )"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="DrawElements">
+ <xsl:param name="TargetMeasure" select="pt"/>
+ <xsl:param name="x-adjust" select="0"/>
+ <xsl:param name="y-adjust" select="0"/>
+ <xsl:param name="force-draw" select="'false'"/>
+ <xsl:param name="shape-type"/>
+ <xsl:variable name="MeasureMark">
+ <xsl:choose>
+ <xsl:when test="$TargetMeasure = 'twip'"/>
+ <xsl:otherwise>
+ <xsl:value-of select="$TargetMeasure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="drawtextstyle" select="@draw:text-style-name"/>
+ <xsl:variable name="org-z-index">
+ <xsl:choose>
+ <xsl:when test="@draw:z-index">
+ <xsl:value-of select="number(concat('0',@draw:z-index))"/>
+ </xsl:when>
+ <xsl:when test="parent::draw:frame/@draw:z-index">
+ <xsl:value-of select="number(concat('0',parent::draw:frame/@draw:z-index))"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="run-though" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:run-through"/>
+ <xsl:variable name="org-wrap" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:wrap"/>
+ <xsl:variable name="draw-name">
+ <xsl:choose>
+ <xsl:when test="string-length(@draw:name) = 0">
+ <xsl:value-of select="translate(ancestor::draw:frame[1]/@draw:name, ':/', '__')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@draw:name, ':/', '__')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="style_name2key">
+ <xsl:choose>
+ <xsl:when test="@draw:style-name">
+ <xsl:value-of select="@draw:style-name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="ancestor::draw:frame/@draw:style-name">
+ <xsl:value-of select="ancestor::draw:frame/@draw:style-name"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="draw-fill-type" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill"/>
+ <xsl:variable name="draw-gradient-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-gradient-name"/>
+ <xsl:variable name="horizontal-pos" select="key('graphics-style', $style_name2key)/style:graphic-properties/@style:horizontal-pos"/>
+ <!--horizontal-pos attribute is for the placement of all the drawing elements-->
+ <xsl:variable name="fill-image-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-image-name"/>
+ <xsl:if test="$draw-fill-type = 'bitmap' ">
+ <xsl:element name="w:binData">
+ <xsl:attribute name="w:name">
+ <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/>
+ </xsl:attribute>
+ <xsl:value-of select="translate(key('fill-image',$fill-image-name)/office:binary-data/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ <!-- xsl:value-of select="office:binary-data/text()"/ -->
+ </xsl:element>
+ </xsl:if>
+ <xsl:variable name="z-index">
+ <xsl:choose>
+ <xsl:when test="$run-though='foreground'">
+ <!-- make sure z-index >=0 -->
+ <xsl:choose>
+ <xsl:when test="$org-z-index &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-z-index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$run-though='background'">
+ <!-- make sure z-index < 0 -->
+ <xsl:choose>
+ <xsl:when test="$org-z-index &lt; 0">
+ <xsl:value-of select="$org-z-index"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-z-index - 10"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="wrap">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char' ">none</xsl:when>
+ <xsl:when test="$org-wrap='dynamic'">tight</xsl:when>
+ <xsl:when test="$org-wrap='parallel'">square</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ooshapename" select="substring-after(name(),':')"/>
+ <xsl:variable name="element-name">
+ <xsl:choose>
+ <xsl:when test="$ooshapename='rect'">v:rect</xsl:when>
+ <xsl:when test="$ooshapename='ellipse' and not(string-length(@draw:kind) &gt; 0)">v:oval</xsl:when>
+ <xsl:when test="$ooshapename='ellipse' and string-length(@draw:kind) &gt; 0">v:arc</xsl:when>
+ <xsl:when test="$ooshapename='circle' and string-length(@draw:kind) &gt; 0">v:arc</xsl:when>
+ <xsl:when test="$ooshapename='line'">v:line</xsl:when>
+ <xsl:when test="$ooshapename='polyline'">v:polyline</xsl:when>
+ <xsl:when test="$ooshapename='polygon'">v:polyline</xsl:when>
+ <xsl:when test="$ooshapename='text-box'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='image'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='frame'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='path'">v:shape</xsl:when>
+ <!-- This caption is not the "Caption", it's GUI name is Callouts-->
+ <xsl:when test="$ooshapename='caption'">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive' ">v:shape</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'round-rectangle' ">v:roundrect</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'rectangle' ">v:rect</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'ellipse' ">v:oval</xsl:when>
+ <xsl:when test="$ooshapename='custom-shape'">v:shape</xsl:when>
+ <!-- some wild guess -->
+ <xsl:otherwise>v:shape</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="ms-shape-type">
+ <xsl:choose>
+ <xsl:when test="string-length($shape-type) &gt; 0">
+ <xsl:value-of select="$shape-type"/>
+ </xsl:when>
+ <xsl:when test="$ooshapename='custom-shape' ">
+ <xsl:call-template name="ooo_custom_draw2ms_word_draw_map">
+ <xsl:with-param name="ooo_predefined_type" select="draw:enhanced-geometry[1]/@draw:predefined-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="real-x-adjust">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat($x-adjust,'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="real-y-adjust">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat($y-adjust,'in')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:y"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pagemaster" select="key('master-page','Standard')/@style:page-layout-name"/>
+ <xsl:variable name="leftmargin-pt">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="topmargin-pt">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- addjust the x and y values of the page archored objects-->
+ <xsl:variable name="x">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-x + $real-x-adjust - $leftmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-x + $real-x-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-y + $real-y-adjust - $topmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-y + $real-y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:variable name="width-tmp">
+ <xsl:choose>
+ <xsl:when test="@svg:width">
+ <xsl:value-of select="@svg:width"/>
+ </xsl:when>
+ <xsl:when test="not(string-length(parent::draw:frame/@svg:width) = 0)">
+ <xsl:value-of select="parent::draw:frame/@svg:width"/>
+ </xsl:when>
+ <xsl:when test="string-length(@svg:width) = 0 and ancestor::draw:frame">
+ <xsl:value-of select="ancestor::draw:frame/@svg:width"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="$width-tmp"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height">
+ <xsl:choose>
+ <xsl:when test="@svg:height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:height"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not(string-length(parent::draw:frame/@svg:height) = 0)">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="parent::draw:frame/@svg:height"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="@fo:min-height and string-length(text:p/text()) = 0 and not(text:p/draw:*)">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="borderstyle">
+ <xsl:call-template name="get_borderstyle">
+ <xsl:with-param name="border" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border"/>
+ <xsl:with-param name="border-line-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:border-line-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="stroke-weight-in-inch" select="number(concat('0',translate(key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width ,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))"/>
+ <xsl:variable name="stroke-weight">
+ <xsl:choose>
+ <xsl:when test="contains($borderstyle , 'strokeweight')">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="concat( substring-after($borderstyle, 'strokeweight:') , 'pt')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="linestyle">
+ <xsl:if test="contains($borderstyle , 'strokeweight')">
+ <xsl:value-of select="substring-before( substring-after($borderstyle, 'linestyle:') , ';strokeweight')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="stroked">
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:stroke = 'none'">
+ <xsl:value-of select="'f'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="dashstyle">
+ <xsl:call-template name="get_dashstyle">
+ <xsl:with-param name="stroke-width" select="$stroke-weight-in-inch"/>
+ <xsl:with-param name="style-name" select="@draw:style-name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="start-arrow">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:call-template name="MapArrowStyle">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-arrow">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start">
+ <xsl:call-template name="MapArrowStyle">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="start-arrow-length">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:call-template name="GetArrowLength">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="start-arrow-width">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end">
+ <xsl:call-template name="GetArrowWidth">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-arrow-length">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start">
+ <xsl:call-template name="GetArrowLength">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-arrow-width">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start">
+ <xsl:call-template name="GetArrowWidth">
+ <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/>
+ <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="stroke-color">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color">
+ <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"/>
+ </xsl:when>
+ <xsl:when test="contains(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#')">
+ <xsl:value-of select="concat('#', substring-after(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#') )"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="stroke-opacity">
+ <xsl:call-template name="ValueOfPercent">
+ <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-opacity"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="fill-color">
+ <xsl:choose>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color">
+ <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"/>
+ </xsl:when>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style">black</xsl:when>
+ <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill = 'none'"/>
+ <xsl:when test="$draw-fill-type = 'gradient' ">
+ <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:end-color "/>
+ </xsl:when>
+ <!-- for these need fill, set the default color we used in oo-->
+ <xsl:when test="name()='draw:polygon' or name()='draw:custom-shape' or name() = 'draw:rect' or (name() = 'draw:ellipse' and not( @draw:kind='arc') )">#00B8FF</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="position">
+ <xsl:value-of select="concat('left:', $x ,$MeasureMark , ';top:' , $y ,$MeasureMark , ';width:', $width ,$MeasureMark )"/>
+ <xsl:if test="not($height = 0)">
+ <xsl:value-of select="concat(';height:', $height ,$MeasureMark )"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="flip">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char' and $ooshapename='line'"/>
+ <xsl:when test="$ooshapename='image'"/>
+ <xsl:when test="$ooshapename='path'"/>
+ <xsl:when test="$ooshapename='caption'"/>
+ <xsl:when test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"/>
+ <xsl:when test="$ooshapename='custom-shape'"/>
+ <xsl:otherwise>flip:x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="absolute">
+ <xsl:choose>
+ <xsl:when test="ancestor::draw:a"/>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/>
+ <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'"/>
+ <xsl:otherwise>position:absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="anchorlock">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">has</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- start line special -->
+ <xsl:variable name="org-x1">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:x1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-y1">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:y1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-x2">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:x2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="org-y2">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="value" select="@svg:y2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x1">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-x1 + $real-x-adjust - $leftmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-x1 + $real-x-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y1">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-y1 + $real-y-adjust - $topmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-y1 + $real-y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="x2">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-x2 + $real-x-adjust - $leftmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-x2 + $real-x-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="y2">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'">
+ <xsl:value-of select="$org-y2 + $real-y-adjust - $topmargin-pt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$org-y2 + $real-y-adjust"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- end line special -->
+ <xsl:variable name="relative">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when>
+ <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="style">
+ <xsl:choose>
+ <xsl:when test="$wrap='none'"/>
+ <xsl:otherwise>
+ <xsl:if test="string-length($absolute) &gt; 0">
+ <xsl:value-of select="concat($absolute, ';')"/>
+ </xsl:if>
+ <xsl:value-of select="concat('z-index:', $z-index, ';')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="string-length($flip) &gt; 0">
+ <xsl:value-of select="concat($flip,';')"/>
+ </xsl:if>
+ <xsl:if test="not($ooshapename = 'line')">
+ <xsl:value-of select="concat($position,';')"/>
+ </xsl:if>
+ <xsl:if test="ancestor::draw:frame and name()='draw:text-box'">
+ <xsl:if test="string-length($horizontal-pos) &gt; 0">
+ <xsl:value-of select="concat('mso-position-horizontal:',$horizontal-pos,';')"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="string-length($relative) &gt; 0">
+ <xsl:value-of select="concat($relative,';')"/>
+ </xsl:if>
+ </xsl:variable>
+ <!-- image special: convert oo base64 binary data (77char/line) to word base64 binary data(73char/line) , a workthrough is removing all line breaks -->
+ <xsl:if test="$ooshapename = 'image'">
+ <xsl:element name="w:binData">
+ <xsl:attribute name="w:name">
+ <xsl:value-of select="concat( 'wordml://', $draw-name )"/>
+ </xsl:attribute>
+ <xsl:value-of select="translate(office:binary-data/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ <!-- xsl:value-of select="office:binary-data/text()"/ -->
+ </xsl:element>
+ </xsl:if>
+ <!-- all element goes here -->
+ <xsl:variable name="id">
+ <xsl:choose>
+ <xsl:when test="$ooshapename='line'">
+ <xsl:value-of select="concat('_x',$x1 , '_' ,$y1, '_' , $x2, '_' ,$y2 )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('_x',$x , '_' ,$y, '_' , $width, '_' ,$height )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$element-name}">
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id"/>
+ </xsl:attribute>
+ <xsl:if test="string-length($ms-shape-type) &gt; 0">
+ <xsl:attribute name="type">
+ <xsl:value-of select="$ms-shape-type"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:value-of select="$style"/>
+ </xsl:attribute>
+ <xsl:if test="$stroke-weight &gt; 0">
+ <xsl:attribute name="strokeweight">
+ <xsl:value-of select="concat($stroke-weight,$MeasureMark)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($stroked) &gt; 0">
+ <xsl:attribute name="stroked">
+ <xsl:value-of select="$stroked"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($stroke-color) &gt; 0">
+ <xsl:attribute name="strokecolor">
+ <xsl:value-of select="$stroke-color"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($fill-color) &gt; 0">
+ <xsl:attribute name="fillcolor">
+ <xsl:value-of select="$fill-color"/>
+ </xsl:attribute>
+ <xsl:attribute name="filled">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="parent::draw:frame/draw:object-ole[1]">
+ <xsl:attribute name="filled">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($stroke-opacity) &gt; 0">
+ <xsl:attribute name="opacity">
+ <xsl:value-of select="$stroke-opacity"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- arc special attribute -->
+ <xsl:if test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'">
+ <xsl:choose>
+ <xsl:when test="@draw:start-angle &gt; @draw:end-angle">
+ <xsl:attribute name="startangle">
+ <xsl:value-of select="round( 450 - (@draw:end-angle + 360) )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="startangle">
+ <xsl:value-of select="round( 450 - @draw:end-angle )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="endangle">
+ <xsl:value-of select="round(450 - @draw:start-angle)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@draw:kind = 'cut'">
+ <xsl:attribute name="fill">
+ <xsl:value-of select="'true'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end arc special attribute -->
+ <!-- line special attribute-->
+ <xsl:if test="$ooshapename='line'">
+ <xsl:attribute name="from">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char'">0,0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($x1,$MeasureMark, ',',$y2,$MeasureMark )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="to">
+ <xsl:choose>
+ <xsl:when test="@text:anchor-type='as-char'">
+ <xsl:value-of select="concat($x2,$MeasureMark ,',',$y2,$MeasureMark )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($x2,$MeasureMark ,',' ,$y1,$MeasureMark)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end line special attribute-->
+ <!-- polyline and polygon special attribute-->
+ <xsl:if test="$ooshapename='polyline' or $ooshapename='polygon' ">
+ <!-- translate ' ' to in ' tranclate ',' to 'in,' -->
+ <xsl:variable name="points">
+ <xsl:call-template name="points2points">
+ <xsl:with-param name="input_x" select="$x"/>
+ <xsl:with-param name="input_y" select="$y"/>
+ <xsl:with-param name="input_width" select="$width"/>
+ <xsl:with-param name="input_height" select="$height"/>
+ <xsl:with-param name="input_boxwidth" select="substring-before(substring-after(@svg:viewBox,'0 0 '),' ')"/>
+ <xsl:with-param name="input_boxheight" select="substring-after(substring-after(@svg:viewBox,'0 0 '),' ')"/>
+ <xsl:with-param name="input_points" select="concat(@draw:points,' ')"/>
+ <!-- add a space to the end of input_points -->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="points">
+ <xsl:value-of select="$points"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end polyline and polygon special attribute-->
+ <!-- callouts special attribute-->
+ <xsl:if test="$ooshapename='caption'">
+ <xsl:variable name="caption-point-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="value" select="@draw:caption-point-x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="caption-point-y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="value" select="@draw:caption-point-y"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="type">
+ <!-- map to word line label 3-->
+ <xsl:value-of select="'#_x0000_t48'"/>
+ </xsl:attribute>
+ <xsl:attribute name="adj">
+ <xsl:value-of select=" concat($caption-point-x * 20 , ',' , $caption-point-y * 20 , ',' , $caption-point-x * 10 , ',,,,' , $caption-point-x * 20, ',' , $caption-point-y * 20) "/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end callouts special attribute-->
+ <!-- path special attribute-->
+ <xsl:if test="$ooshapename='path' or string-length(@svg:d) &gt; 0 or ( $ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive') ">
+ <xsl:variable name="path">
+ <xsl:choose>
+ <xsl:when test="$ooshapename='path' or string-length(@svg:d) &gt; 0 ">
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="@svg:d"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="draw:enhanced-geometry[1]/@draw:enhanced-path"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="coordorigin">
+ <xsl:value-of select=" '0 0' "/>
+ </xsl:attribute>
+ <xsl:attribute name="coordsize">
+ <xsl:choose>
+ <xsl:when test="string-length(@svg:viewBox) &gt; 0 ">
+ <xsl:value-of select="substring-after(@svg:viewBox,'0 0 ')"/>
+ </xsl:when>
+ <xsl:when test="string-length(draw:enhanced-geometry[1]/@svg:viewBox) &gt; 0 ">
+ <xsl:value-of select="substring-after(draw:enhanced-geometry[1]/@svg:viewBox,'0 0 ')"/>
+ </xsl:when>
+ <!-- for custom shape use a default viewbox. right? -->
+ <xsl:otherwise>
+ <xsl:value-of select=" '21600 21600' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="path">
+ <xsl:value-of select="$path"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- end path special attribute-->
+ <!-- image special element -->
+ <xsl:if test="$ooshapename='image'">
+ <xsl:element name="v:imagedata">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat('wordml://', $draw-name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="o:title">
+ <xsl:value-of select="$draw-name"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!-- end image special element -->
+ <!-- start dash style , line style and arrow style-->
+ <xsl:if test="string-length($dashstyle) &gt; 0 or string-length($linestyle) &gt; 0 or string-length($start-arrow) &gt; 0 or string-length($end-arrow) &gt; 0 ">
+ <xsl:element name="v:stroke">
+ <xsl:if test="string-length($dashstyle) &gt; 0">
+ <xsl:attribute name="dashstyle">
+ <xsl:value-of select="$dashstyle"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($linestyle) &gt; 0">
+ <xsl:attribute name="linestyle">
+ <xsl:value-of select="$linestyle"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($start-arrow) &gt; 0 ">
+ <xsl:attribute name="startarrow">
+ <xsl:value-of select="$start-arrow"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($end-arrow) &gt; 0 ">
+ <xsl:attribute name="endarrow">
+ <xsl:value-of select="$end-arrow"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($start-arrow-length) &gt; 0 ">
+ <xsl:attribute name="startarrowlength">
+ <xsl:value-of select="$start-arrow-length"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($start-arrow-width) &gt; 0 ">
+ <xsl:attribute name="startarrowwidth">
+ <xsl:value-of select="$start-arrow-width"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($end-arrow-length) &gt; 0 ">
+ <xsl:attribute name="endarrowlength">
+ <xsl:value-of select="$end-arrow-length"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($end-arrow-width) &gt; 0 ">
+ <xsl:attribute name="endarrowwidth">
+ <xsl:value-of select="$end-arrow-width"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <!-- end dash style , line style and arrow style -->
+ <!-- start wrap type -->
+ <xsl:if test="string-length($wrap) &gt; 0">
+ <xsl:element name="w10:wrap">
+ <xsl:attribute name="type">
+ <xsl:value-of select="$wrap"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <!-- end wrap type -->
+ <!-- start anchor to char specific element -->
+ <xsl:if test="string-length($anchorlock) &gt; 0">
+ <xsl:element name="w10:anchorlock"/>
+ </xsl:if>
+ <!-- end wrap type -->
+ <!-- start fill image -->
+ <xsl:if test="string-length($draw-fill-type ) &gt; 0">
+ <xsl:element name="v:fill">
+ <xsl:choose>
+ <xsl:when test="$draw-fill-type = 'bitmap'">
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="o:titile">
+ <xsl:value-of select="$fill-image-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="recolor">
+ <xsl:value-of select=" 'true' "/>
+ </xsl:attribute>
+ <xsl:attribute name="rotate">
+ <xsl:value-of select=" 'true' "/>
+ </xsl:attribute>
+ <xsl:attribute name="type">
+ <xsl:value-of select=" 'frame' "/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$draw-fill-type = 'gradient'">
+ <xsl:attribute name="type">
+ <xsl:value-of select=" 'gradient' "/>
+ </xsl:attribute>
+ <xsl:attribute name="color2">
+ <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:start-color "/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <!-- end fill image -->
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style">
+ <xsl:call-template name="FontWork"/>
+ </xsl:if>
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:shadow = 'visible'">
+ <xsl:call-template name="Shadow"/>
+ </xsl:if>
+ <!-- only draw:g can have child graphic -->
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:g'">
+ <xsl:apply-templates select="draw:*">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="text:*/* | text:*/text()">
+ <xsl:element name="v:textbox">
+ <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:writing-mode = 'tb-rl'">
+ <xsl:attribute name="style">
+ <xsl:value-of select="'layout-flow:vertical'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <w:txbxContent>
+ <xsl:apply-templates select="text() | text:*"/>
+ </w:txbxContent>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:apply-templates select="parent::draw:frame/draw:object-ole" mode="output">
+ <xsl:with-param name="ShapeID" select="$id"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template name="Shadow">
+ <xsl:element name="v:shadow">
+ <xsl:variable name="key-node" select="key('graphics-style', @draw:style-name)/style:graphic-properties"/>
+ <xsl:attribute name="on">true</xsl:attribute>
+ <xsl:attribute name="offset">
+ <xsl:value-of select="concat($key-node/@draw:shadow-offset-x,',' , $key-node/@draw:shadow-offset-y)"/>
+ </xsl:attribute>
+ <xsl:attribute name="color">
+ <xsl:value-of select="$key-node/@draw:shadow-color"/>
+ </xsl:attribute>
+ <xsl:attribute name="opacity">
+ <xsl:value-of select="$key-node/@draw:shadow-opacity"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="FontWork">
+ <xsl:element name="v:path">
+ <xsl:attribute name="textpathok">true</xsl:attribute>
+ </xsl:element>
+ <xsl:if test="not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow) or not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow = 'normal')">
+ <xsl:element name="v:shadow">
+ <xsl:attribute name="on">true</xsl:attribute>
+ <xsl:attribute name="type">perspective</xsl:attribute>
+ <xsl:attribute name="color">
+ <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-color"/>
+ </xsl:attribute>
+ <xsl:variable name="offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'twip'"/>
+ <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-x"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="offset-y" select="substring-before(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-y, 'in')"/>
+ <xsl:attribute name="matrix">
+ <xsl:value-of select="concat(',,,' , round($offset-y div 0.000693) div 100, ',,')"/>
+ </xsl:attribute>
+ <xsl:attribute name="origin">-30%, -30%</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="v:textpath">
+ <xsl:attribute name="on">true</xsl:attribute>
+ <xsl:attribute name="fitpath">true</xsl:attribute>
+ <xsl:attribute name="fitshape">true</xsl:attribute>
+ <xsl:attribute name="style">
+ <xsl:choose>
+ <xsl:when test="key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family">
+ <xsl:value-of select="concat('font-family:&quot;' , key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family , '&quot;') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="default-graphics-properties" select="/office:document/office:styles/style:default-style[@style:family = 'graphics']/style:graphic-properties"/>
+ <xsl:value-of select="concat('font-family:&quot;' , $default-graphics-properties/@style:font-name , '&quot;') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="string">
+ <xsl:value-of select="text:p"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="MapArrowStyle">
+ <xsl:param name="arrow-name"/>
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'Arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Square' ">Diamond</xsl:when>
+ <xsl:when test="$arrow-name = 'Small arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Dimension lines' ">Diamond</xsl:when>
+ <xsl:when test="$arrow-name = 'Double Arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Rounded short arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Symmetric arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Line Arrow' ">Open</xsl:when>
+ <xsl:when test="$arrow-name = 'Rounded large arrow' ">Block</xsl:when>
+ <xsl:when test="$arrow-name = 'Circle' ">Oval</xsl:when>
+ <xsl:when test="$arrow-name = 'Square 45' ">Diamond</xsl:when>
+ <xsl:when test="$arrow-name = 'Arrow concave' ">Classic</xsl:when>
+ <xsl:otherwise>Block</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetArrowLength">
+ <xsl:param name="arrow-name"/>
+ <xsl:param name="arrow-width"/>
+ <xsl:variable name="arrow-size">
+ <xsl:choose>
+ <xsl:when test="$arrow-width">
+ <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/>
+ </xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$arrow-size &gt; 2">Long</xsl:when>
+ <xsl:when test="$arrow-size &gt; 1">Medium</xsl:when>
+ <xsl:when test="$arrow-size &gt; 0">Short</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="GetArrowWidth">
+ <xsl:param name="arrow-name"/>
+ <xsl:param name="arrow-width"/>
+ <xsl:variable name="arrow-size">
+ <xsl:choose>
+ <xsl:when test="$arrow-width">
+ <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/>
+ </xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$arrow-size &gt; 2">Wide</xsl:when>
+ <xsl:when test="$arrow-size &gt; 1">Medium</xsl:when>
+ <xsl:when test="$arrow-size &gt; 0">Narrow</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="ConvertMeasure">
+ <xsl:param name="TargetMeasure" select="'cm'"/>
+ <xsl:param name="TargetTruncate" select=" 'all' "/>
+ <xsl:param name="value"/>
+ <!-- When TargetTruncate ='all' it returns the number whichsoever the return value is negative or positive
+ When TargetTruncate ='nonNegative' it only returns nonNegative number, all negative number to be returned as 0
+ When TargetTruncate ='positive" it only returns positive number, all nonPositive number to be returned as 1 -->
+ <xsl:variable name="return_value">
+ <xsl:choose>
+ <!-- remove the measure mark, if the value is null, the result should be 0. Must be the first case -->
+ <xsl:when test="string-length(translate(string($value),'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ','')) = 0">0</xsl:when>
+ <xsl:when test="string-length(translate(string($value),'- .0123456789','')) = 0">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'cm'">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'pt'">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'twip'">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'in'">
+ <xsl:call-template name="convert2in">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$TargetTruncate = 'all' ">
+ <xsl:choose>
+ <xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'nonNegative' ">
+ <xsl:choose>
+ <xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt; 0 ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'positive' ">
+ <xsl:choose>
+ <xsl:when test="string(number($TargetMeasure)) = 'NaN' ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt;= 0 ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Add-With-Measure">
+ <xsl:param name="value1"/>
+ <xsl:param name="value2"/>
+ <xsl:param name="TargetMeasure" select="'in'"/>
+ <xsl:variable name="number-value1">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$value1"/>
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number-value2">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$value2"/>
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$number-value1 + $number-value2"/>
+ </xsl:template>
+ <xsl:template name="export-oledata">
+ <xsl:if test="//draw:object-ole[1]">
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:init')">
+ <oleextracter:init UNOURL="uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ole:init($XMultiServiceFactory, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="//draw:object-ole" mode="oledata.mso"/>
+ <w:docOleData>
+ <w:binData w:name="oledata.mso">
+ <xsl:if test="function-available('ole:getByName')">
+ <xsl:value-of select="translate(ole:getByName($oleExtractor, 'oledata.mso'),'&#10;&#13;&#32;','')"/>
+ </xsl:if>
+ </w:binData>
+ </w:docOleData>
+ <xsl:if test="function-available('ole:exit')">
+ <xsl:value-of select="ole:exit($oleExtractor)"/>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="draw:object-ole" mode="oledata.mso">
+ <xsl:variable name="stream-name">
+ <xsl:apply-templates select="." mode="get-number"/>
+ </xsl:variable>
+ <xsl:variable name="tmp" select="ole:insertByName($oleExtractor, $stream-name, translate(office:binary-data/text(),'&#10;&#13;&#32;','' ) )"/>
+ </xsl:template>
+ <xsl:template match="draw:object-ole" mode="output">
+ <xsl:param name="ShapeID"/>
+ <xsl:variable name="stream-name">
+ <xsl:apply-templates select="." mode="get-number"/>
+ </xsl:variable>
+ <o:OLEObject Type="Embed" DrawAspect="Content" ObjectID="{$stream-name}" ShapeID="{$ShapeID}" ProgID=""/>
+ </xsl:template>
+ <xsl:template match="draw:object-ole" mode="get-number">
+ <xsl:number from="/office:document" level="any" count="draw:object-ole" format="1"/>
+ </xsl:template>
+ <xsl:template match="draw:object-ole"/>
+ <xalan:component prefix="oleextracter" elements="init exit" functions="getByName insertByName">
+ <xalan:script lang="javaclass" src="xalan://XSLTFilterOLEExtracter"/>
+ </xalan:component>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_field.xsl b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl
new file mode 100644
index 000000000000..11538b0b2f10
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl
@@ -0,0 +1,737 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_field.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <!-- the following are common used fields -->
+ <xsl:template match="text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date
+ | text:time | text:page-variable-get | text:author-name | text:author-initials | text:file-name | text:sender-company
+ | text:sender-initials | text:sender-phone-work | text:word-count | text:paragraph-count | text:character-count
+ | text:description | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration
+ | text:keywords | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:variable-get | text:user-field-get | text:sequence | text:database-name ">
+ <w:fldSimple>
+ <xsl:variable name="attribute_value1">
+ <xsl:choose>
+ <xsl:when test="name() = 'text:page-number' or name() = 'text:page-variable-get' ">
+ <xsl:text> PAGE </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:page-count' ">
+ <xsl:text> NUMPAGES </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:subject' ">
+ <xsl:text> SUBJECT </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:initial-creator' ">
+ <xsl:text> AUTHOR </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:title' ">
+ <xsl:text> TITLE </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:date' ">
+ <xsl:text> DATE </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:time' ">
+ <xsl:text> TIME </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'text:author-name' ">
+ <xsl:text> AUTHOR </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:author-initials' ">
+ <xsl:text> USERINITIALS </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:file-name' ">
+ <xsl:choose>
+ <xsl:when test="@text:display='name-and-extension' or @text:display='name' ">
+ <xsl:text> FILENAME </xsl:text>
+ </xsl:when>
+ <xsl:when test=" @text:display='full' or @text:display='path' ">
+ <xsl:text>FILENAME \p </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:sender-company' ">
+ <xsl:text> DOCPROPERTY Company </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:sender-initials' ">
+ <xsl:text> USERINITIALS </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:sender-phone-work' ">
+ <xsl:text> DOCPROPERTY &quot;Telephone number&quot; </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:word-count' ">
+ <xsl:text> DOCPROPERTY Words </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:paragraph-count' ">
+ <xsl:text> DOCPROPERTY Paragraphs </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:character-count' ">
+ <xsl:text> DOCPROPERTY CharactersWithSpaces </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:description' ">
+ <xsl:text> COMMENTS </xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:creation-time' ">
+ <xsl:text> DOCPROPERTY CreateTime </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name()= 'text:creation-date' ">
+ <xsl:text> CREATEDATE </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:editing-cycles' ">
+ <xsl:text> REVNUM \* Arabic </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:editing-duration' ">
+ <xsl:text> EDITTIME </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:keywords' ">
+ <xsl:text> KEYWORDS </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:print-time' ">
+ <xsl:text>DOCPROPERTY LastPrinted </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:print-date' ">
+ <xsl:text>DOCPROPERTY LastPrinted </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:creator' ">
+ <xsl:text> LASTSAVEDBY </xsl:text>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:modification-time' ">
+ <xsl:text> DOCPROPERTY LastSavedTime </xsl:text>
+ <!-- ATM, this template just return null time format, it might be developed in the future -->
+ <xsl:call-template name="field_get_time_format">
+ <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_time_value" select="@text:time-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:modification-date' ">
+ <xsl:text> SAVEDATE </xsl:text>
+ <!-- ATM, this template just return null date format, it might be developed in the future -->
+ <xsl:call-template name="field_get_date_format">
+ <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/>
+ <xsl:with-param name="field_date_value" select="@text:date-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:user-defined' ">
+ <xsl:text> DOCPROPERTY </xsl:text>
+ <xsl:text>&quot;</xsl:text>
+ <xsl:value-of select="translate(string(@text:name), ' ', '')"/>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:when>
+ <xsl:when test="name() = 'text:variable-get' or name() = 'text:user-field-get' ">
+ <xsl:value-of select="concat ('DOCVARIABLE ', @text:name)"/>
+ </xsl:when>
+ <xsl:when test=" name() = 'text:sequence' ">
+ <xsl:value-of select="concat(' SEQ &quot;',@text:name, '&quot;') "/>
+ </xsl:when>
+ <xsl:when test="name() = 'text:database-name' ">
+ <xsl:value-of select="concat (' DATABASE ', @text:database-name, '.' , @text:table-name)"/>
+ </xsl:when>
+ </xsl:choose>
+ <!-- Get number style format for number fields -->
+ <xsl:if test="@style:num-format">
+ <xsl:call-template name="field_get_number_format">
+ <xsl:with-param name="field_number_format_style" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:text> \* MERGEFORMAT </xsl:text>
+ </xsl:variable>
+ <xsl:attribute name="w:instr">
+ <xsl:value-of select="$attribute_value1"/>
+ </xsl:attribute>
+ <w:r>
+ <w:rPr>
+ <xsl:choose>
+ <xsl:when test="@style:num-format = '가, 나, 다, ...' or @style:num-format ='일, 이, 삼, ...' or @style:num-format ='ㄱ, ㄴ, ㄷ, ...' ">
+ <w:rFonts w:fareast="Batang" w:hint="fareast"/>
+ <!--wx:font wx:val="Batang"/ -->
+ <w:lang w:fareast="KO"/>
+ </xsl:when>
+ <xsl:when test="@style:num-format = 'ア, イ, ウ, ...' or @style:num-format = 'ア, イ, ウ, ...' or @style:num-format = 'イ, ロ, ハ, ...' or @style:num-format = 'イ, ロ, ハ, ...' or @style:num-format ='壱, 弐, 参, ...' ">
+ <w:rFonts w:fareast="MS Mincho" w:hint="fareast"/>
+ <!--wx:font wx:val="MS Mincho"/ -->
+ <w:lang w:fareast="JA"/>
+ </xsl:when>
+ <xsl:when test=" @style:num-format ='壹, 貳, 參, ...' or @style:num-format ='壹, 貳, 參, ...' or @style:num-format ='壹, 贰, 叁, ...'or @style:num-format = '一, 二, 三, ...' ">
+ <w:rFonts w:hint="fareast"/>
+ <!--wx:font wx:val="宋体"/ -->
+ </xsl:when>
+ </xsl:choose>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </w:fldSimple>
+ </xsl:template>
+ <xsl:template name="field_get_number_format">
+ <!-- this template get the various of number formats for number type field-->
+ <xsl:param name="field_number_format_style"/>
+ <xsl:choose>
+ <xsl:when test=" $field_number_format_style = '1, 2, 3, ...' or $field_number_format_style = '1' ">
+ <xsl:text> \* Arabic </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '①, ②, ③, ...' ">
+ <xsl:text> \* CircleNum </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'i' ">
+ <xsl:text> \* roman </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'I' ">
+ <xsl:text> \* ROMAN </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '一, 二, 三, ...'">
+ <xsl:text> \* CHINESENUM3 </xsl:text>
+ </xsl:when>
+ <xsl:when test=" $field_number_format_style ='壹, 貳, 參, ...' or $field_number_format_style ='壹, 貳, 參, ...' or
+$field_number_format_style ='壹, 贰, 叁, ...' ">
+ <xsl:text> \* CHINESENUM2 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '壱, 弐, 参, ...' ">
+ <xsl:text> \* DBNUM3 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '子, 丑, 寅, ...' ">
+ <xsl:text> \* ZODIAC2 </xsl:text>
+ </xsl:when>
+ <xsl:when test=" $field_number_format_style ='甲, 乙, 丙, ...' ">
+ <xsl:text> \* ZODIAC1 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'イ, ロ, ハ, ...' or $field_number_format_style = 'イ, ロ, ハ, ...' ">
+ <xsl:text> \* Iroha </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='ア, イ, ウ, ...' or $field_number_format_style ='ア, イ, ウ, ...' ">
+ <xsl:text> \* Aiueo </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '일, 이, 삼, ...' ">
+ <xsl:text> \* DBNUM1 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='ㄱ, ㄴ, ㄷ, ...' or $field_number_format_style = '㉠, ㉡, ㉢, ...' ">
+ <xsl:text> \* Chosung </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = '가, 나, 다, ...' or $field_number_format_style = '㉮, ㉯, ㉰, ...' ">
+ <xsl:text> \* Ganada </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'ア, イ, ウ, ...' or $field_number_format_style = 'ア, イ, ウ, ...' ">
+ <xsl:text> \* Aiueo </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='a' ">
+ <xsl:text> \* alphabetic </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style ='A' ">
+ <xsl:text> \* ALPHABETIC </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'א, ב, ג, ...' ">
+ <xsl:text> \* hebrew2 </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'أ, ب, ت, ...' ">
+ <xsl:text> \* ArabicAlpha </xsl:text>
+ </xsl:when>
+ <xsl:when test="$field_number_format_style = 'ก, ข, ฃ, ...' ">
+ <xsl:text> \* ThaiLetter </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="field_get_date_format">
+ <xsl:param name="field_date_stylename"/>
+ <xsl:param name="field_date_value"/>
+ <!-- this template retun null date format ATM-->
+ <xsl:text/>
+ </xsl:template>
+ <xsl:template name="field_get_time_format">
+ <xsl:param name="field_time_stylename"/>
+ <xsl:param name="field_time_value"/>
+ <!-- this template retun null date format ATM-->
+ <xsl:text/>
+ </xsl:template>
+ <xsl:template match="text:template-name">
+ <xsl:choose>
+ <xsl:when test="@text:display='title' or @text:display= 'area' ">
+ <!-- directly export the content -->
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:fldSimple>
+ <xsl:variable name="template_attribute_value">
+ <xsl:choose>
+ <xsl:when test="@text:display='name-and-extension' or @text:display= 'name' ">
+ <xsl:text> TEMPLATE </xsl:text>
+ </xsl:when>
+ <xsl:when test=" @text:display='full' or @text:display='path' ">
+ <xsl:text>TEMPLATE \p </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:text>\* MERGEFORMAT </xsl:text>
+ </xsl:variable>
+ <xsl:attribute name="w:instr">
+ <xsl:value-of select="$template_attribute_value"/>
+ </xsl:attribute>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </w:fldSimple>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:text-input | text:variable-input | text:user-field-input">
+ <w:fldSimple>
+ <xsl:variable name="text-input-attribute">
+ <xsl:text>FILLIN </xsl:text>
+ <xsl:if test="@text:description">
+ <xsl:value-of select="@text:description"/>
+ </xsl:if>
+ <xsl:text> \* MERGEFORMAT</xsl:text>
+ </xsl:variable>
+ <xsl:attribute name="w:instr">
+ <xsl:value-of select="$text-input-attribute"/>
+ </xsl:attribute>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <xsl:call-template name="field_convert_linebreak">
+ <xsl:with-param name="field_input_text" select="text()"/>
+ </xsl:call-template>
+ </w:r>
+ </w:fldSimple>
+ </xsl:template>
+ <xsl:template name="field_convert_linebreak">
+ <!-- this template convert the linebreak (&#x0A; and &#x0D;) in continous text to Ms word element<w:br/> -->
+ <xsl:param name="field_input_text"/>
+ <xsl:if test="not (contains($field_input_text,'&#x0A;'))">
+ <w:t>
+ <xsl:value-of select="$field_input_text"/>
+ </w:t>
+ </xsl:if>
+ <xsl:if test="contains($field_input_text,'&#x0A;')">
+ <w:t>
+ <xsl:value-of select="translate(substring-before($field_input_text,'&#x0A;'),'&#x0D;','')"/>
+ </w:t>
+ <w:br/>
+ <xsl:call-template name="field_convert_linebreak">
+ <xsl:with-param name="field_input_text" select="substring-after($field_input_text,'&#x0A;')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="field_declare">
+ <!-- this template export the field declaration to w:docpr -->
+ <xsl:param name="simple_field_variable_declares"/>
+ <xsl:param name="user_field_variable_declares"/>
+ <xsl:param name="field_sequence_declares"/>
+ <w:docVars>
+ <xsl:if test="$simple_field_variable_declares/text:variable-decl">
+ <xsl:for-each select="$simple_field_variable_declares/text:variable-decl">
+ <w:docVar w:name="{@text:name}" w:val="default value"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$user_field_variable_declares/text:user-field-decl">
+ <xsl:for-each select="$user_field_variable_declares/text:user-field-decl">
+ <w:docVar w:name="{@text:name}" w:val="{@text:string-value}"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$field_sequence_declares/text:sequence-decl">
+ <!-- do nothing for sequence declares when exporting to MS word-->
+ </xsl:if>
+ </w:docVars>
+ </xsl:template>
+ <xsl:template match="text:reference-ref | text:bookmark-ref | text:footnote-ref
+ | text:endnote-ref ">
+ <!-- this template is for reference fields -->
+ <w:r>
+ <w:fldChar w:fldCharType="begin"/>
+ </w:r>
+ <xsl:variable name="complicate_field_instruction">
+ <xsl:choose>
+ <xsl:when test=" name() = 'text:reference-ref' ">
+ <xsl:choose>
+ <xsl:when test=" string(@text:reference-format) = 'page' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'chapter' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'text' ">
+ <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'direction' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name() = 'text:footnote-ref' or name() = 'text:endnote-ref' ">
+ <xsl:choose>
+ <xsl:when test=" string(@text:reference-format) = 'page' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'chapter' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'text' ">
+ <xsl:value-of select="concat ( ' NOTEREF ' , @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'direction' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \p \h' ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="name() = 'text:bookmark-ref' ">
+ <xsl:choose>
+ <xsl:when test=" string(@text:reference-format) = 'page' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'chapter' ">
+ <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'text' ">
+ <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/>
+ </xsl:when>
+ <xsl:when test="string(@text:reference-format) = 'direction' ">
+ <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <!--start to combine the complicate field instruction -->
+ <w:r>
+ <w:instrText>
+ <xsl:value-of select="$complicate_field_instruction"/>
+ </w:instrText>
+ </w:r>
+ <w:r>
+ <w:fldChar w:fldCharType="separate"/>
+ </w:r>
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ <w:r>
+ <w:fldChar w:fldCharType="end"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:chapter | text:sender-firstname | text:sender-lastname
+ | text:sender-street | text:sender-country | text:sender-postal-code
+ | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:table-count | text:image-count
+ | text:object-count | text:printed-by | text:hidden-paragraph
+ | text:placeholder | text:drop-down | text:conditional-text
+ | text:variable-set | text:table-formula | text:database-display
+ | text:database-next | text:database-select | text:database-row-number
+ | text:sequence-ref | text:expression | text:sheet-name | text:dde-connection">
+ <!-- this template just export content of staroffice fields that do not have the corresponding fields in MS word ATM -->
+ <w:r>
+ <w:rPr>
+ <w:noProof/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:execute-macro | text:variable-decls | text:variable-decl | text:user-field-decls | text:variable-decl | text:sequence-decls | text:sequence-decl | text:page-variable-set | text:bibliography-mark | text:script | text:page-continuation ">
+ <!-- this template is to ignore matched elements when exporting writer to word -->
+ </xsl:template>
+ <xsl:template match="text:a ">
+ <xsl:call-template name="export_hyoerlink"/>
+ </xsl:template>
+ <xsl:template name="export_hyoerlink">
+ <!-- all params are useed by draw -->
+ <xsl:param name="TargetMeasure"/>
+ <xsl:param name="x-adjust"/>
+ <xsl:param name="y-adjust"/>
+ <xsl:param name="force-draw"/>
+ <!-- this template processes the hyperlink in writer -->
+ <xsl:variable name="hyperlink_filename">
+ <xsl:choose>
+ <xsl:when test="contains(@xlink:href, '#')">
+ <xsl:value-of select="substring-before(@xlink:href, '#')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@xlink:href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="hyperlink_bookmark">
+ <xsl:if test="contains(@xlink:href, '#')">
+ <xsl:choose>
+ <xsl:when test="contains(@xlink:href, '%7C')">
+ <xsl:call-template name="translate_string">
+ <xsl:with-param name="t_input_string" select="substring-before( substring-after(@xlink:href, '#'), '%7C')"/>
+ <xsl:with-param name="t_pattern_string" select=" '%20' "/>
+ <xsl:with-param name="t_substitute_string" select=" ' ' "/>
+ <xsl:with-param name="t_output_string" select=" '' "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="translate_string">
+ <xsl:with-param name="t_input_string" select="substring-after(@xlink:href, '#')"/>
+ <xsl:with-param name="t_pattern_string" select=" '%20' "/>
+ <xsl:with-param name="t_substitute_string" select=" ' ' "/>
+ <xsl:with-param name="t_output_string" select=" '' "/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <w:hlink>
+ <xsl:if test="@xlink:href">
+ <xsl:attribute name="w:dest">
+ <xsl:value-of select="$hyperlink_filename"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(@xlink:href, '#')">
+ <xsl:attribute name="w:bookmark">
+ <xsl:value-of select="$hyperlink_bookmark"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@office:target-frame-name">
+ <xsl:attribute name="w:target">
+ <xsl:value-of select="@office:target-frame-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@office:name">
+ <xsl:attribute name="w:screenTip">
+ <xsl:value-of select="@office:name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Hyperlink"/>
+ </w:rPr>
+ <!--apply inline-text-elements, many many many ... -->
+ <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text
+ | text:line-break | text:tab-stop | text:s | text:page-number | text:page-count | text:subject
+ | text:initial-creator | text:title | text:date | text:time | text:author-name
+ | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title
+ | text:sender-position | text:sender-phone-private | text:sender-phone-work
+ | text:sender-email | text:sender-fax | text:sender-state-or-province | text:word-count
+ | text:paragraph-count | text:character-count | text:table-count | text:image-count
+ | text:object-count | text:template-name | text:description | text:creation-time
+ | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time
+ | text:modification-date | text:user-defined | text:printed-by | text:hidden-paragraph
+ | text:placeholder | text:drop-down | text:conditional-text | text:text-input
+ | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence
+ | text:page-variable-set | text:page-variable-get | text:table-formula
+ | text:database-display | text:database-next| text:database-select
+ | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref
+ | text:expression | text:measure | text:dde-connection | text:sheet-name
+ | text:bibliography-mark | text:script | text:page-continuation | office:annotation
+ | draw:*">
+ <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/>
+ <xsl:with-param name="x-adjust" select="$x-adjust"/>
+ <xsl:with-param name="y-adjust" select="$y-adjust"/>
+ <xsl:with-param name="force-draw" select="$force-draw"/>
+ </xsl:apply-templates>
+ </w:r>
+ </w:hlink>
+ </xsl:template>
+ <xsl:template name="translate_string">
+ <!-- this template is to replace the substring matched t_pattern_string in t_t_input_string with t_substitute_string G.Y.-->
+ <xsl:param name="t_input_string"/>
+ <xsl:param name="t_pattern_string"/>
+ <xsl:param name="t_substitute_string"/>
+ <xsl:param name="t_output_string"/>
+ <xsl:variable name="t_temp_output_string">
+ <xsl:if test="contains($t_input_string, $t_pattern_string) ">
+ <xsl:value-of select="concat($t_output_string, substring-before($t_input_string,$t_pattern_string), $t_substitute_string) "/>
+ </xsl:if>
+ <xsl:if test="not (contains($t_input_string, $t_pattern_string)) ">
+ <xsl:value-of select="$t_output_string"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="contains($t_input_string, $t_pattern_string) ">
+ <xsl:call-template name="translate_string">
+ <xsl:with-param name="t_input_string" select="substring-after($t_input_string,$t_pattern_string)"/>
+ <xsl:with-param name="t_pattern_string" select="$t_pattern_string"/>
+ <xsl:with-param name="t_substitute_string" select="$t_substitute_string"/>
+ <xsl:with-param name="t_output_string" select="$t_temp_output_string"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains($t_input_string, $t_pattern_string))">
+ <xsl:value-of select="concat($t_temp_output_string, $t_input_string)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="add_hyperlink_style">
+ <!--this template is to add the hyperlink related style -->
+ <w:style w:type="character" w:styleId="Hyperlink">
+ <w:name w:val="Hyperlink"/>
+ <w:rsid w:val="006A55B0"/>
+ <w:rPr>
+ <w:color w:val="000080"/>
+ <w:u w:val="single"/>
+ </w:rPr>
+ </w:style>
+ <w:style w:type="character" w:styleId="FollowedHyperlink">
+ <w:name w:val="FollowedHyperlink"/>
+ <w:rsid w:val="006A55B0"/>
+ <w:rPr>
+ <w:color w:val="800000"/>
+ <w:u w:val="single"/>
+ </w:rPr>
+ </w:style>
+ </xsl:template>
+ <xsl:template match="office:annotation">
+ <!-- this template export writer note to word comments -->
+ <xsl:variable name="comments_aml_id">
+ <xsl:call-template name="unique_amlid_generator"/>
+ </xsl:variable>
+ <aml:annotation w:type="Word.Comment.Start">
+ <xsl:attribute name="aml:id">
+ <xsl:value-of select="$comments_aml_id"/>
+ </xsl:attribute>
+ </aml:annotation>
+ <aml:annotation w:type="Word.Comment.End">
+ <xsl:attribute name="aml:id">
+ <xsl:value-of select="$comments_aml_id"/>
+ </xsl:attribute>
+ </aml:annotation>
+ <!-- export aml:annotation content-->
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="CommentReference"/>
+ </w:rPr>
+ <aml:annotation aml:author="{@office:author}" aml:createdate="{@office:create-date}" w:type="Word.Comment" w:initials="{@office:author}">
+ <xsl:attribute name="aml:id">
+ <xsl:value-of select="$comments_aml_id"/>
+ </xsl:attribute>
+ <aml:content>
+ <xsl:apply-templates select="text:p"/>
+ </aml:content>
+ </aml:annotation>
+ </w:r>
+ <!-- end of export aml:annotation content-->
+ </xsl:template>
+ <xsl:template name="unique_amlid_generator">
+ <!-- this template generate unique id for aml:id, ATM it only counts the office:annotation, some other elements might be added later -->
+ <xsl:number count="office:annotation" from="/office:document/office:body" level="any" format="1"/>
+ </xsl:template>
+ <xsl:template name="add_comments_style">
+ <w:style w:type="character" w:styleId="CommentReference">
+ <w:name w:val="annotation reference"/>
+ <w:basedOn w:val="DefaultParagraphFont"/>
+ <w:semiHidden/>
+ <w:rsid w:val="007770B7"/>
+ <w:rPr>
+ <w:sz w:val="16"/>
+ <w:sz-cs w:val="16"/>
+ </w:rPr>
+ </w:style>
+ <w:style w:type="paragraph" w:styleId="CommentText">
+ <w:name w:val="annotation text"/>
+ <w:basedOn w:val="Normal"/>
+ <w:semiHidden/>
+ <w:rsid w:val="007770B7"/>
+ <w:pPr>
+ <w:pStyle w:val="CommentText"/>
+ </w:pPr>
+ <w:rPr>
+ <w:sz w:val="20"/>
+ <w:sz-cs w:val="20"/>
+ </w:rPr>
+ </w:style>
+ <w:style w:type="paragraph" w:styleId="CommentSubject">
+ <w:name w:val="annotation subject"/>
+ <w:basedOn w:val="CommentText"/>
+ <w:next w:val="CommentText"/>
+ <w:semiHidden/>
+ <w:rsid w:val="007770B7"/>
+ <w:pPr>
+ <w:pStyle w:val="CommentSubject"/>
+ </w:pPr>
+ <w:rPr>
+ <w:b/>
+ <w:b-cs/>
+ </w:rPr>
+ </w:style>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_list.xsl b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl
new file mode 100644
index 000000000000..990d2e0a09a8
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_list.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template name="ListStyles">
+ <w:lists>
+ <xsl:if test="descendant::text:list-level-style-image">
+ <xsl:call-template name="PicLists"/>
+ </xsl:if>
+ <xsl:apply-templates select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style" mode="style"/>
+ <xsl:for-each select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style">
+ <w:list w:ilfo="{position()}">
+ <w:ilst w:val="{position()-1}"/>
+ </w:list>
+ </xsl:for-each>
+ </w:lists>
+ </xsl:template>
+ <xsl:template match="text:list-style | text:outline-style" mode="style">
+ <w:listDef w:listDefId="{position()-1}">
+ <xsl:if test="name(..)='office:styles' and name()!='text:outline-style'">
+ <w:styleLink w:val="{@style:name}"/>
+ </xsl:if>
+ <xsl:for-each select="text:list-level-style-number | text:list-level-style-bullet | text:list-level-style-image | text:outline-level-style">
+ <xsl:if test="@text:level &lt; 10">
+ <w:lvl w:ilvl="{ @text:level - 1 }">
+ <xsl:if test="name()='text:outline-level-style'">
+ <xsl:variable name="headinglevel">
+ <xsl:value-of select="@text:level"/>
+ </xsl:variable>
+ <xsl:if test="/office:document/office:body//text:h[@text:level=$headinglevel and @text:style-name]">
+ <xsl:element name="w:pStyle">
+ <xsl:attribute name="w:val"><xsl:value-of select="/office:document/office:body//text:h[@text:level=$headinglevel]/@text:style-name"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <w:start w:val="{@text:start-value}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:start w:val="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@text:bullet-char">
+ <w:nfc w:val="23"/>
+ </xsl:when>
+ <xsl:when test="@style:num-format">
+ <xsl:call-template name="convert_list_number">
+ <xsl:with-param name="number-format" select="@style:num-format"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="name()='text:list-level-style-image'">
+ <w:lvlText w:val="."/>
+ <w:lvlPicBulletId>
+ <xsl:attribute name="w:val"><xsl:value-of select="count(preceding::text:list-level-style-image)"/></xsl:attribute>
+ </w:lvlPicBulletId>
+ </xsl:when>
+ <xsl:when test="@text:bullet-char">
+ <w:lvlText w:val="{@text:bullet-char}"/>
+ </xsl:when>
+ <xsl:when test="@text:display-levels and not(../@text:consecutive-numbering='true')">
+ <xsl:variable name="levelText">
+ <xsl:call-template name="displaylevel">
+ <xsl:with-param name="number" select="@text:display-levels"/>
+ <xsl:with-param name="textlevel" select="@text:level"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <w:lvlText w:val="{concat(@style:num-prefix, substring-after($levelText, '.'), @style:num-suffix)}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:lvlText w:val="{concat(@style:num-prefix, '%', @text:level, @style:num-suffix)}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@fo:text-align = 'end'">
+ <w:lvlJc w:val="right"/>
+ </xsl:when>
+ <xsl:when test="style:list-level-properties/@fo:text-align = 'center'">
+ <w:lvlJc w:val="center"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:lvlJc w:val="left"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:space-before | style:list-level-properties/@text:min-label-width | style:list-level-properties/@text:min-label-distance">
+ <xsl:call-template name="list_position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:suff w:val="Nothing"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="key('text-style',@text:style-name)/style:text-properties" mode="character"/>
+ <xsl:apply-templates select="style:text-properties" mode="character"/>
+ </w:lvl>
+ </xsl:if>
+ </xsl:for-each>
+ </w:listDef>
+ </xsl:template>
+ <xsl:template match="text:list-style" mode="count">
+ <xsl:value-of select="count(preceding::text:list-style | preceding::text:outline-style)+1"/>
+ </xsl:template>
+ <xsl:template match="text:unordered-list | text:ordered-list | text:list">
+ <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list-item | text:list-header | text:list"/>
+ </xsl:template>
+ <xsl:template match="text:list-item | text:list-header">
+ <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list | text:p | text:h"/>
+ </xsl:template>
+ <xsl:template name="displaylevel">
+ <xsl:param name="number"/>
+ <xsl:param name="textlevel"/>
+ <xsl:if test="$number &gt; 1">
+ <xsl:call-template name="displaylevel">
+ <xsl:with-param name="number" select="$number -1"/>
+ <xsl:with-param name="textlevel" select="number($textlevel)-1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:value-of select="concat('.','%',$textlevel)"/>
+ </xsl:template>
+ <xsl:template name="list_position">
+ <xsl:variable name="spacebefore">
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:space-before">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:list-level-properties/@text:space-before"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="space2text">
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:min-label-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="spacedistance">
+ <xsl:choose>
+ <xsl:when test="style:list-level-properties/@text:min-label-distance">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-distance"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$spacedistance='0' and $space2text='0'">
+ <w:suff w:val="Nothing"/>
+ </xsl:if>
+ <w:pPr>
+ <xsl:if test="$spacedistance!='0' or $space2text!='0'">
+ <w:tabs>
+ <w:tab>
+ <xsl:attribute name="w:val">list</xsl:attribute>
+ <xsl:attribute name="w:pos"><xsl:choose><xsl:when test="number($spacedistance) &gt; number($space2text)"><xsl:value-of select="number($spacebefore)+number($spacedistance)+150"/></xsl:when><xsl:otherwise><xsl:value-of select="number($spacebefore)+number($space2text)+150"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <!-- Since SO MinSpaceDistance is width after number or bullet, MS TabSpaceAfter include the number or bullet width. So +150 -->
+ </w:tab>
+ </w:tabs>
+ </xsl:if>
+ <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/>
+ <!-- w:pos(MS TabSpaceAfter) = text:space-before + MAX(text:min-label-distance,text:min-label-width) + ( Symbol width ); w:left(MS IndentAt)= text:space-before + text:min-label-width; w:hanging(MS IndentAt - MS AlignedAt)=text:min-label-width -->
+ </w:pPr>
+ </xsl:template>
+ <xsl:template name="PicLists">
+ <xsl:for-each select="descendant::text:list-level-style-image">
+ <w:listPicBullet w:listPicBulletId="{position()-1}">
+ <w:pict>
+ <v:shape>
+ <xsl:variable name="Picwidth">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="style:list-level-properties/@fo:width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Picheight">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="style:list-level-properties/@fo:height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style"><xsl:value-of select="concat('width:', number($Picwidth*1), 'pt;height:', number($Picheight*1), 'pt')"/></xsl:attribute>
+ <xsl:attribute name="o:bullet">t</xsl:attribute>
+ <v:stroke joinstyle="miter"/>
+ <w:binData w:name="{concat('wordml://SOpicbullet', position(), '.gif')}">
+ <xsl:value-of select="office:binary-data"/>
+ </w:binData>
+ <v:imagedata src="{concat('wordml://SOpicbullet', position(), '.gif')}" o:title="{concat('SOpicbullet', position())}"/>
+ </v:shape>
+ </w:pict>
+ </w:listPicBullet>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="convert_list_number">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'a'">
+ <!-- nfcLCLetter: Lowercase alpah -->
+ <w:nfc w:val="4"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'A'">
+ <!-- nfcUCLetter: Uppercase alpha -->
+ <w:nfc w:val="3"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'i'">
+ <!-- nfcLCRoman: Lowercase roman -->
+ <w:nfc w:val="2"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'I'">
+ <!-- nfcUCRoman: Uppercase roman -->
+ <w:nfc w:val="1"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1, 2, 3, ...'">
+ <!-- '1, 2, 3, ...' also seems: decimal-full-width2 -->
+ <w:nfc w:val="14"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '①, ②, ③, ...'">
+ <w:nfc w:val="18"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '一, 二, 三, ...'">
+ <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
+ taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
+ <w:nfc w:val="10"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, 贰, 叁, ...'">
+ <w:nfc w:val="38"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, 貳, 參, ...'">
+ <w:nfc w:val="34"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '甲, 乙, 丙, ...'">
+ <w:nfc w:val="30"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '子, 丑, 寅, ...'">
+ <w:nfc w:val="31"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壱, 弐, 参, ...'">
+ <w:nfc w:val="16"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ア, イ, ウ, ...'">
+ <w:nfc w:val="12"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ア, イ, ウ, ...'">
+ <w:nfc w:val="20"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
+ <w:nfc w:val="13"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
+ <w:nfc w:val="21"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '일, 이, 삼, ...'">
+ <!-- '일, 이, 삼, ...' also seems: korean-counting -->
+ <w:nfc w:val="41"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
+ <!-- mapping circled to uncirled -->
+ <w:nfc w:val="25"/>
+ </xsl:when>
+ <xsl:when test='$number-format = "가, 나, 다, ..." or $number-format = "㉮, ㉯, ㉰, ..."'>
+ <!-- mapping circled to uncirled -->
+ <w:nfc w:val="24"/>
+ </xsl:when>
+ <xsl:when test="$number-format ='أ, ب, ت, ...'">
+ <!-- 46. hebrew-1-->
+ <w:nfc w:val="46"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ก, ข, ฃ, ...'">
+ <!--53. thai-letters not match well !-->
+ <w:nfc w:val="53"/>
+ </xsl:when>
+ <xsl:when test="$number-format='א, ב, ג, ...'">
+ <!--45. arabic-alpha-->
+ <w:nfc w:val="45"/>
+ </xsl:when>
+ <xsl:when test="string-length($number-format)=0">
+ <w:nfc w:val="255"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'Native Numbering'">
+ <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($locale, 'th-')">
+ <!-- for Thai, mapping thai-numbers, thai-counting to thai-numbers -->
+ <w:nfc w:val="54"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'hi-')">
+ <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
+ <w:nfc w:val="51"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ar-')">
+ <!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
+ <w:nfc w:val="45"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'he-')">
+ <!-- for Hebrew, mapping hebrew-2 to -->
+ <w:nfc w:val="46"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ru-')">
+ <!-- for Russian, mapping russian-upper to russian-lower -->
+ <w:nfc w:val="58"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'vi-')">
+ <!-- for Vietnamese -->
+ <w:nfc w:val="56"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ chinese-not-impl, korean-legal, none -->
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_page.xsl b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl
new file mode 100644
index 000000000000..1dc0bba2aeb9
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl
@@ -0,0 +1,405 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_page.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template name="page-background">
+ <xsl:choose>
+ <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) &gt; 0]">
+ <w:bgPict>
+ <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) &gt; 0]" mode="bgPict"/>
+ </w:bgPict>
+ </xsl:when>
+ <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) &gt; 0]">
+ <w:bgPict>
+ <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) &gt; 0]" mode="bgPict"/>
+ </w:bgPict>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="style:background-image" mode="bgPict">
+ <xsl:variable name="binName" select="concat('wordml://',generate-id(.))"/>
+ <w:binData w:name="{$binName}">
+ <xsl:value-of select="translate(office:binary-data/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </w:binData>
+ <w:background w:bgcolor="{parent::style:page-layout-propertie/@fo:background-color}" w:background="{$binName}"/>
+ </xsl:template>
+ <xsl:template match="style:page-layout-properties" mode="bgPict">
+ <w:background w:bgcolor="{@fo:background-color}"/>
+ </xsl:template>
+ <xsl:template match="style:master-page">
+ <xsl:apply-templates select="key( 'page-layout', @style:page-layout-name)"/>
+ <xsl:if test="style:header">
+ <w:hdr w:type="odd">
+ <xsl:apply-templates select="style:header/text:p | style:header/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:hdr>
+ </xsl:if>
+ <xsl:if test="style:header-left">
+ <w:hdr w:type="even">
+ <xsl:apply-templates select="style:header-left/text:p | style:header-left/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:hdr>
+ </xsl:if>
+ <xsl:if test="style:footer">
+ <w:ftr w:type="odd">
+ <xsl:apply-templates select="style:footer/text:p | style:footer/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:ftr>
+ </xsl:if>
+ <xsl:if test="style:footer-left">
+ <w:ftr w:type="even">
+ <xsl:apply-templates select="style:footer-left/text:p | style:footer-left/table:table"/>
+ <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 -->
+ </w:ftr>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:page-layout">
+ <xsl:choose>
+ <xsl:when test="@style:page-usage = 'left'">
+ <w:type w:val="even-page"/>
+ </xsl:when>
+ <xsl:when test="@style:page-usage = 'right'">
+ <w:type w:val="odd-page"/>
+ </xsl:when>
+ <xsl:when test="@style:page-usage = 'all'">
+ <w:type w:val="next-page"/>
+ </xsl:when>
+ <!-- for mirrored, and default -->
+ <xsl:otherwise>
+ <w:type w:val="next-page"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="page-width">
+ <xsl:if test="style:page-layout-properties/@fo:page-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="margin-left">
+ <xsl:if test="style:page-layout-properties/@fo:margin-left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="margin-right">
+ <xsl:if test="style:page-layout-properties/@fo:margin-right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <w:pgSz>
+ <xsl:if test="style:page-layout-properties/@fo:page-width">
+ <xsl:attribute name="w:w">
+ <xsl:value-of select="$page-width"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:page-height">
+ <xsl:attribute name="w:h">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-height"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@style:print-orientation">
+ <xsl:attribute name="w:orient">
+ <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:pgSz>
+ <w:pgMar>
+ <xsl:if test="style:page-layout-properties/@fo:margin-top">
+ <xsl:variable name="top-margin">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:top">
+ <xsl:value-of select="$top-margin"/>
+ </xsl:attribute>
+ <xsl:if test="style:header-style/style:page-layout-properties/@fo:min-height">
+ <xsl:variable name="header-height">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:header-style/style:page-layout-properties/@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:header">
+ <xsl:value-of select="$top-margin - $header-height"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:margin-bottom">
+ <xsl:variable name="bottom-margin">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-bottom"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:bottom">
+ <xsl:value-of select="$bottom-margin"/>
+ </xsl:attribute>
+ <xsl:if test="style:footer-style/style:page-layout-properties/@fo:min-height">
+ <xsl:variable name="footer-height">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="style:footer-style/style:page-layout-properties/@fo:min-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:footer">
+ <xsl:value-of select="$bottom-margin - $footer-height"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:margin-left">
+ <xsl:attribute name="w:left">
+ <xsl:value-of select="$margin-left"/>
+ </xsl:attribute>
+ <xsl:attribute name="w:gutter">
+ <xsl:value-of select="'0'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:page-layout-properties/@fo:margin-right">
+ <xsl:attribute name="w:right">
+ <xsl:value-of select="$margin-right"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:pgMar>
+ <xsl:variable name="border-top" select="style:page-layout-properties/@fo:border-top | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-bottom" select="style:page-layout-properties/@fo:border-bottom | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-left" select="style:page-layout-properties/@fo:border-left | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-right" select="style:page-layout-properties/@fo:border-right | style:page-layout-properties/@fo:border"/>
+ <xsl:variable name="border-line-width-top" select="style:page-layout-properties/@style:border-line-width-top | style:page-layout-properties/@style:border-line-width "/>
+ <xsl:variable name="border-line-width-bottom" select="style:page-layout-properties/@style:border-line-width-bottom | style:page-layout-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-left" select="style:page-layout-properties/@style:border-line-width-left | style:page-layout-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-right" select="style:page-layout-properties/@style:border-line-width-right | style:page-layout-properties/@style:border-line-width"/>
+ <xsl:variable name="padding-top" select="style:page-layout-properties/@fo:padding-top | style:page-layout-properties/@fo:padding"/>
+ <xsl:variable name="padding-bottom" select="style:page-layout-properties/@fo:padding-bottom | style:page-layout-properties/@fo:padding"/>
+ <xsl:variable name="padding-left" select="style:page-layout-properties/@fo:padding-left | style:page-layout-properties/@fo:padding"/>
+ <xsl:variable name="padding-right" select="style:page-layout-properties/@fo:padding-right | style:page-layout-properties/@fo:padding"/>
+ <w:pgBorders w:offset-from="text">
+ <xsl:if test="$border-top">
+ <xsl:element name="w:top">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-top"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
+ <xsl:with-param name="so-border-position" select=" 'top' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-bottom">
+ <xsl:element name="w:bottom">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-bottom"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
+ <xsl:with-param name="so-border-position" select=" 'bottom' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-bottom"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-left">
+ <xsl:element name="w:left">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-left"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
+ <xsl:with-param name="so-border-position" select=" 'left' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-right">
+ <xsl:element name="w:right">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-right"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
+ <xsl:with-param name="so-border-position" select=" 'right' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="style:page-layout-properties/@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </w:pgBorders>
+ <xsl:variable name="valid-width">
+ <xsl:value-of select="$page-width - $margin-left - $margin-right"/>
+ </xsl:variable>
+ <xsl:apply-templates select="style:page-layout-properties/style:columns">
+ <xsl:with-param name="page-width" select="$valid-width"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="/office:document/office:styles/text:linenumbering-configuration"/>
+ </xsl:template>
+ <xsl:template match="text:linenumbering-configuration">
+ <xsl:if test="not(@text:number-lines = 'false')">
+ <xsl:element name="w:lnNumType">
+ <xsl:if test="@text:increment">
+ <xsl:attribute name="w:count-by">
+ <xsl:value-of select="@text:increment"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@text:offset">
+ <xsl:attribute name="w:distance">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@text:offset"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="w:restart">continuous</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="style:style" mode="section">
+ <xsl:param name="master-page"/>
+ <xsl:variable name="page-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:page-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="margin-left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="margin-right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="valid-width">
+ <xsl:value-of select="$page-width - $margin-left - $margin-right"/>
+ </xsl:variable>
+ <w:type w:val="continuous"/>
+ <xsl:apply-templates select="style:section-properties/style:columns">
+ <xsl:with-param name="page-width" select="$valid-width"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="style:columns">
+ <xsl:param name="page-width"/>
+ <w:cols w:num="{@fo:column-count}">
+ <xsl:if test="@fo:column-gap">
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:column-gap"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="style:column-sep">
+ <xsl:attribute name="w:sep">on</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(style:column)">
+ <xsl:attribute name="w:equalWidth">on</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:equalWidth">off</xsl:attribute>
+ <xsl:variable name="column-relative-width">
+ <xsl:call-template name="get-sum-column-width">
+ <xsl:with-param name="current-column" select="style:column[1]"/>
+ <xsl:with-param name="current-width" select="'0'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:for-each select="style:column">
+ <xsl:element name="w:col">
+ <xsl:attribute name="w:w">
+ <xsl:value-of select="floor(substring-before(@style:rel-width,'*') * $page-width div $column-relative-width)"/>
+ </xsl:attribute>
+ <xsl:if test="@fo:margin-right">
+ <xsl:variable name="margin-right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="following-sibling::style:column">
+ <xsl:variable name="margin-left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:space">
+ <xsl:value-of select="$margin-right + $margin-left"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:space">
+ <xsl:value-of select="$margin-right"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:cols>
+ </xsl:template>
+ <xsl:template name="get-sum-column-width">
+ <xsl:param name="current-column"/>
+ <xsl:param name="current-width"/>
+ <xsl:variable name="new-width" select="$current-width + substring-before($current-column/@style:rel-width,'*')"/>
+ <xsl:choose>
+ <xsl:when test="$current-column/following-sibling::style:column">
+ <xsl:call-template name="get-sum-column-width">
+ <xsl:with-param name="current-column" select="$current-column/following-sibling::style:column[1]"/>
+ <xsl:with-param name="current-width" select="$new-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$new-width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_path.xsl b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl
new file mode 100644
index 000000000000..9ce6ed265bc9
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl
@@ -0,0 +1,862 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_path.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:include href="../../common/math.xsl"/>
+ <xsl:template name="test-arc">
+ <xsl:call-template name="svg-arc2vml-arc">
+ <!-- M 125,75 a100,50 0 ?,? 100,50 -->
+ <xsl:with-param name="x0" select="125"/>
+ <xsl:with-param name="y0" select="75"/>
+ <xsl:with-param name="rx" select="100"/>
+ <xsl:with-param name="ry" select="50"/>
+ <xsl:with-param name="x-axis-rotation" select="0"/>
+ <xsl:with-param name="large-arc-flag" select="0"/>
+ <xsl:with-param name="sweep-flag" select="0"/>
+ <xsl:with-param name="x" select="225"/>
+ <xsl:with-param name="y" select="125"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="test">
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="'M 36.0 162.0 C 38.0 168.0 39.0-172.0 40.0 176.0 S 42.0 184.0 144.0 188.0'"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="svgpath2vmlpath">
+ <xsl:param name="svg-path"/>
+ <xsl:param name="vml-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'M'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'M' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' m ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="'L'"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'm' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' t ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="'l'"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'L' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- relative lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' r ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'H' ">
+ <!-- absolute horizontal lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'h' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'V' ">
+ <!-- absolute vertical lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'C' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- relative curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'S' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 's' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'Q' ">
+ <!-- absolute quadratic bézier curves -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'q' ">
+ <!-- relative quadratic bézier curves -->
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/>
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/>
+ <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ' , $absolute-number , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'Z' or $command = 'z' ">
+ <!-- closepath -->
+ <xsl:variable name="new-vml-path" select="concat($vml-path ,' x ' ) "/>
+ <xsl:call-template name="svgpath2vmlpath">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$vml-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-before">
+ <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="-1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="previous-num-and-pos">
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/>
+ </xsl:variable>
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-after">
+ <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="next-num-and-pos">
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/>
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-position">
+ <!-- get the next number start position, direction should be 1 or -1-->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="direction" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$direction = 1 and $position &gt; string-length($svg-path) ">0</xsl:when>
+ <xsl:when test="$direction = -1 and not($position &gt; 0)">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char">
+ <xsl:if test="$direction = 1">
+ <xsl:value-of select="substring($svg-path, $position , 1)"/>
+ </xsl:if>
+ <xsl:if test="$direction = -1">
+ <xsl:value-of select="substring($svg-path, $position -1 , 1)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789' ,'')) = 0 ">
+ <!-- number start-->
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position + $direction"/>
+ <xsl:with-param name="direction" select="$direction"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-next-number">
+ <!-- get the next number from current position-->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($svg-path) ">
+ <xsl:value-of select=" concat(round($number) , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( round($number) , ':' , $position)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-previous-number">
+ <!-- get the previous number from current position-->
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="not($position &gt; 0)">
+ <xsl:value-of select="concat( round($number ), ':0')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($svg-path, $position -1 , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="concat($curr-char , $number) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- skip it -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="$number "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) &gt; 0">
+ <!-- finsh it with +/- -->
+ <xsl:value-of select="concat( round( concat( $curr-char, $number)) , ':' , $position)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( round($number) , ':' , $position)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-path-command">
+ <xsl:param name="svg-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($svg-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , 'MmZzLlHhVvCcSsQqTtAa' ,'')) = 0 ">
+ <!-- "MmZzLlHhVvCcSsQqTtAa" are all possiable command chars -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="svg-path" select="$svg-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="svg-arc2vml-arc">
+ <xsl:param name="x0"/>
+ <xsl:param name="y0"/>
+ <xsl:param name="rx"/>
+ <xsl:param name="ry"/>
+ <xsl:param name="x-axis-rotation" select="0"/>
+ <xsl:param name="large-arc-flag" select="0"/>
+ <xsl:param name="sweep-flag" select="0"/>
+ <xsl:param name="x"/>
+ <xsl:param name="y"/>
+ <!-- Compute 1/2 distance between current and final point -->
+ <xsl:variable name="dx2" select="($x0 - $x) div 2"/>
+ <xsl:variable name="dy2" select="($y0 - $y) div 2"/>
+ <!-- Convert from degrees to radians -->
+ <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/>
+ <!-- Compute (x1, y1). What are x1,y1?-->
+ <xsl:variable name="cos-rotation">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="sin-rotation">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/>
+ <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/>
+ <!-- Make sure radii are large enough -->
+ <xsl:variable name="rx-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$rx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ry-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$ry"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/>
+ <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/>
+ <xsl:variable name="x1-sq" select="$x1 * $x1"/>
+ <xsl:variable name="y1-sq" select="$y1 * $y1"/>
+ <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/>
+ <xsl:variable name="radius-check-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$radius-check"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-rx">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$rx-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$ry-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-ry * $new-ry"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-rx-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-rx * $new-rx"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Step 2: Compute (cx1, cy1) -->
+ <xsl:variable name="sign">
+ <xsl:choose>
+ <xsl:when test="$large-arc-flag = $sweep-flag">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="unchecked-sq" select=" (($new-rx-sq * $new-ry-sq) - ($new-rx-sq * $y1-sq) - ($new-ry-sq * $x1-sq)) div (($new-rx-sq * $y1-sq) + ($new-ry-sq * $x1-sq)) "/>
+ <xsl:variable name="sq">
+ <xsl:choose>
+ <xsl:when test=" $unchecked-sq &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$unchecked-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sq-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$sq"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="coef" select="$sign * $sq-sqrt "/>
+ <xsl:variable name="cx1" select="$coef * $new-rx * $y1 div $new-ry"/>
+ <xsl:variable name="cy1" select=" -1 * $coef * $new-ry * $x1 div $new-rx"/>
+ <!-- Step 3: Compute (cx, cy) from (cx1, cy1) -->
+ <xsl:variable name="sx2" select="($x0 +$x) div 2 "/>
+ <xsl:variable name="sy2" select="($y0 +$y) div 2 "/>
+ <xsl:variable name="tmp1" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="tmp2" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="cx" select=" $sx2 + ( $cos-rotation * $cx1 - $sin-rotation * $cy1 ) "/>
+ <xsl:variable name="cy" select=" $sy2 + ( $sin-rotation * $cx1 + $cos-rotation * $cy1 ) "/>
+ <!-- Step 4: Compute angle start and angle extent -->
+ <xsl:variable name="ux" select="( $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="uy" select="( $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="vx" select="( - 1 * $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="vy" select="(- 1 * $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="n">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select=" ($ux * $ux) + ($uy * $uy) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- 1 * ux + 0 * uy -->
+ <xsl:variable name="p" select="$ux"/>
+ <xsl:variable name="uy-sign">
+ <xsl:choose>
+ <xsl:when test=" $uy &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p div $n"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="theta" select="( $uy-sign * $acos-pn * 180 div $pi ) mod 360 "/>
+ <xsl:variable name="n-delta">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="($ux * $ux + $uy * $uy) * ($vx * $vx + $vy * $vy)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="p-delta" select="$ux * $vx + $uy * $vy"/>
+ <xsl:variable name="vy-sign">
+ <xsl:choose>
+ <xsl:when test="($ux * $vy - $uy * $vx) &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn-delta">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p-delta div $n-delta"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="unchecked-delta" select="$vy-sign * $acos-pn-delta * 180 div $pi "/>
+ <xsl:variable name="delta">
+ <xsl:choose>
+ <xsl:when test=" $sweep-flag = 0 and $unchecked-delta &gt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta - 360) mod 360 "/>
+ </xsl:when>
+ <xsl:when test=" $sweep-flag = 1 and $unchecked-delta &lt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta + 360) mod 360 "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" $unchecked-delta mod 360 "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat ($cx, ' ' , $cy, ' ' , $rx, ' ' , $ry, ' ' , $theta, ' ' , $delta, ' ' , $x-axis-rotation) "/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl
new file mode 100644
index 000000000000..2f0d721eac02
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl
@@ -0,0 +1,316 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_settings.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template match="office:settings">
+ <w:docPr>
+ <w:displayBackgroundShape/>
+ <xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/>
+ <xsl:choose>
+ <xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'">
+ <w:view w:val="outline"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:view w:val="print"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/>
+ <w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}">
+ <xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/>
+ <xsl:choose>
+ <xsl:when test="$zoom-type = '3'">
+ <xsl:attribute name="w:val">best-fit</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$zoom-type = '2'">
+ <xsl:attribute name="w:val">full-page</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$zoom-type = '1'">
+ <xsl:attribute name="w:val">text-fit</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </w:zoom>
+ <w:defaultTabStop>
+ <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute>
+ </w:defaultTabStop>
+ <xsl:if test="../office:master-styles/style:master-page/style:header-left">
+ <w:evenAndOddHeaders/>
+ </xsl:if>
+ <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/>
+ <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/>
+ <!-- add the variables declaration in w:docpr G.Y. Begin-->
+ <xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls ">
+ <xsl:call-template name="field_declare">
+ <xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/>
+ <xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/>
+ <xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--add the variables declaration in w:docpr G.Y. End-->
+ </w:docPr>
+ </xsl:template>
+ <xsl:template match="text:footnotes-configuration">
+ <xsl:param name="within-section"/>
+ <w:footnotePr>
+ <xsl:choose>
+ <xsl:when test="@text:footnotes-position = 'document'">
+ <w:pos w:val="beneath-text"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:pos w:val="page-bottom"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@text:start-value">
+ <w:numStart w:val="{@text:start-value + 1}"/>
+ </xsl:if>
+ <xsl:if test="@style:num-format">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="@style:num-format"/>
+ <xsl:with-param name="number-prefix" select="@style:num-prefix"/>
+ <xsl:with-param name="number-suffix" select="@style:num-suffix"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="@text:start-numbering-at">
+ <xsl:choose>
+ <xsl:when test="@text:start-numbering-at = 'document'">
+ <w:numRestart w:val="continuous"/>
+ </xsl:when>
+ <xsl:when test="@text:start-numbering-at = 'page'">
+ <w:numRestart w:val="each-page"/>
+ </xsl:when>
+ <!-- convert "chapter" to "section" -->
+ <xsl:otherwise>
+ <w:numRestart w:val="each-sect"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$within-section != 'yes'">
+ <!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator
+ is defined solely in docPr, so not trouble to find the proper footnote-sep definition. -->
+ <w:footnote w:type="separator">
+ <w:p>
+ <w:r>
+ <w:separator/>
+ </w:r>
+ </w:p>
+ </w:footnote>
+ <w:footnote w:type="continuation-separator">
+ <w:p>
+ <w:r>
+ <w:continuationSeparator/>
+ <xsl:if test="text:footnote-continuation-notice-backward">
+ <w:t>
+ <xsl:value-of select="text:footnote-continuation-notice-backward"/>
+ </w:t>
+ </xsl:if>
+ </w:r>
+ </w:p>
+ </w:footnote>
+ <xsl:if test="text:footnote-continuation-notice-forward">
+ <w:footnote w:type="continuation-notice">
+ <w:p>
+ <w:r>
+ <w:t>
+ <xsl:value-of select="text:footnote-continuation-notice-forward"/>
+ </w:t>
+ </w:r>
+ </w:p>
+ </w:footnote>
+ </xsl:if>
+ </xsl:if>
+ </w:footnotePr>
+ </xsl:template>
+ <xsl:template match="text:endnotes-configuration">
+ <xsl:param name="within-section"/>
+ <w:endnotePr>
+ <w:pos w:val="sect-end"/>
+ <xsl:if test="@text:start-value">
+ <w:numStart w:val="{@text:start-value + 1}"/>
+ </xsl:if>
+ <xsl:if test="@style:num-format">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="@style:num-format"/>
+ <xsl:with-param name="number-prefix" select="@style:num-prefix"/>
+ <xsl:with-param name="number-suffix" select="@style:num-suffix"/>
+ </xsl:call-template>
+ </xsl:if>
+ <w:numRestart w:val="each-sect"/>
+ <xsl:if test="$within-section != 'yes'">
+ <w:endnote w:type="separator">
+ <w:p>
+ <w:r>
+ <w:separator/>
+ </w:r>
+ </w:p>
+ </w:endnote>
+ <w:endnote w:type="continuation-separator">
+ <w:p>
+ <w:r>
+ <w:continuationSeparator/>
+ </w:r>
+ </w:p>
+ </w:endnote>
+ </xsl:if>
+ </w:endnotePr>
+ </xsl:template>
+ <xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:param name="number-prefix"/>
+ <xsl:param name="number-suffix"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'">
+ <w:numFmt w:val="decimal-zero"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'">
+ <w:numFmt w:val="decimal-enclosed-fullstop"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'">
+ <w:numFmt w:val="decimal-enclosed-paren"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'">
+ <w:numFmt w:val="number-in-dash"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1'">
+ <!-- '1' also seems: decimal-half-width -->
+ <w:numFmt w:val="decimal"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'a'">
+ <w:numFmt w:val="lower-letter"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'A'">
+ <w:numFmt w:val="upper-letter"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'i'">
+ <w:numFmt w:val="lower-roman"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'I'">
+ <w:numFmt w:val="upper-roman"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '1, 2, 3, ...'">
+ <!-- '1, 2, 3, ...' also seems: decimal-full-width2 -->
+ <w:numFmt w:val="decimal-full-width"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '①, ②, ③, ...'">
+ <!-- decimal-enclosed-circle seems same -->
+ <w:numFmt w:val="decimal-enclosed-circle-chinese"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '一, 二, 三, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'">
+ <w:numFmt w:val="ideograph-enclosed-circle"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '一, 二, 三, ...'">
+ <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
+ taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
+ <w:numFmt w:val="chinese-counting-thousand"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, 贰, 叁, ...'">
+ <w:numFmt w:val="chinese-legal-simplified"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壹, 貳, 參, ...'">
+ <w:numFmt w:val="ideograph-legal-traditional"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '甲, 乙, 丙, ...'">
+ <w:numFmt w:val="ideograph-traditional"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '子, 丑, 寅, ...'">
+ <w:numFmt w:val="ideograph-zodiac"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '壱, 弐, 参, ...'">
+ <w:numFmt w:val="japanese-legal"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ア, イ, ウ, ...'">
+ <w:numFmt w:val="aiueo-full-width"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ア, イ, ウ, ...'">
+ <w:numFmt w:val="aiueo"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
+ <w:numFmt w:val="iroha-full-width"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'イ, ロ, ハ, ...'">
+ <w:numFmt w:val="iroha"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '일, 이, 삼, ...'">
+ <!-- '일, 이, 삼, ...' also seems: korean-counting -->
+ <w:numFmt w:val="korean-digital"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'">
+ <!-- mapping circled to uncirled -->
+ <w:numFmt w:val="chosung"/>
+ </xsl:when>
+ <xsl:when test="$number-format = '가, 나, 다, ...' or $number-format = '㉮, ㉯, ㉰, ...'">
+ <!-- mapping circled to uncirled -->
+ <w:numFmt w:val="ganada"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'أ, ب, ت, ...'">
+ <w:numFmt w:val="arabic-alpha"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ก, ข, ฃ, ...'">
+ <w:numFmt w:val="thai-letters"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'א, ב, ג, ...'">
+ <w:numFmt w:val="hebrew-1"/>
+ </xsl:when>
+ <xsl:when test="$number-format = 'Native Numbering'">
+ <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($locale, 'th-')">
+ <!-- for Thai, mapping thai-numbers, thai-counting to thai-letters -->
+ <w:numFmt w:val="thai-letters"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'hi-')">
+ <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
+ <w:numFmt w:val="hindi-numbers"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ar-')">
+ <!-- for Arabic, mapping arabic-abjad to arabic-alpha -->
+ <w:numFmt w:val="arabic-alpha"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'he-')">
+ <!-- for Hebrew, mapping hebrew-2 to -->
+ <w:numFmt w:val="hebrew-1"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'ru-')">
+ <!-- for Russian, mapping russian-upper to russian-lower -->
+ <w:numFmt w:val="russian-lower"/>
+ </xsl:when>
+ <xsl:when test="starts-with($locale, 'vi-')">
+ <!-- for Vietnamese -->
+ <w:numFmt w:val="vietnamese-counting"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ chinese-not-impl, korean-legal -->
+ <xsl:otherwise>
+ <w:numFmt w:val="decimal"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_table.xsl b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl
new file mode 100644
index 000000000000..83bf00ed288f
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl
@@ -0,0 +1,420 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_table.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:key name="table-style" match="style:style[@style:family='table']" use="@style:name"/>
+ <xsl:key name="table-column-style" match="style:style[@style:family='table-column']" use="@style:name"/>
+ <xsl:key name="table-row-style" match="style:style[@style:family='table-row']" use="@style:name"/>
+ <xsl:key name="table-cell-style" match="style:style[@style:family='table-cell']" use="@style:name"/>
+ <xsl:template match="style:table-properties" mode="table">
+ <xsl:param name="within-body"/>
+ <xsl:if test="$within-body = 'yes'">
+ <w:tblW>
+ <xsl:choose>
+ <xsl:when test="@style:rel-width">
+ <xsl:attribute name="w:w"><xsl:value-of select="substring-before(@style:rel-width, '%') * 50"/></xsl:attribute>
+ <xsl:attribute name="w:type">pct</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:width">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@style:width"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="w:type">dxa</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:w">0</xsl:attribute>
+ <xsl:attribute name="w:type">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:tblW>
+ </xsl:if>
+ <w:tblInd>
+ <xsl:choose>
+ <xsl:when test="@fo:margin-left">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@fo:margin-left"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="w:type">dxa</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:w">0</xsl:attribute>
+ <xsl:attribute name="w:type">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:tblInd>
+ <xsl:if test="@table:align">
+ <w:jc>
+ <xsl:choose>
+ <xsl:when test="@table:align = 'left' or @table:align= 'center' or @table:align = 'right'">
+ <xsl:attribute name="w:val"><xsl:value-of select="@table:align"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">left</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:jc>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="table:table">
+ <!--fix for issue i32030 pagebreak before-->
+ <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-before">
+ <xsl:variable name="table-break-before" select="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"/>
+ <xsl:choose>
+ <xsl:when test="$table-break-before = 'page' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="page"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ <xsl:when test="$table-break-before = 'column' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="column"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <w:tbl>
+ <w:tblPr>
+ <xsl:if test="not (@table:is-sub-table) or (@table:is-sub-table = 'false' )">
+ <w:tblStyle w:val="{@table:style-name}"/>
+ <xsl:apply-templates select="key('table-style', @table:style-name)/style:table-properties" mode="table">
+ <xsl:with-param name="within-body" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:if test="@table:is-sub-table ='true' ">
+ <w:tblW w:type="dxa">
+ <xsl:variable name="sub-table-width">
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="table:table-column[1]"/>
+ <xsl:with-param name="total-sub-table-width" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:w"><xsl:value-of select="$sub-table-width"/></xsl:attribute>
+ </w:tblW>
+ <!--w:tblLayout w:type="Fixed"/-->
+ </xsl:if>
+ </w:tblPr>
+ <w:tblGrid>
+ <xsl:apply-templates select="table:table-column"/>
+ </w:tblGrid>
+ <xsl:apply-templates select="table:table-header-rows/table:table-row | table:table-row"/>
+ </w:tbl>
+ <!--fix for issue i32030 pagebreak after-->
+ <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-after">
+ <xsl:variable name="table-break-after" select=" key('table-style', @table:style-name)/style:table-properties/@fo:break-after"/>
+ <xsl:choose>
+ <xsl:when test="$table-break-after = 'page' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="page"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ <xsl:when test="$table-break-after = 'column' ">
+ <w:p>
+ <w:r>
+ <w:br w:type="column"/>
+ </w:r>
+ </w:p>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="name(..)= 'table:table-cell' ">
+ <w:p/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="caculate-sub-table-width">
+ <xsl:param name="sub-table-column-node"/>
+ <xsl:param name="total-sub-table-width"/>
+ <xsl:variable name="column-width" select="key('table-column-style', $sub-table-column-node/@table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="column-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$column-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$sub-table-column-node/following-sibling::table:table-column">
+ <xsl:choose>
+ <xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[ 1]"/>
+ <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[1]"/>
+ <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip "/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$sub-table-column-node/@table:number-columns-repeated">
+ <xsl:value-of select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$total-sub-table-width + $column-width-in-twip "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="table:table-column">
+ <xsl:variable name="column-width" select="key('table-column-style', @table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="column-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$column-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- if table:table-column has attribute table:number-columns-repeated, then call the recursion
+ temple repeat-gridcol to produce multiple w:gridCol in MS word. Gary.Yang -->
+ <xsl:when test="@table:number-columns-repeated">
+ <xsl:call-template name="repeat-gridcol">
+ <xsl:with-param name="grid-repeat-count" select="@table:number-columns-repeated"/>
+ <xsl:with-param name="column-width" select="$column-width-in-twip"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:gridCol w:w="{$column-width-in-twip}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--recursion template for produce multiple w:gridCol Gary.Yang-->
+ <xsl:template name="repeat-gridcol">
+ <xsl:param name="grid-repeat-count"/>
+ <xsl:param name="column-width"/>
+ <xsl:if test="$grid-repeat-count &gt; 0">
+ <w:gridCol w:w="{$column-width}"/>
+ <xsl:call-template name="repeat-gridcol">
+ <xsl:with-param name="grid-repeat-count" select="$grid-repeat-count - 1"/>
+ <xsl:with-param name="column-width" select="$column-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="table:table-row">
+ <xsl:element name="w:tr">
+ <xsl:element name="w:trPr">
+ <xsl:if test="parent::table:table-header-rows">
+ <!-- fix for Issue 32034-->
+ <w:tblHeader>on</w:tblHeader>
+ </xsl:if>
+ <xsl:variable name="row-height" select="key('table-row-style', @table:style-name)/style:table-row-properties/@style:row-height"/>
+ <xsl:if test="$row-height">
+ <w:trHeight>
+ <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$row-height"/></xsl:call-template></xsl:attribute>
+ </w:trHeight>
+ </xsl:if>
+ </xsl:element>
+ <!--end of w:trPr-->
+ <xsl:apply-templates select="table:table-cell "/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="table:table-cell ">
+ <xsl:element name="w:tc">
+ <xsl:element name="w:tcPr">
+ <!-- to caclate the table-cell width Gary.Yang -->
+ <xsl:choose>
+ <!--when the table-cell contains the sub-table -->
+ <xsl:when test="table:table/@table:is-sub-table= 'true' ">
+ <xsl:variable name="table-cell-width">
+ <xsl:call-template name="caculate-sub-table-width">
+ <xsl:with-param name="sub-table-column-node" select="table:table/table:table-column[1]"/>
+ <xsl:with-param name="total-sub-table-width" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <w:tcW w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
+ </w:tcW>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- when the table-cell doesn't contain the sub-table -->
+ <xsl:variable name="table-cell-width">
+ <xsl:call-template name="caculate-table-cell-width">
+ <xsl:with-param name="table-cell-position" select="position()"/>
+ <xsl:with-param name="table-column" select="ancestor::table:table[1]/table:table-column[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <w:tcW w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute>
+ </w:tcW>
+ <!-- for performance issue, we can set w:type to auto that makes the cell width auto fit the content. -->
+ <!--w:tcW w:w="0" w:type="auto"/-->
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@table:number-columns-spanned">
+ <w:gridSpan w:val="{@table:number-columns-spanned}"/>
+ </xsl:if>
+ <xsl:variable name="cell-style-properties" select="key('table-cell-style', @table:style-name)/style:table-cell-properties"/>
+ <xsl:if test="$cell-style-properties/@fo:background-color">
+ <w:shd w:val="solid" w:color="{substring-after($cell-style-properties/@fo:background-color,'#')}"/>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:vertical-align">
+ <xsl:choose>
+ <xsl:when test="$cell-style-properties/@fo:vertical-align = 'middle'">
+ <w:vAlign w:val="center"/>
+ </xsl:when>
+ <xsl:when test="$cell-style-properties/@fo:vertical-align = 'Automatic'">
+ <w:vAlign w:val="both"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:vAlign w:val="{$cell-style-properties/@fo:vertical-align}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <w:tcMar>
+ <xsl:if test="$cell-style-properties/@fo:padding-top">
+ <w:top w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-top"/></xsl:call-template></xsl:attribute>
+ </w:top>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:padding-bottom">
+ <w:bottom w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-bottom"/></xsl:call-template></xsl:attribute>
+ </w:bottom>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:padding-left">
+ <w:left w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-left"/></xsl:call-template></xsl:attribute>
+ </w:left>
+ </xsl:if>
+ <xsl:if test="$cell-style-properties/@fo:padding-right">
+ <w:right w:type="dxa">
+ <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-right"/></xsl:call-template></xsl:attribute>
+ </w:right>
+ </xsl:if>
+ </w:tcMar>
+ <!-- the following code is to get the cell borders if they exsits Gary.Yang-->
+ <xsl:variable name="border-top" select="$cell-style-properties/@fo:border-top | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-bottom" select="$cell-style-properties/@fo:border-bottom | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-left" select="$cell-style-properties/@fo:border-left | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-right" select="$cell-style-properties/@fo:border-right | $cell-style-properties/@fo:border"/>
+ <xsl:variable name="border-line-width-top" select="$cell-style-properties/@style:border-line-width-top | $cell-style-properties/@style:border-line-width "/>
+ <xsl:variable name="border-line-width-bottom" select="$cell-style-properties/@style:border-line-width-bottom | $cell-style-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-left" select="$cell-style-properties/@style:border-line-width-left | $cell-style-properties/@style:border-line-width"/>
+ <xsl:variable name="border-line-width-right" select="$cell-style-properties/@style:border-line-width-right | $cell-style-properties/@style:border-line-width"/>
+ <xsl:element name="w:tcBorders">
+ <xsl:if test="$border-top">
+ <xsl:element name="w:top">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-top"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
+ <xsl:with-param name="so-border-position" select=" 'top' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-bottom">
+ <xsl:element name="w:bottom">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-bottom"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
+ <xsl:with-param name="so-border-position" select=" 'bottom' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-left">
+ <xsl:element name="w:left">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-left"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
+ <xsl:with-param name="so-border-position" select=" 'left' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-right">
+ <xsl:element name="w:right">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-right"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
+ <xsl:with-param name="so-border-position" select=" 'right' "/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ <xsl:if test="not (*) ">
+ <w:p/>
+ </xsl:if>
+ <xsl:apply-templates select=" text:p | table:table | text:h | office:annotation"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="caculate-table-cell-width">
+ <xsl:param name="table-cell-position"/>
+ <xsl:param name="table-column"/>
+ <xsl:choose>
+ <xsl:when test="$table-column/@table:number-columns-repeated">
+ <xsl:choose>
+ <xsl:when test="($table-cell-position - $table-column/@table:number-columns-repeated) &lt;= 0">
+ <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="table-cell-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$table-cell-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$table-cell-width-in-twip"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="caculate-table-cell-width">
+ <xsl:with-param name="table-cell-position" select="$table-cell-position - $table-column/@table:number-columns-repeated"/>
+ <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if the $table-column doesn't contain the table:number-columns-repeated attribute -->
+ <xsl:choose>
+ <xsl:when test="($table-cell-position - 1) = 0">
+ <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/>
+ <xsl:variable name="table-cell-width-in-twip">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$table-cell-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$table-cell-width-in-twip"/>
+ </xsl:when>
+ <xsl:when test="($table-cell-position - 1) &gt; 0">
+ <xsl:call-template name="caculate-table-cell-width">
+ <xsl:with-param name="table-cell-position" select=" $table-cell-position - 1 "/>
+ <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:value-of select=" 'caculate table cell width wrong ' "/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/export/wordml/ooo2wordml_text.xsl b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl
new file mode 100644
index 000000000000..08f5486840c8
--- /dev/null
+++ b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl
@@ -0,0 +1,1283 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ooo2wordml_text.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
+ <xsl:template match="style:paragraph-properties" mode="paragraph">
+ <w:pPr>
+ <w:adjustRightInd w:val="off"/>
+ <xsl:if test="@fo:break-before = 'page'">
+ <w:pageBreakBefore w:val="on"/>
+ </xsl:if>
+ <xsl:if test="contains(@style:writing-mode, 'rl')">
+ <w:bidi/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@fo:text-align-last = 'start'">
+ <xsl:choose>
+ <xsl:when test="contains(@style:writing-mode, 'rl')">
+ <w:jc w:val="right"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:jc w:val="left"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@fo:text-align-last = 'justify'">
+ <w:jc w:val="distribute"/>
+ </xsl:when>
+ <xsl:when test="@fo:text-align-last = 'center'">
+ <w:jc w:val="center"/>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'start'">
+ <xsl:choose>
+ <xsl:when test="contains(@style:writing-mode, 'rl')">
+ <w:jc w:val="right"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:jc w:val="left"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'end'">
+ <xsl:choose>
+ <xsl:when test="contains(@style:writing-mode, 'rl')">
+ <w:jc w:val="left"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:jc w:val="right"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'justify'">
+ <w:jc w:val="distribute"/>
+ </xsl:when>
+ <xsl:when test="@fo:text-align = 'center'">
+ <w:jc w:val="center"/>
+ </xsl:when>
+ </xsl:choose>
+ <w:spacing>
+ <xsl:choose>
+ <xsl:when test="@fo:line-height">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:line-height, '%')">
+ <xsl:attribute name="w:line-rule">auto</xsl:attribute>
+ <xsl:attribute name="w:line">
+ <xsl:value-of select="round(substring-before(@fo:line-height, '%') div 100 * 240)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:line-rule">exact</xsl:attribute>
+ <xsl:attribute name="w:line">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:line-height"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:line-height-at-least">
+ <xsl:attribute name="w:line-rule">at-least</xsl:attribute>
+ <xsl:attribute name="w:line">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@style:line-height-at-least"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:line-spacing">
+ <xsl:attribute name="w:line-rule">auto</xsl:attribute>
+ <xsl:variable name="spacing">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@style:line-spacing"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:line">
+ <xsl:value-of select="round($spacing div 0.567)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="@fo:margin-top">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-top, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-top"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:before">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-top, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:before">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:margin-bottom">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-bottom, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-bottom"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:after">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-bottom, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:after">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-bottom"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </w:spacing>
+ <w:ind>
+ <xsl:if test="@fo:margin-left">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-left, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-left"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:left">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-left, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:margin-right">
+ <xsl:choose>
+ <xsl:when test="contains(@fo:margin-right, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-right"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:right">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-right, '%'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:margin-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:text-indent">
+ <xsl:choose>
+ <!-- When @style:auto-text-indent='true' @fo:text-indent ignored, use 283 for all font size -->
+ <xsl:when test="@style:auto-text-indent='true'">
+ <xsl:attribute name="w:first-line">283</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@fo:text-indent, '%')">
+ <xsl:if test="../@style:parent-style-name">
+ <xsl:variable name="parent-size">
+ <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:text-indent"/>
+ </xsl:variable>
+ <xsl:variable name="w-number">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$parent-size"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$w-number &lt; 0">
+ <xsl:attribute name="w:hanging">
+ <xsl:value-of select="round($w-number div -100 * substring-before(@fo:text-indent, '%'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:first-line">
+ <xsl:value-of select="round($w-number div 100 * substring-before(@fo:text-indent, '%'))"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="starts-with(@fo:text-indent,'-')">
+ <xsl:attribute name="w:hanging">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="substring-after(@fo:text-indent,'-')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:first-line">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:text-indent"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </w:ind>
+ <xsl:if test="contains(@fo:background-color, '#')">
+ <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/>
+ </xsl:if>
+ <xsl:if test="@fo:keep-with-next='true'">
+ <w:keepNext/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@fo:widows | @fo:orphans">
+ <w:widowControl w:val="on"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:widowControl w:val="off"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@style:break-inside = 'avoid'">
+ <w:keepLines/>
+ </xsl:if>
+ <xsl:if test="@fo:hyphenate = 'false'">
+ <w:suppressAutoHyphens/>
+ </xsl:if>
+ <xsl:if test="@style:snap-to-layout-grid='false'">
+ <w:snapToGrid w:val="off"/>
+ </xsl:if>
+ <xsl:if test="style:tab-stops">
+ <w:tabs>
+ <xsl:for-each select="style:tab-stops/style:tab-stop">
+ <w:tab>
+ <xsl:choose>
+ <xsl:when test="@style:type='char'">
+ <xsl:attribute name="w:val">decimal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:type">
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="@style:type"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">left</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@style:leader-char">
+ <xsl:choose>
+ <xsl:when test="@style:leader-char='-'">
+ <xsl:attribute name="w:leader">hyphen</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:leader-char='_'">
+ <xsl:attribute name="w:leader">underscore</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@style:leader-char='.'">
+ <xsl:attribute name="w:leader">dot</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:leader">dot</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@style:position">
+ <xsl:attribute name="w:pos">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@style:position"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </w:tab>
+ </xsl:for-each>
+ </w:tabs>
+ </xsl:if>
+ <xsl:if test="@style:line-break='normal'">
+ <w:kinsoku w:val="off"/>
+ </xsl:if>
+ <xsl:if test="@style:punctuation-wrap='simple'">
+ <w:overflowPunct w:val="off"/>
+ </xsl:if>
+ <xsl:if test="@style:text-autospace='none'">
+ <w:autoSpaceDE w:val="off"/>
+ <w:autoSpaceDN w:val="off"/>
+ </xsl:if>
+ <xsl:if test="@style:vertical-align">
+ <xsl:element name="w:textAlignment">
+ <xsl:choose>
+ <xsl:when test="@style:vertical-align='middle'">
+ <xsl:attribute name="w:val">center</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="@style:vertical-align"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@text:number-lines='false'">
+ <w:supressLineNumbers/>
+ </xsl:if>
+ <xsl:variable name="border-top" select="@fo:border-top | @fo:border"/>
+ <xsl:variable name="border-bottom" select="@fo:border-bottom | @fo:border"/>
+ <xsl:variable name="border-left" select="@fo:border-left | @fo:border"/>
+ <xsl:variable name="border-right" select="@fo:border-right | @fo:border"/>
+ <xsl:variable name="border-line-width-top" select="@style:border-line-width-top | @style:border-line-width "/>
+ <xsl:variable name="border-line-width-bottom" select="@style:border-line-width-bottom | @style:border-line-width"/>
+ <xsl:variable name="border-line-width-left" select="@style:border-line-width-left | @style:border-line-width"/>
+ <xsl:variable name="border-line-width-right" select="@style:border-line-width-right | @style:border-line-width"/>
+ <xsl:variable name="padding-top" select="@fo:padding-top | @fo:padding"/>
+ <xsl:variable name="padding-bottom" select="@fo:padding-bottom | @fo:padding"/>
+ <xsl:variable name="padding-left" select="@fo:padding-left | @fo:padding"/>
+ <xsl:variable name="padding-right" select="@fo:padding-right | @fo:padding"/>
+ <w:pBdr>
+ <xsl:if test="$border-top">
+ <xsl:element name="w:top">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-top"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/>
+ <xsl:with-param name="so-border-position" select=" 'top' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-bottom">
+ <xsl:element name="w:bottom">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-bottom"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/>
+ <xsl:with-param name="so-border-position" select=" 'bottom' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-bottom"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-left">
+ <xsl:element name="w:left">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-left"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/>
+ <xsl:with-param name="so-border-position" select=" 'left' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$border-right">
+ <xsl:element name="w:right">
+ <xsl:call-template name="get-border">
+ <xsl:with-param name="so-border" select="$border-right"/>
+ <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/>
+ <xsl:with-param name="so-border-position" select=" 'right' "/>
+ </xsl:call-template>
+ <xsl:attribute name="w:space">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$padding-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@style:shadow!='none'">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="@style:shadow!='none' and not(@fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right | @fo:border)">
+ <xsl:element name="w:right">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ <xsl:attribute name="w:val">single</xsl:attribute>
+ <xsl:variable name="shadow-size">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:sz">
+ <xsl:choose>
+ <xsl:when test="$shadow-size &lt;= 0.08">12</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.14">18</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.20">24</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.25">36</xsl:when>
+ <xsl:otherwise>48</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:element name="w:bottom">
+ <xsl:attribute name="w:shadow">on</xsl:attribute>
+ <xsl:attribute name="w:val">single</xsl:attribute>
+ <xsl:variable name="shadow-size">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="w:sz">
+ <xsl:choose>
+ <xsl:when test="$shadow-size &lt;= 0.08">12</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.14">18</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.20">24</xsl:when>
+ <xsl:when test="$shadow-size &lt;= 0.25">36</xsl:when>
+ <xsl:otherwise>48</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </w:pBdr>
+ <w:ind>
+ <xsl:if test="$padding-left!=''">
+ <xsl:attribute name="w:left">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$padding-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$padding-right!='' ">
+ <xsl:attribute name="w:right">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$padding-right"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </w:ind>
+ <xsl:variable name="stylename">
+ <xsl:value-of select="../@style:name"/>
+ </xsl:variable>
+ <xsl:if test="/office:document/office:body//text:h[@text:style-name = $stylename]">
+ <xsl:variable name="headinglevel">
+ <xsl:value-of select="/office:document/office:body//text:h[@text:style-name = $stylename]/@text:level"/>
+ </xsl:variable>
+ <xsl:if test="/office:document/office:styles/text:outline-style/text:outline-level-style[@text:level = $headinglevel]">
+ <w:listPr>
+ <w:ilvl w:val="{$headinglevel -1}"/>
+ <w:ilfo w:val="1"/>
+ </w:listPr>
+ </xsl:if>
+ </xsl:if>
+ </w:pPr>
+ </xsl:template>
+ <xsl:template match="style:text-properties" mode="character">
+ <w:rPr>
+ <xsl:if test="@svg:font-family | @style:font-name | @style:font-name-asian | @style:font-name-complex">
+ <w:rFonts>
+ <xsl:variable name="fontname">
+ <xsl:choose>
+ <xsl:when test='starts-with(@svg:font-family,"&apos;")'>
+ <xsl:value-of select='substring-before(substring-after(@svg:font-family,"&apos;"),"&apos;")'/>
+ </xsl:when>
+ <xsl:when test="@svg:font-family">
+ <xsl:value-of select="@svg:font-family"/>
+ </xsl:when>
+ <xsl:when test="@style:font-name">
+ <xsl:value-of select="@style:font-name"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="string-length($fontname)!=0">
+ <xsl:attribute name="w:ascii">
+ <xsl:value-of select="$fontname"/>
+ </xsl:attribute>
+ <xsl:attribute name="w:h-ansi">
+ <xsl:value-of select="$fontname"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-name-asian">
+ <xsl:attribute name="w:fareast">
+ <xsl:value-of select="@style:font-name-asian"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@style:font-name-complex">
+ <xsl:attribute name="w:cs">
+ <xsl:value-of select="@style:font-name-complex"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:rFonts>
+ </xsl:if>
+ <!-- relative font sizes not supported yet. -->
+ <xsl:if test="contains(@fo:font-size, 'pt')">
+ <w:sz w:val="{substring-before(@fo:font-size,'pt') * 2}"/>
+ </xsl:if>
+ <xsl:if test="contains(@fo:font-size-complex, 'pt')">
+ <w:sz-cs w:val="{substring-before(@fo:font-size-complex, 'pt') * 2}"/>
+ </xsl:if>
+ <xsl:if test="@fo:font-style = 'italic' or @fo:font-style-asian = 'italic'">
+ <w:i/>
+ </xsl:if>
+ <xsl:if test="@fo:font-style-complex = 'italic'">
+ <w:i-cs/>
+ </xsl:if>
+ <xsl:if test="@fo:font-weight = 'bold' or @fo:font-weight-asian = 'bold'">
+ <w:b/>
+ </xsl:if>
+ <xsl:if test="@fo:font-weight-complex = 'bold'">
+ <w:b-cs/>
+ </xsl:if>
+ <xsl:if test="@style:text-underline-style">
+ <w:u>
+ <xsl:variable name="w-u">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-style = 'solid'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">thick</xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dotted'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dotted-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dotted-heavy</xsl:when>
+ <xsl:otherwise>dotted</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dashed-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dashed-heavy</xsl:when>
+ <xsl:otherwise>dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'long-dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dash-long-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dash-long-heavy</xsl:when>
+ <xsl:otherwise>dash-long</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dot-dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dot-dash-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-heavy</xsl:when>
+ <xsl:otherwise>dot-dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'dot-dot-dash'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">dot-dot-dash-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-dot-heavy</xsl:when>
+ <xsl:otherwise>dot-dot-dash</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@style:text-underline-style = 'wave'">
+ <xsl:choose>
+ <xsl:when test="@style:text-underline-type = 'double'">wavy-double</xsl:when>
+ <xsl:when test="@style:text-underline-width = 'bold'">wavy-heavy</xsl:when>
+ <xsl:otherwise>wave</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@style:text-underline-style"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="$w-u"/>
+ </xsl:attribute>
+ <xsl:if test="contains(@style:text-underline-color,'#')">
+ <xsl:attribute name="w:color">
+ <xsl:value-of select="substring-after(@style:text-underline-color,'#')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:u>
+ </xsl:if>
+ <xsl:if test="@style:text-shadow | @fo:text-shadow">
+ <w:shadow/>
+ </xsl:if>
+ <xsl:if test="string-length(@style:text-line-through-style) &gt; 0">
+ <xsl:choose>
+ <xsl:when test="@style:text-line-through-type = 'double'">
+ <w:dstrike/>
+ </xsl:when>
+ <xsl:when test="@style:text-line-through-style = 'solid'">
+ <w:strike/>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:strike/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@fo:color">
+ <w:color>
+ <xsl:choose>
+ <xsl:when test="@fo:color != '#000000'">
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="substring-after(@fo:color,'#')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="w:val">auto</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:color>
+ </xsl:if>
+ <xsl:if test="@fo:font-variant = 'small-caps'">
+ <w:smallCaps/>
+ </xsl:if>
+ <xsl:if test="@fo:text-transform = 'uppercase'">
+ <w:caps/>
+ </xsl:if>
+ <xsl:if test="@style:font-relief = 'engraved'">
+ <w:imprint/>
+ </xsl:if>
+ <xsl:if test="@style:font-relief = 'embossed'">
+ <w:emboss/>
+ </xsl:if>
+ <xsl:if test="@style:text-outline = 'true'">
+ <w:outline/>
+ </xsl:if>
+ <xsl:if test="contains(@style:text-scale,'%')">
+ <w:w w:val="{substring-before(@style:text-scale,'%')}"/>
+ </xsl:if>
+ <xsl:if test="@style:text-emphasize">
+ <w:em>
+ <xsl:choose>
+ <xsl:when test="contains(@style:text-emphasize, 'accent')">
+ <xsl:attribute name="w:val">comma</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'disc')">
+ <xsl:attribute name="w:val">under-dot</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'none')">
+ <xsl:attribute name="w:val">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'dot below')">
+ <xsl:attribute name="w:val">under-dot</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'dot above')">
+ <xsl:attribute name="w:val">dot</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(@style:text-emphasize, 'circle')">
+ <xsl:attribute name="w:val">dot</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </w:em>
+ </xsl:if>
+ <xsl:if test="@fo:letter-spacing != 'normal'">
+ <w:spacing>
+ <xsl:attribute name="w:val">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="@fo:letter-spacing"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </w:spacing>
+ </xsl:if>
+ <xsl:if test="@style:text-blinking = 'true'">
+ <w:effect w:val="blink-background"/>
+ </xsl:if>
+ <xsl:if test="@fo:language | @fo:language-asian | @fo:language-complex">
+ <w:lang>
+ <xsl:if test="@fo:language and @fo:country">
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="concat(@fo:language, '-', @fo:country)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:language-asian and @fo:country-asian">
+ <xsl:attribute name="w:fareast">
+ <xsl:value-of select="concat(@fo:language-asian, '-', @fo:country-asian)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@fo:language-complex and @fo:language-complex">
+ <xsl:attribute name="w:bidi">
+ <xsl:value-of select="concat(@fo:language-complex, '-', @fo:language-complex)"/>
+ </xsl:attribute>
+ </xsl:if>
+ </w:lang>
+ </xsl:if>
+ <xsl:if test="@style:text-position">
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="starts-with(@style:text-position, 'super')">superscript_0</xsl:when>
+ <xsl:when test="starts-with(@style:text-position, 'sub')">subscript_0</xsl:when>
+ <xsl:when test="starts-with(@style:text-position, '-')">
+ <xsl:value-of select="concat('subscript_', substring-before(@style:text-position,'%'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('superscript_', substring-before(@style:text-position,'%'))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:vertAlign>
+ <xsl:attribute name="w:val">
+ <xsl:value-of select="substring-before($position,'_')"/>
+ </xsl:attribute>
+ </w:vertAlign>
+ <!-- Raised/Lowed position is difficult to map to MSWord w:position, Writer use %, but Word use half-point(not relative position). Since it's difficult to get font-size, use 12pt as default font-size -->
+ <w:position>
+ <xsl:attribute name="w:val">
+ <xsl:choose>
+ <xsl:when test="substring-after($position, '_') = 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="round(substring-after($position, '_') div 6)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </w:position>
+ </xsl:if>
+ <xsl:if test="@text:display = 'true'">
+ <w:vanish/>
+ </xsl:if>
+ <xsl:if test="contains(@fo:background-color, '#')">
+ <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/>
+ </xsl:if>
+ </w:rPr>
+ </xsl:template>
+ <xsl:template match="text:p | text:h">
+ <w:p>
+ <w:pPr>
+ <xsl:if test="@text:style-name">
+ <w:pStyle w:val="{@text:style-name}"/>
+ </xsl:if>
+ <xsl:if test="@text:level">
+ <w:outlineLvl w:val="{@text:level - 1}"/>
+ </xsl:if>
+ <xsl:variable name="following-paragraph-heading-table" select="following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table')]"/>
+ <xsl:variable name="following-section" select="following::text:section[1]"/>
+ <xsl:variable name="ancestor-section" select="ancestor::text:section"/>
+ <!-- if the following neighbour paragraph/heading are slave of one master style, or new section starts,
+ then a new page will start -->
+ <xsl:variable name="next-is-new-page" select="boolean(key( 'slave-style', $following-paragraph-heading-table[1]/@*[name()='text:style-name' or name()='table:style-name']))"/>
+ <xsl:variable name="next-is-new-section">
+ <xsl:if test="$following-section and generate-id($following-section/descendant::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])">
+ <xsl:value-of select="'yes'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="next-is-section-end">
+ <xsl:if test="$ancestor-section and generate-id($ancestor-section[1]/following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])">
+ <xsl:value-of select="'yes'"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="ancestor::office:body and not(ancestor::text:footnote or ancestor::text:endnote) and ($next-is-new-page or $next-is-new-section = 'yes' or $next-is-section-end = 'yes')">
+ <w:sectPr>
+ <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration">
+ <xsl:with-param name="within-section" select="'yes'"/>
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])">
+ <xsl:apply-templates select="key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/>
+ <xsl:if test="$ancestor-section">
+ <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
+ <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:if test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number">
+ <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page -->
+ <xsl:variable name="pagenumber_start">
+ <xsl:value-of select=" key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/>
+ </xsl:variable>
+ <xsl:if test=" number($pagenumber_start) &gt; 0 ">
+ <w:pgNumType w:start="{$pagenumber_start}"/>
+ </xsl:if>
+ <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 -->
+ <!--w:pgNumType w:start="{key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/ -->
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="preceding-style" select="preceding::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/>
+ <xsl:choose>
+ <xsl:when test="$preceding-style">
+ <xsl:apply-templates select="key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$ancestor-section">
+ <xsl:choose>
+ <xsl:when test="$preceding-style">
+ <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
+ <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section">
+ <xsl:with-param name="master-page" select="/office:document/office:automatic-styles/style:page-layout[1]"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:sectPr>
+ </xsl:if>
+ <!-- add for office:annotation style G.Y. -->
+ <xsl:if test="name(..)= 'office:annotation' ">
+ <w:pStyle w:val="CommentText"/>
+ </xsl:if>
+ <!-- add by wym for listPr -->
+ <xsl:if test="ancestor::text:ordered-list | ancestor::text:unordered-list | ancestor::text:list">
+ <xsl:variable name="listname">
+ <xsl:value-of select="ancestor::text:ordered-list/@text:style-name | ancestor::text:unordered-list/@text:style-name | ancestor::text:list/@text:style-name"/>
+ </xsl:variable>
+ <xsl:variable name="currlevel">
+ <xsl:value-of select="count(ancestor::text:list-item|ancestor::text:list-header)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($listname)!=0 and $currlevel &lt; 10">
+ <xsl:variable name="currlist">
+ <xsl:apply-templates select="key('list-style', $listname)" mode="count"/>
+ </xsl:variable>
+ <w:listPr>
+ <w:ilvl w:val="{number($currlevel)-1}"/>
+ <w:ilfo w:val="{$currlist}"/>
+ </w:listPr>
+ </xsl:when>
+ <xsl:when test="string-length($listname)!=0">
+ <xsl:for-each select="key('list-style', $listname)">
+ <xsl:variable name="spacebefore">
+ <xsl:choose>
+ <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="space2text">
+ <xsl:choose>
+ <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:listPr>
+ <w:ilvl w:val="{number($currlevel)-1}"/>
+ <w:ilfo w:val="1"/>
+ </w:listPr>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!-- end of listPr -->
+ </w:pPr>
+ <!-- get break column from style -->
+ <xsl:variable name="style" select="key('paragraph-style', @text:style-name)/style:paragraph-properties"/>
+ <xsl:if test="$style/@fo:break-before = 'column'">
+ <w:r>
+ <w:br w:type="column"/>
+ </w:r>
+ </xsl:if>
+ <xsl:if test="parent::office:text and not(preceding-sibling::text:p)">
+ <xsl:call-template name="PageLevelGraphic"/>
+ </xsl:if>
+ <xsl:if test="parent::text:footnote-body and not(preceding-sibling::*)">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-style-name}"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:footnote-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:footnote-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:footnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <xsl:if test="parent::text:endnote-body and not(preceding-sibling::*)">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-style-name}"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:endnote-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:endnote-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:endnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <!-- newly added the endnote , footnote templates -->
+ <xsl:if test="../../@text:note-class='endnote' and not(preceding-sibling::*)">
+ <xsl:message>
+ <xsl:value-of select=" 'enter into ext:note-class= endnote' "/>
+ </xsl:message>
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Endnote_20_Symbol"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:note-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:note-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:footnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <xsl:if test="../../@text:note-class='footnote' and not(preceding-sibling::*)">
+ <xsl:message>
+ <xsl:value-of select=" 'enter into ext:note-class= footnote' "/>
+ </xsl:message>
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Footnote_20_Symbol"/>
+ </w:rPr>
+ <xsl:choose>
+ <xsl:when test="../../text:note-citation/@text:label">
+ <w:t>
+ <xsl:value-of select="../../text:note-citation/@text:label"/>
+ </w:t>
+ </xsl:when>
+ <xsl:otherwise>
+ <w:footnoteRef/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </w:r>
+ <w:r>
+ <w:tab/>
+ </w:r>
+ </xsl:if>
+ <!-- apply inline-text-elements, many many many ... :( glu -->
+ <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop
+ | text:s | text:note | draw:*
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+ "/>
+ <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format -->
+ <!--xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop
+ | text:s | text:footnote | text:endnote | draw:*
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+ "/-->
+ <xsl:if test="$style/@fo:break-after">
+ <w:r>
+ <w:br w:type="{$style/@fo:break-after}"/>
+ </w:r>
+ </xsl:if>
+ </w:p>
+ </xsl:template>
+ <xsl:template match="text:span">
+ <!-- apply inline-text-elements, many many many ... :( glu -->
+ <xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s
+ | text:note
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+"/>
+ <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format -->
+ <!-- xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s
+ | text:footnote | text:endnote
+ | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time
+ | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company
+ | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street
+ | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position
+ | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax
+ | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count
+ | text:table-count | text:image-count | text:object-count | text:template-name | text:description
+ | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords
+ | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date
+ | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down
+ | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input
+ | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set
+ | text:page-variable-get | text:table-formula | text:database-display | text:database-next
+ | text:database-select | text:database-row-number | text:database-name | text:reference-ref
+ | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression
+ | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script
+ | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark
+"/-->
+ </xsl:template>
+ <xsl:template match="text()">
+ <xsl:if test="string-length(normalize-space(.)) &gt; 0">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:t>
+ <xsl:value-of select="."/>
+ </w:t>
+ </w:r>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:hidden-text">
+ <w:r>
+ <w:rPr>
+ <xsl:if test="parent::text:span">
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </xsl:if>
+ <w:vanish/>
+ </w:rPr>
+ <w:t>
+ <xsl:value-of select="@text:string-value"/>
+ </w:t>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:line-break">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:br w:type="text-wrapping" w:clear="all"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:tab-stop">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:tab/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:s">
+ <w:r>
+ <xsl:if test="parent::text:span">
+ <w:rPr>
+ <w:rStyle w:val="{parent::text:span/@text:style-name}"/>
+ </w:rPr>
+ </xsl:if>
+ <w:t>
+ <xsl:if test="@text:c">
+ <xsl:call-template name="add-space">
+ <xsl:with-param name="number" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:text> </xsl:text>
+ </w:t>
+ </w:r>
+ </xsl:template>
+ <xsl:template name="add-space">
+ <xsl:param name="number"/>
+ <xsl:if test="$number &gt; 1">
+ <xsl:call-template name="add-space">
+ <xsl:with-param name="number" select="$number - 1"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="text:footnote">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-body-style-name}"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:footnote-body"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:footnote-body">
+ <w:footnote>
+ <xsl:if test="../text:footnote-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:footnote>
+ </xsl:template>
+ <xsl:template match="text:endnote">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-body-style-name}"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:endnote-body"/>
+ </w:r>
+ </xsl:template>
+ <xsl:template match="text:endnote-body">
+ <w:endnote>
+ <xsl:if test="../text:endnote-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:endnote>
+ </xsl:template>
+ <xsl:template match="text:bookmark-start">
+ <xsl:variable name="bookmark-id">
+ <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
+ </xsl:variable>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/>
+ </xsl:template>
+ <xsl:template match="text:bookmark-end">
+ <xsl:variable name="bookmark-id">
+ <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
+ </xsl:variable>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/>
+ </xsl:template>
+ <xsl:template match="text:bookmark">
+ <xsl:variable name="bookmark-id">
+ <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/>
+ </xsl:variable>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/>
+ <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/>
+ </xsl:template>
+ <!-- newly added the endnote , footnote templates -->
+ <xsl:template match="text:note">
+ <xsl:choose>
+ <xsl:when test="@text:note-class = 'endnote' ">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Endnote"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:note-body"/>
+ </w:r>
+ </xsl:when>
+ <xsl:when test="@text:note-class = 'footnote' ">
+ <w:r>
+ <w:rPr>
+ <w:rStyle w:val="Footnote"/>
+ </w:rPr>
+ <xsl:apply-templates select="text:note-body"/>
+ </w:r>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="text:note-body">
+ <xsl:choose>
+ <xsl:when test="../@text:note-class='endnote' ">
+ <w:endnote>
+ <xsl:if test="../text:note-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:endnote>
+ </xsl:when>
+ <xsl:when test="../@text:note-class='footnote' ">
+ <w:footnote>
+ <xsl:if test="../text:note-citation/@text:label">
+ <xsl:attribute name="w:suppressRef">on</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/>
+ </w:footnote>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/common/ms2ooo_docpr.xsl b/filter/source/xslt/import/common/ms2ooo_docpr.xsl
new file mode 100644
index 000000000000..169573a3a18b
--- /dev/null
+++ b/filter/source/xslt/import/common/ms2ooo_docpr.xsl
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: ms2ooo_docpr.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt fo v">
+ <xsl:template match="o:DocumentProperties">
+ <office:meta>
+ <meta:generator>Microsoft Word 2003</meta:generator>
+ <dc:title>
+ <xsl:value-of select="o:Title"/>
+ </dc:title>
+ <dc:description>
+ <xsl:value-of select="o:Description"/>
+ </dc:description>
+ <dc:subject>
+ <xsl:value-of select="o:Subject"/>
+ </dc:subject>
+ <meta:initial-creator>
+ <xsl:value-of select="o:Author"/>
+ </meta:initial-creator>
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( o:Created, 'Z')"/>
+ </meta:creation-date>
+ <dc:creator>
+ <xsl:value-of select="o:LastAuthor"/>
+ </dc:creator>
+ <xsl:if test="string-length(substring-before( o:LastSaved, 'Z')) &gt; 0">
+ <dc:date>
+ <xsl:value-of select="substring-before( o:LastSaved, 'Z')"/>
+ </dc:date>
+ </xsl:if>
+ <!-- comment out the below line now because Oasis format doesn't allow the meta:print-by to be empty element -->
+ <!--meta:printed-by /-->
+ <xsl:if test="string-length(substring-before( o:LastPrinted, 'Z')) &gt; 0">
+ <!--
+ <meta:print-date>
+ <xsl:value-of select="substring-before( o:LastPrinted, 'Z')"/>
+ </meta:print-date>
+ -->
+ </xsl:if>
+ <meta:keyword>
+ <xsl:value-of select="o:Keywords"/>
+ </meta:keyword>
+ <meta:editing-cycles>
+ <xsl:value-of select="o:Revision"/>
+ </meta:editing-cycles>
+ <meta:editing-duration>
+ <xsl:if test="o:TotalTime">
+ <xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/>
+ </xsl:if>
+ </meta:editing-duration>
+ <meta:user-defined meta:name="Category" meta:value-type="string">
+ <xsl:value-of select="o:Category"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Manager" meta:value-type="string">
+ <xsl:value-of select="o:Manager"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Company" meta:value-type="string">
+ <xsl:value-of select="o:Company"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Version" meta:value-type="string">
+ <xsl:value-of select="o:Version"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="HyperlinkBase" meta:value-type="string">
+ <xsl:value-of select="o:HyperlinkBase"/>
+ </meta:user-defined>
+ <xsl:apply-templates select="../o:CustomDocumentProperties"/>
+ <meta:document-statistic meta:page-count="{o:Pages}" meta:paragraph-count="{o:Paragraphs}" meta:word-count="{o:Words}" meta:character-count="{o:Characters}"/>
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="o:CustomDocumentProperties">
+ <xsl:for-each select="node()[@dt:dt]">
+ <meta:user-defined meta:name="{local-name()}" meta:value-type="{@dt:dt}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
new file mode 100644
index 000000000000..a1576db37f10
--- /dev/null
+++ b/filter/source/xslt/import/spreadsheetml/spreadsheetml2ooo.xsl
@@ -0,0 +1,8962 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: spreadsheetml2ooo.xsl,v $
+
+ $Revision: 1.7 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:SL="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" exclude-result-prefixes="aml dt html o ss SL v w10 w wx x">
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+ <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
+ <xsl:import href="../../common/measure_conversion.xsl"/>
+ <xsl:output indent="no" version="1.0" encoding="UTF-8" method="xml"/>
+ <xsl:template match="/">
+ <office:document office:mimetype="application/vnd.oasis.opendocument.spreadsheet" office:version="1.0">
+ <xsl:apply-templates select="ss:Workbook/o:DocumentProperties"/>
+ <xsl:apply-templates select="ss:Workbook/x:ExcelWorkbook"/>
+ <xsl:call-template name="font-declaration"/>
+ <xsl:apply-templates select="ss:Workbook/ss:Worksheet[1]" mode="styles"/>
+ <xsl:element name="office:body">
+ <xsl:element name="office:spreadsheet">
+ <xsl:call-template name="set-calculation"/>
+ <!-- for DataValidation -->
+ <xsl:if test="ss:Workbook/ss:Worksheet/x:DataValidation">
+ <xsl:element name="table:content-validations">
+ <xsl:apply-templates select="ss:Workbook/ss:Worksheet/x:DataValidation"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates select="ss:Workbook/ss:Worksheet"/>
+ <xsl:call-template name="Names"/>
+ <xsl:element name="table:database-ranges">
+ <!-- these descriptions located in every Worksheet in Excel, but at the same path in Calc -->
+ <xsl:for-each select="ss:Workbook/ss:Worksheet">
+ <xsl:apply-templates select="./x:Sorting"/>
+ <xsl:apply-templates select="./x:AutoFilter"/>
+ <!-- for Advanced Filter.the position is same as AutoFilter -->
+ <xsl:if test="./ss:Names/ss:NamedRange and ./ss:Names/ss:NamedRange/@ss:Name='_FilterDatabase'">
+ <xsl:call-template name="transform-advanced-filter">
+ <xsl:with-param name="target-value" select="substring-after(./ss:Names/ss:NamedRange[@ss:Name='_FilterDatabase']/@ss:RefersTo, '=')"/>
+ <xsl:with-param name="condition-pos" select="substring-after(./ss:Names/ss:NamedRange[@ss:Name='Criteria']/@ss:RefersTo, '=')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="o:DocumentProperties">
+ <office:meta>
+ <meta:generator>Microsoft Excel 2003</meta:generator>
+ <xsl:if test="o:Title">
+ <dc:title>
+ <xsl:value-of select="o:Title"/>
+ </dc:title>
+ </xsl:if>
+ <xsl:if test="o:Description">
+ <dc:description>
+ <xsl:value-of select="o:Description"/>
+ </dc:description>
+ </xsl:if>
+ <xsl:if test="o:Subject">
+ <dc:subject>
+ <xsl:value-of select="o:Subject"/>
+ </dc:subject>
+ </xsl:if>
+ <xsl:if test="o:Author">
+ <meta:initial-creator>
+ <xsl:value-of select="o:Author"/>
+ </meta:initial-creator>
+ </xsl:if>
+ <xsl:if test="o:Created">
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( o:Created, 'Z')"/>
+ </meta:creation-date>
+ </xsl:if>
+ <xsl:if test="o:LastAuthor">
+ <dc:creator>
+ <xsl:value-of select="o:LastAuthor"/>
+ </dc:creator>
+ </xsl:if>
+ <xsl:if test="o:LastSaved">
+ <dc:date>
+ <xsl:value-of select="substring-before( o:LastSaved, 'Z')"/>
+ </dc:date>
+ </xsl:if>
+ <!--
+ <meta:printed-by/>
+ <meta:print-date/>
+ <!~~ removed in OASIS Open Office XML
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="o:Keywords" />
+ </meta:keyword>
+ </meta:keywords>
+ ~~>
+ <dc:language/>
+ -->
+ <xsl:if test="o:Revision">
+ <meta:editing-cycles>
+ <xsl:value-of select="o:Revision"/>
+ </meta:editing-cycles>
+ </xsl:if>
+ <xsl:if test="o:TotalTime">
+ <meta:editing-duration>
+ <xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/>
+ </meta:editing-duration>
+ </xsl:if>
+ <xsl:if test="o:Category">
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="o:Category"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:Manager">
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="o:Manager"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:Company">
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="o:Company"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:Version">
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="o:Version"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="o:HyperlinkBase">
+ <meta:user-defined meta:name="HyperlinkBase">
+ <xsl:value-of select="o:HyperlinkBase"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:apply-templates select="../o:CustomDocumentProperties"/>
+ <!--Note: <meta:document-statistic/>-->
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="o:CustomDocumentProperties">
+ <xsl:for-each select="node()[@dt:dt]">
+ <meta:user-defined meta:name="{name()}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="x:ExcelWorkbook">
+ <!-- Configuration in 'ooo:view-settings' and 'ooo:configuration-settings'
+ "GridColor"
+ "HasColumnRowHeaders"
+ "HasSheetTabs"
+ "IsOutlineSymbolsSet"
+ "IsRasterAxisSynchronized"
+ "IsSnapToRaster"
+ "RasterIsVisible"
+ "RasterResolutionX"
+ "RasterResolutionY"
+ "RasterSubdivisionX"
+ "RasterSubdivisionY"
+ "ShowGrid"
+ "ShowNotes"
+ "ShowPageBreaks"
+ "ShowZeroValues"
+ -->
+ <xsl:variable name="sharedConfiguration">
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:GridlineColor">
+ <config:config-item config:name="GridColor" config:type="long">
+ <xsl:variable name="temp-code" select="substring-after(normalize-space(../ss:Worksheet/x:WorksheetOptions/x:GridlineColor), '#')"/>
+ <xsl:variable name="temp-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$temp-code"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($temp-code)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$temp-value"/>
+ </config:config-item>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayHeadings">
+ <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:HideWorkbookTabs">
+ <config:config-item config:name="HasSheetTabs" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayOutline">
+ <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayGridlines">
+ <config:config-item config:name="ShowGrid" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="../ss:Worksheet/x:WorksheetOptions/x:DoNotDisplayZeros">
+ <config:config-item config:name="ShowZeroValues" config:type="boolean">false</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:type="int" config:name="VisibleAreaTop">
+ <xsl:value-of select="x:WindowTopY"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaLeft" config:type="int">
+ <xsl:value-of select="x:WindowTopX"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaWidth" config:type="int">
+ <xsl:value-of select="x:WindowWidth"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">
+ <xsl:value-of select="x:WindowHeight"/>
+ </config:config-item>
+ <xsl:variable name="ratio" select="15"/>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">View1</config:config-item>
+ <config:config-item-map-named config:name="Tables">
+ <!-- The panes of a table is like 3 | 1 or 3 | 1, or 3 , while 3 is the default one. glu
+ - - - - - - -
+ 2 | 0 2 -->
+ <xsl:for-each select="../ss:Worksheet">
+ <config:config-item-map-entry config:name="{@ss:Name}">
+ <xsl:variable name="active-pane">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:ActivePane">
+ <xsl:value-of select="x:WorksheetOptions/x:ActivePane"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="not( $active-pane = '' ) and ( x:WorksheetOptions/x:SplitVertical or x:WorksheetOptions/x:SplitHorizontal )">
+ <config:config-item config:name="ActiveSplitRange" config:type="short">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitVertical and not(x:WorksheetOptions/x:SplitHorizontal)">
+ <xsl:value-of select="'3'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$active-pane"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not( $active-pane = '')">
+ <config:config-item config:name="CursorPositionX" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane[x:Number = $active-pane ]/x:ActiveCol"/>
+ </config:config-item>
+ <config:config-item config:name="CursorPositionY" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane[x:Number = $active-pane ]/x:ActiveRow"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="CursorPositionX" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane/x:ActiveCol"/>
+ </config:config-item>
+ <config:config-item config:name="CursorPositionY" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:Panes/x:Pane/x:ActiveRow"/>
+ </config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="position-left">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:LeftColumnVisible">
+ <xsl:value-of select="x:WorksheetOptions/x:LeftColumnVisible"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <config:config-item config:name="PositionLeft" config:type="int">
+ <xsl:value-of select="$position-left"/>
+ </config:config-item>
+ <xsl:variable name="position-top">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:TopRowVisible">
+ <xsl:value-of select="x:WorksheetOptions/x:TopRowVisible"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitVertical and not(x:WorksheetOptions/x:SplitHorizontal)">
+ <config:config-item config:name="PositionBottom" config:type="int">
+ <xsl:value-of select="$position-top"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="PositionTop" config:type="int">
+ <xsl:value-of select="$position-top"/>
+ </config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitVertical">
+ <config:config-item config:name="HorizontalSplitMode" config:type="short">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">2</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="HorizontalSplitPosition" config:type="int">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">
+ <xsl:value-of select="x:WorksheetOptions/x:SplitVertical + $position-left"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="floor( x:WorksheetOptions/x:SplitVertical div $ratio )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="PositionRight" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:LeftColumnRightPane"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:SplitHorizontal">
+ <config:config-item config:name="VerticalSplitMode" config:type="short">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">2</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="VerticalSplitPosition" config:type="int">
+ <xsl:choose>
+ <xsl:when test="x:WorksheetOptions/x:FreezePanes">
+ <xsl:value-of select="x:WorksheetOptions/x:SplitHorizontal + $position-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="floor( x:WorksheetOptions/x:SplitHorizontal div $ratio )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="PositionBottom" config:type="int">
+ <xsl:value-of select="x:WorksheetOptions/x:TopRowBottomPane"/>
+ </config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:copy-of select="$sharedConfiguration"/>
+ </config:config-item-map-entry>
+ </xsl:for-each>
+ </config:config-item-map-named>
+ <xsl:if test="x:ActiveSheet">
+ <config:config-item config:name="ActiveTable" config:type="string">
+ <xsl:value-of select="../ss:Worksheet[/ss:Workbook/x:ExcelWorkbook/x:ActiveSheet+1]/@ss:Name"/>
+ </config:config-item>
+ </xsl:if>
+ <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">555</config:config-item>
+ <!-- following are some table setting from Excel, but transformed to global setting, due to limit of Calc -->
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:ShowPageBreakZoom">
+ <config:config-item config:name="ShowPageBreakPreview" config:type="boolean">true</config:config-item>
+ </xsl:if>
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:PageBreakZoom">
+ <config:config-item config:name="PageViewZoomValue" config:type="int">
+ <xsl:value-of select="../ss:Worksheet/x:WorksheetOptions/x:PageBreakZoom"/>
+ </config:config-item>
+ </xsl:if>
+ <xsl:if test="../ss:Worksheet/x:WorksheetOptions/x:Zoom">
+ <config:config-item config:name="ZoomValue" config:type="int">
+ <xsl:value-of select="../ss:Worksheet/x:WorksheetOptions/x:Zoom"/>
+ </config:config-item>
+ </xsl:if>
+ <!-- several properties are not saved in Calc XML but setting, whereas vice versa. :( So just to be expanded, glu -->
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <xsl:copy-of select="$sharedConfiguration"/>
+ </config:config-item-set>
+ <!-- printer setting, not finished yet. glu
+ <config:config-item-set config:name="configuration-settings" />
+ -->
+ </office:settings>
+ </xsl:template>
+ <!-- Key all attributes with the same name and same value -->
+ <xsl:key name="same-named-font" match="/ss:Workbook/ss:Styles/ss:Style/ss:Font" use="concat(@ss:FontName, @x:Family)"/>
+ <xsl:key name="same-named-face" match="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell//html:Font[@html:Face]" use="concat(@html:Face, @x:Family)"/>
+ <xsl:template name="font-declaration">
+ <office:font-face-decls>
+ <xsl:if test="/ss:Workbook/ss:Styles/ss:Style/ss:Font">
+ <xsl:for-each select="/ss:Workbook/ss:Styles/ss:Style/ss:Font[ generate-id(.) = generate-id(key('same-named-font', concat(@ss:FontName, @x:Family))[1])]">
+ <xsl:sort select="name()"/>
+ <xsl:element name="style:font-face">
+ <xsl:if test="@ss:FontName">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@ss:FontName"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:font-family">
+ <xsl:value-of select="@ss:FontName"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@x:Family">
+ <xsl:attribute name="style:font-family-generic">
+ <xsl:call-template name="translate-font-family-generic">
+ <xsl:with-param name="family" select="@x:Family"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell/descendant::html:Font[@html:Face][ generate-id(.) = generate-id(key('same-named-face', concat(@html:Face, @x:Family))[1])]">
+ <xsl:sort select="name()"/>
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@html:Face"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:font-family">
+ <xsl:value-of select="@html:Face"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-family-generic">
+ <xsl:call-template name="translate-font-family-generic">
+ <xsl:with-param name="family" select="@x:Family"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </office:font-face-decls>
+ </xsl:template>
+ <xsl:template name="translate-font-family-generic">
+ <xsl:param name="family"/>
+ <xsl:choose>
+ <xsl:when test="$family='Swiss'">swiss</xsl:when>
+ <xsl:when test="$family='Modern'">modern</xsl:when>
+ <xsl:when test="$family='Roman'">roman</xsl:when>
+ <xsl:when test="$family='Script'">script</xsl:when>
+ <xsl:when test="$family='Decorative'">decorative</xsl:when>
+ <!-- change 'System' to 'Automatic' for Excel -->
+ <xsl:when test="$family='Automatic'">system</xsl:when>
+ <xsl:otherwise>system</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Workbook/ss:Worksheet" mode="styles">
+ <office:styles>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[@ss:Name]"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style/ss:NumberFormat[@ss:Format]"/>
+ <!-- if ConditionalFormatting exists,it should generate some styles for style:style -->
+ <xsl:if test="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:call-template name="CondFormat_office_style"/>
+ </xsl:if>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/ss:Table"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[not(@ss:Name)]"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style/ss:Font[@ss:VerticalAlign]"/>
+ <!-- applying to ss:Data (but *, as also ss:Data nested in ss:Comments -->
+ <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell/*[descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40']]"/>
+ <xsl:apply-templates select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions/x:PageSetup//@x:Data"/>
+ <!-- if ConditionalFormatting exists,transforing the styles -->
+ <xsl:if test="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:call-template name="CondFormat_automatic_style"/>
+ </xsl:if>
+ <xsl:call-template name="create-page-master">
+ <xsl:with-param name="worksheetoptions" select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions"/>
+ </xsl:call-template>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:call-template name="create-master-styles">
+ <xsl:with-param name="worksheetoptions" select="/ss:Workbook/ss:Worksheet/x:WorksheetOptions"/>
+ </xsl:call-template>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template name="CondFormat_office_style">
+ <!-- translate the ConditionalFormatting style,including font,size,color,etc -->
+ <xsl:for-each select="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:variable name="table-pos" select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="conditions" select="count(preceding-sibling::x:ConditionalFormatting)+1"/>
+ <!-- Matching multiple styles, but automatic styles are not allowed to inherit from another automatic style
+ <xsl:for-each select="key('tableStyleIDs', key('tableWithConditional', .))
+ [generate-id(.) =
+ generate-id(key('styleId', .)[1])] ">
+ <xsl:sort select="." />
+
+ <xsl:apply-templates select="/ss:Workbook/ss:Styles/ss:Style[@ss:ID = current()/.]"/>
+ </xsl:for-each>
+ -->
+ <xsl:for-each select="x:Condition">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::x:Condition)+1"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:apply-templates select="@ss:Name" />
+ <xsl:element name="style:table-cell-properties">
+ <xsl:choose>
+ <xsl:when test="x:Format/@Style">
+ <xsl:variable name="stylevalue" select="./x:Format/@Style"/>
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="x:Format/@Style">
+ <xsl:variable name="stylevalue" select="./x:Format/@Style"/>
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-style">
+ <xsl:value-of select="'italic'"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">
+ <xsl:value-of select="'single'"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:text-underline-color">
+ <xsl:value-of select="'font-color'"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:font-weight">
+ <xsl:value-of select="'bold'"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="@ss:Name">
+ <xsl:attribute name="style:display-name">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-table-cell">
+ <!-- generates style:style for ConditionalFormatting -->
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="normalize-space($style-value-t)"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'background')">
+ <xsl:choose>
+ <xsl:when test="contains($style-value,'mso-pattern')">
+ <xsl:variable name="color-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-after($style-value,'mso-pattern'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-color" select="substring-after($mso-value,'#')"/>
+ <xsl:variable name="pattern-color-value" select="substring($mso-color,1,6)"/>
+ <xsl:variable name="pattern" select="concat('0.',normalize-space(substring-before(substring-after($mso-color,'gray-'),';')))"/>
+ <xsl:variable name="pattern-color">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="$pattern"/>
+ <xsl:with-param name="color-value" select="$color-value"/>
+ <xsl:with-param name="pattern-color-value" select="concat('#',$pattern-color-value)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="normalize-space($pattern-color)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:background-color">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'border')">
+ <xsl:attribute name="fo:border">
+ <xsl:value-of select="'0.002cm solid #000000'"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-text">
+ <!-- generates style:style for ConditionalFormatting -->
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="normalize-space($style-value-t)"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'color')">
+ <xsl:attribute name="fo:color">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-style')">
+ <xsl:attribute name="fo:font-style">
+ <xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-weight')">
+ <xsl:variable name="font-weight" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ <xsl:attribute name="fo:font-weight">
+ <xsl:choose>
+ <xsl:when test="($font-weight &gt; 300) and ($font-weight &lt; 500)">
+ <xsl:value-of select="'normal'"/>
+ </xsl:when>
+ <xsl:when test="($font-weight &gt; 500) or ($font-weight = 500)">
+ <xsl:value-of select="'bold'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'text-underline-style')">
+ <xsl:attribute name="style:text-underline-type">
+ <xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:text-underline-color">
+ <xsl:value-of select="'#000000'"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="translate-color-style">
+ <!-- translate the word of color to hex code of color -->
+ <xsl:param name="source-str"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'#')">
+ <xsl:value-of select="$source-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'black')">
+ <xsl:value-of select="'#000000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'maroon')">
+ <xsl:value-of select="'#800000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'red')">
+ <xsl:value-of select="'#FF0000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'fuchsia')">
+ <xsl:value-of select="'#FF00FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'olive')">
+ <xsl:value-of select="'#808000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'yellow')">
+ <xsl:value-of select="'#FFFF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'green')">
+ <xsl:value-of select="'#008000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'lime')">
+ <xsl:value-of select="'#00FF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'teal')">
+ <xsl:value-of select="'#008080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'aqua')">
+ <xsl:value-of select="'#00FFFF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'navy')">
+ <xsl:value-of select="'#000080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'blue')">
+ <xsl:value-of select="'#0000FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'purple')">
+ <xsl:value-of select="'#800080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'gray')">
+ <xsl:value-of select="'#808080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'silver')">
+ <xsl:value-of select="'#C0C0C0'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'white')">
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:key match="/ss:Workbook/ss:Worksheet/ss:Table" name="tableWithConditional" use="following-sibling::x:ConditionalFormatting"/>
+ <xsl:key match="ss:Table/ss:Row/ss:Cell/@ss:StyleID" name="tableStyleIDs" use="ancestor::ss:Table"/>
+ <xsl:key name="styleId" match="@ss:StyleID" use="."/>
+ <xsl:template name="CondFormat_automatic_style">
+ <!-- For each conditionalFormatting We inject a new style, which is a child of the current found style -->
+ <xsl:for-each select="/ss:Workbook/ss:Worksheet/x:ConditionalFormatting">
+ <xsl:variable name="table-pos" select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="conditions" select="count(preceding-sibling::x:ConditionalFormatting)+1"/>
+ <xsl:variable name="conditionalFormatting" select="."/>
+ <!-- for all 'ssStyle/@ss:ID's, which are in tables connected within this conditional formatting -->
+ <xsl:for-each select="key('tableStyleIDs', key('tableWithConditional', .)) [generate-id(.) = generate-id(key('styleId', .)[1])] ">
+ <!-- sort the style ID by their naming -->
+ <xsl:sort select="."/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat(.,'-ce',$table-pos,'-',$conditions)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:variable name="style" select="key('Style', .)" />
+ <xsl:choose>
+ <xsl:when test="$style/@ss:Name">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- as we create an automatic style, the parent is not allowed to be an automatic style as well
+ if the parent would be a automatic (unnamed) style, the style information have to be embedded to this style -->
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="$style/@ss:Parent"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="$style/ss:NumberFormat/@ss:Format">
+ <xsl:attribute name="style:data-style-name">
+ <xsl:value-of select="concat($style/@ss:ID, 'F')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="$style" mode="style-style-content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:for-each select="$conditionalFormatting/x:Condition">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::x:Condition)+1"/>
+ <xsl:variable name="base-address">
+ <xsl:choose>
+ <xsl:when test="contains(../x:Range,',')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before(../x:Range,','),':')">
+ <xsl:value-of select="substring-before(substring-after(../x:Range,':'),',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(../x:Range,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../x:Range"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="columnNumber">
+ <xsl:choose>
+ <xsl:when test="contains($base-address, ':')">
+ <xsl:value-of select="substring-after(substring-after($base-address, ':'),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($base-address,'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rowNumber">
+ <xsl:choose>
+ <xsl:when test="contains($base-address, ':')">
+ <xsl:value-of select="substring-before(substring-after(substring-after($base-address, ':'),'R'),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($base-address,'R'),'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="base-cell-address">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$columnNumber"/>
+ <xsl:with-param name="row-number" select="$rowNumber"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-value">
+ <xsl:call-template name="translate-condition">
+ <xsl:with-param name="cell-column-pos" select="$columnNumber"/>
+ <xsl:with-param name="cell-row-pos" select="$rowNumber"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:attribute name="style:condition">
+ <xsl:value-of select="$condition-value"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:apply-style-name">
+ <xsl:value-of select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:base-cell-address">
+ <xsl:value-of select="concat(../../@ss:Name,'.',$base-cell-address)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="translate-condition">
+ <xsl:param name="cell-row-pos"/>
+ <xsl:param name="cell-column-pos"/>
+ <!-- translates the condition to generate formula -->
+ <xsl:variable name="address-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="x:Value1"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="x:Qualifier">
+ <xsl:variable name="qualifier" select="x:Qualifier"/>
+ <xsl:variable name="first-value" select="x:Value1"/>
+ <xsl:choose>
+ <xsl:when test="$qualifier = 'Equal'">
+ <xsl:choose>
+ <xsl:when test="starts-with($first-value,'&quot;')">
+ <xsl:value-of select="concat('cell-content()=',$address-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content()=[',$address-value,']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Less'">
+ <xsl:value-of select="concat('cell-content()&lt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Greater'">
+ <xsl:value-of select="concat('cell-content()&gt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'LessOrEqual'">
+ <xsl:value-of select="concat('cell-content()&lt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'GreaterOrEqual'">
+ <xsl:value-of select="concat('cell-content()&gt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotEqual'">
+ <xsl:value-of select="concat('cell-content()!=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Between'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="x:Value2"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotBetween'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="x:Value2"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-not-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('is-true-formula(',$address-value,')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- Used in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key match="/ss:Workbook/ss:Worksheet/ss:Table/ss:Row/ss:Cell" name="cells" use="@ss:StyleID"/>
+ <xsl:template match="ss:NumberFormat">
+ <xsl:variable name="unit-count" select="string-length(@ss:Format) - string-length(translate(@ss:Format,';','')) + 1"/>
+ <xsl:variable name="proto-style-id" select="../@ss:ID"/>
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="@ss:Format"/>
+ <xsl:with-param name="style-id" select="concat($proto-style-id,'F')"/>
+ <xsl:with-param name="format-type" select="key('cells', $proto-style-id)/ss:Data/@ss:Type"/>
+ <xsl:with-param name="total-unit" select="$unit-count"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:template>
+ <!-- Note: conditions appearing only once at the beginning are mixed with others -->
+ <xsl:template name="process-number-format-unit">
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="style-id"/>
+ <xsl:param name="format-type"/>
+ <xsl:param name="total-unit"/>
+ <xsl:param name="current-unit"/>
+ <xsl:choose>
+ <!-- if total-unit > 1 and the last unit is just @, delete it -->
+ <xsl:when test="$current-unit = 0 and $total-unit &gt; 1 and substring( $number-format-unit, string-length($number-format-unit) - 1) = ';@'">
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring( $number-format-unit, 1, string-length($number-format-unit) - 2)"/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit - 1"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- $number-format-unit enum values: General, General Number, General Date, Long Date, Medium Date, Short Date, Long Time,
+ Medium Time, Short Time, Currency, Euro Currency, Fixed, Standard, Percent, Scientific, Yes/No, True/False, On/Off -->
+ <xsl:when test="$number-format-unit = 'Currency'">
+ <number:currency-style style:name="{concat( $style-id, 'P1')}" style:volatile="true">
+ <number:text>$</number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </number:currency-style>
+ <number:currency-style style:name="{$style-id}">
+ <style:text-properties fo:color="#ff0000"/>
+ <number:text>$-</number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="{concat( $style-id, 'P1')}"/>
+ </number:currency-style>
+ </xsl:when>
+ <xsl:when test="$number-format-unit = 'Euro Currency'">
+ <number:currency-style style:name="{concat( $style-id, 'P1')}" style:volatile="true">
+ <number:text>€ </number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </number:currency-style>
+ <number:currency-style style:name="{$style-id}">
+ <style:text-properties fo:color="#ff0000"/>
+ <number:text>(€ </number:text>
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text>)</number:text>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="{concat( $style-id, 'P1')}"/>
+ </number:currency-style>
+ </xsl:when>
+ <xsl:when test="$number-format-unit = 'Yes/No' or $number-format-unit = 'True/False' or $number-format-unit = 'On/Off'">
+ <xsl:variable name="left-code" select="substring-before( $number-format-unit, '/')"/>
+ <xsl:variable name="right-code" select="substring-after( $number-format-unit, '/')"/>
+ <number:number-style style:name="{concat( $style-id, 'P1')}" style:volatile="true">
+ <number:text>
+ <xsl:value-of select="$left-code"/>
+ </number:text>
+ </number:number-style>
+ <number:number-style style:name="{concat( $style-id, 'P2')}" style:volatile="true">
+ <number:text>
+ <xsl:value-of select="$left-code"/>
+ </number:text>
+ </number:number-style>
+ <number:number-style style:name="{$style-id}">
+ <number:text>
+ <xsl:value-of select="$right-code"/>
+ </number:text>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="{concat( $style-id, 'P1')}"/>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="{concat( $style-id, 'P2')}"/>
+ </number:number-style>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$total-unit &gt; 1 and $current-unit = 0">
+ <!-- still complete number format string of multiple sub-formats, split them out -->
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/>
+ <xsl:with-param name="style-id" select="concat($style-id,'P1')"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="1"/>
+ </xsl:call-template>
+ <xsl:if test="$total-unit &gt; 2">
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after($number-format-unit,';'),';')"/>
+ <xsl:with-param name="style-id" select="concat($style-id,'P2')"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="2"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$total-unit &gt; 3">
+ <!-- four sub number format -->
+ <xsl:call-template name="process-number-format-unit">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after(substring-after($number-format-unit,';'),';'),';')"/>
+ <xsl:with-param name="style-id" select="concat($style-id,'P3')"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="3"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <!-- symbol number format converted, below deal with ordinary number formatting -->
+ <xsl:variable name="current-number-format-unit">
+ <xsl:choose>
+ <xsl:when test="$total-unit = 1 and $current-unit = 0">
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:when>
+ <xsl:when test="$total-unit = 2 and $current-unit = 0">
+ <xsl:value-of select="substring-after($number-format-unit,';')"/>
+ </xsl:when>
+ <xsl:when test="$total-unit = 3 and $current-unit = 0">
+ <xsl:value-of select="substring-after(substring-after($number-format-unit,';'),';')"/>
+ </xsl:when>
+ <xsl:when test="$current-unit = 0">
+ <!-- the forth sub number format -->
+ <xsl:value-of select="substring-after(substring-after(substring-after($number-format-unit,';'),';'),';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- not the default sub number format, glu -->
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="style-type-name">
+ <xsl:choose>
+ <xsl:when test="($format-type = 'Number' and contains($current-number-format-unit,'[$') and not(contains($current-number-format-unit,'[$-') ) ) or contains($current-number-format-unit,'Currency') ">number:currency-style</xsl:when>
+ <xsl:when test="($format-type = 'Number' and (contains($current-number-format-unit,'%') or contains($current-number-format-unit, 'Percent') ) ) or contains($current-number-format-unit,'Percent') ">number:percentage-style</xsl:when>
+ <xsl:when test="($format-type = 'DateTime' or $format-type = 'String') and (contains($current-number-format-unit,'y') or contains($current-number-format-unit,'g') or contains($current-number-format-unit,'d') or contains($current-number-format-unit, 'Date') )">number:date-style</xsl:when>
+ <xsl:when test="($format-type = 'DateTime' or $format-type = 'String') and ( contains($current-number-format-unit,'h') or contains($current-number-format-unit,'m') or contains($current-number-format-unit,'s') or contains($current-number-format-unit, 'Time') )">number:time-style</xsl:when>
+ <xsl:when test="contains($current-number-format-unit, 'Number') or contains($current-number-format-unit, 'General') or contains($current-number-format-unit, 'Fixed') or contains($current-number-format-unit, 'Standard') or contains($current-number-format-unit, 'Scientific') or ( contains($current-number-format-unit,'#') or contains($current-number-format-unit,'0') or contains($current-number-format-unit,'?') )">number:number-style</xsl:when>
+ <xsl:when test="$format-type = 'Boolean'">number:boolean-style</xsl:when>
+ <xsl:otherwise>number:text-style</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$style-type-name}">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="$style-id"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="@ss:Name" />
+ <!-- removed in OASIS XML
+ <xsl:attribute name="style:family">data-style</xsl:attribute>-->
+ <xsl:if test="$current-unit &gt; 0">
+ <xsl:attribute name="style:volatile">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains ( $current-number-format-unit, '[h]') or contains ( $current-number-format-unit, '[m]') or contains ( $current-number-format-unit, '[s]')">
+ <xsl:attribute name="number:truncate-on-overflow">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($current-number-format-unit,'[$') or contains($current-number-format-unit, '[DBNum')">
+ <xsl:call-template name="create-language-country-attribute">
+ <xsl:with-param name="attribute-code" select="substring-before(substring-after(substring-after($current-number-format-unit,'[$'),'-'),']')"/>
+ <xsl:with-param name="number-code-style" select="substring-before( substring-after($current-number-format-unit,'[DBNum'),']')"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="contains( $current-number-format-unit, '[')">
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="contains( $current-number-format-unit, '[Red')">
+ <xsl:attribute name="fo:color">#ff0000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Black')">
+ <xsl:attribute name="fo:color">#000000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Blue')">
+ <xsl:attribute name="fo:color">#0000ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Cyan')">
+ <xsl:attribute name="fo:color">#00ffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Green')">
+ <xsl:attribute name="fo:color">#00ff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Magenta')">
+ <xsl:attribute name="fo:color">#ff00ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[White')">
+ <xsl:attribute name="fo:color">#ffffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $current-number-format-unit, '[Yellow')">
+ <xsl:attribute name="fo:color">#ffff00</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <!-- the type of condition-pos:1,the former third part of General; 2, the last General. the methods handling diffirent -->
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$current-number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="1"/>
+ <xsl:with-param name="condition-pos">
+ <xsl:choose>
+ <xsl:when test="$current-unit = 1 or $current-unit = 2 or $current-unit = 3">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="$current-unit = 0 and not(contains($number-format-unit, ';'))">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ <!-- creat style:map for other sub number formats -->
+ <xsl:if test="$current-unit = 0 and $total-unit &gt; 1">
+ <xsl:variable name="style-condition1">
+ <xsl:call-template name="get-number-format-condition">
+ <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($style-condition1) &gt; 0">
+ <style:map style:condition="{concat('value()',$style-condition1)}" style:apply-style-name="{concat($style-id,'P1')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$total-unit = 2">
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="{concat($style-id,'P1')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="{concat($style-id,'P1')}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$total-unit &gt; 2">
+ <xsl:variable name="style-condition2">
+ <xsl:call-template name="get-number-format-condition">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after($number-format-unit,';'),';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($style-condition2) &gt; 0">
+ <style:map style:condition="{concat('value()',$style-condition2)}" style:apply-style-name="{concat($style-id,'P2')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="{concat($style-id,'P2')}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$total-unit &gt; 3">
+ <!-- four sub number formats, glu -->
+ <xsl:variable name="style-condition3">
+ <xsl:call-template name="get-number-format-condition">
+ <xsl:with-param name="number-format-unit" select="substring-before(substring-after(substring-after($number-format-unit,';'),';'),';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($style-condition3) &gt; 0">
+ <style:map style:condition="{concat('value()',$style-condition3)}" style:apply-style-name="{concat($style-id,'P3')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:map style:condition="value()=0" style:apply-style-name="{concat($style-id,'P3')}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-language-country-attribute">
+ <xsl:param name="attribute-code"/>
+ <xsl:param name="number-code-style"/>
+ <!-- convert Microsoft List of Locale ID (LCID) to language and country codes according to ISO-639 and ISO-3166.
+ Reference:
+ http://www.loc.gov/standards/iso639-2/langcodes.html
+ http://etext.lib.virginia.edu/tei/iso639.html
+ http://nl.ijs.si/gnusl/cee/std/ISO_3166.html
+ http://xml.coverpages.org/ripe3166.txt
+ http://www.worldlanguage.com/
+ http://www.ethnologue.com/
+ glu -->
+ <!-- the variables of language-country-code and number-shape-code transformed to decimal format -->
+ <xsl:variable name="language-country-code">
+ <xsl:variable name="temp-code">
+ <xsl:choose>
+ <xsl:when test="string-length($attribute-code) &lt;= 4">
+ <xsl:value-of select="$attribute-code"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($attribute-code,string-length($attribute-code) - 3)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$temp-code"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($temp-code)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($attribute-code) &gt; 4 or string-length($number-code-style) &gt; 0">
+ <xsl:variable name="number-shape-code">
+ <xsl:variable name="temp-code">
+ <xsl:choose>
+ <xsl:when test="string-length($attribute-code) &gt; 4">
+ <xsl:value-of select="substring($attribute-code, 1, string-length($attribute-code) - 6)"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$temp-code"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($temp-code)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ <xsl:choose>
+ <!-- Western, #01 -->
+ <xsl:when test="$number-shape-code = 1"/>
+ <!-- Arabic Indic, #02 -->
+ <xsl:when test="$number-shape-code = 2"/>
+ <!-- Extended Arabic Indic, #03 -->
+ <xsl:when test="$number-shape-code = 3"/>
+ <!-- Devanagari (Sanskrit - India), #04-->
+ <xsl:when test="$number-shape-code = 4">
+ <xsl:attribute name="number:transliteration-language">sa</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Bengali (India), #05 -->
+ <xsl:when test="$number-shape-code = 5">
+ <xsl:attribute name="number:transliteration-language">bn</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Gurmukhi (Punjabi - India), #06 -->
+ <xsl:when test="$number-shape-code = 6">
+ <xsl:attribute name="number:transliteration-language">pa</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Gujarati (India), #07 -->
+ <xsl:when test="$number-shape-code = 7">
+ <xsl:attribute name="number:transliteration-language">gu</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Oriya (India), #08 -->
+ <xsl:when test="$number-shape-code = 8">
+ <xsl:attribute name="number:transliteration-language">or</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Tamil (India), #09 -->
+ <xsl:when test="$number-shape-code = 9">
+ <xsl:attribute name="number:transliteration-language">ta</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Telugu (India), #0a -->
+ <xsl:when test="$number-shape-code = 10">
+ <xsl:attribute name="number:transliteration-language">te</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Kannada (India), #0b -->
+ <xsl:when test="$number-shape-code = 11">
+ <xsl:attribute name="number:transliteration-language">kn</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Malayalam (India), #0c -->
+ <xsl:when test="$number-shape-code = 12">
+ <xsl:attribute name="number:transliteration-language">ml</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">IN</xsl:attribute>
+ </xsl:when>
+ <!-- Thai, #0d -->
+ <xsl:when test="$number-shape-code = 13">
+ <xsl:attribute name="number:transliteration-language">th</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TH</xsl:attribute>
+ </xsl:when>
+ <!-- Lao, #0e -->
+ <xsl:when test="$number-shape-code = 14">
+ <xsl:attribute name="number:transliteration-language">lo</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">LA</xsl:attribute>
+ </xsl:when>
+ <!-- Tibetan (China), #0f -->
+ <xsl:when test="$number-shape-code = 15">
+ <xsl:attribute name="number:transliteration-language">bo</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Myanmar (Burma), #10 -->
+ <xsl:when test="$number-shape-code = 16">
+ <xsl:attribute name="number:transliteration-language">my</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">MM</xsl:attribute>
+ </xsl:when>
+ <!-- Ethiopic (Geez), #11 -->
+ <xsl:when test="$number-shape-code = 17">
+ <xsl:attribute name="number:transliteration-language">gez</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">ET</xsl:attribute>
+ </xsl:when>
+ <!-- Khmer (Cambodian), #12-->
+ <xsl:when test="$number-shape-code = 18">
+ <xsl:attribute name="number:transliteration-language">km</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KH</xsl:attribute>
+ </xsl:when>
+ <!-- Mongolian, #13 -->
+ <xsl:when test="$number-shape-code = 19">
+ <xsl:attribute name="number:transliteration-language">mn</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Japanese 1 ([DBNum1]) , #1b, #0411 -->
+ <xsl:when test="$number-shape-code = 27 or ($number-code-style = '1' and $language-country-code = 1041)">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ja</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">JP</xsl:attribute>
+ </xsl:when>
+ <!-- Japanese 2 ([DBNum2]) ,#1c, #0411 -->
+ <xsl:when test="$number-shape-code = 28 or ($number-code-style = '2' and $language-country-code = 1041 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ja</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">JP</xsl:attribute>
+ </xsl:when>
+ <!-- Japanese 3 ([DBNum3]), #1d, #0411 -->
+ <xsl:when test="$number-shape-code = 29 or ($number-code-style = '3' and $language-country-code = 1041 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ja</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">JP</xsl:attribute>
+ </xsl:when>
+ <!-- Simplified Chinese 1 ([DBNum1]), #1e, #0804 -->
+ <xsl:when test="$number-shape-code = 30 or ($number-code-style = '1' and $language-country-code = 2052 )">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Simplified Chinese 2 ([DBNum2]),#1f,#0804 -->
+ <xsl:when test="$number-shape-code = 31 or ($number-code-style = '2' and $language-country-code = 2052 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Simplified Chinese 3 ([DBNum3]), #20,#0804 -->
+ <xsl:when test="$number-shape-code = 32 or ($number-code-style = '3' and $language-country-code = 2052 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:when>
+ <!-- Traditional Chinese 1 ([DBNum1]), #21, #0404 -->
+ <xsl:when test="$number-shape-code = 33 or ($number-code-style = '1' and $language-country-code = 1028 )">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TW</xsl:attribute>
+ </xsl:when>
+ <!-- Traditional Chinese 2 ([DBNum2]), #22, #0404 -->
+ <xsl:when test="$number-shape-code = 34 or ($number-code-style = '2' and $language-country-code = 1028 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TW</xsl:attribute>
+ </xsl:when>
+ <!-- Traditional Chinese 3 ([DBNum3]),#23, #0404 -->
+ <xsl:when test="$number-shape-code = 35 or ($number-code-style = '3' and $language-country-code = 1028 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">TW</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 1 ([DBNum1]), #24, #0412 -->
+ <xsl:when test="$number-shape-code = 36 or ($number-code-style = '1' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 2 ([DBNum2]), #25, #0412 -->
+ <xsl:when test="$number-shape-code = 37 or ($number-code-style = '2' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 3 ([DBNum3]), #26, #0412 -->
+ <xsl:when test="$number-shape-code = 38 or ($number-code-style = '3' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ <!-- Korean 4 ([DBNum4]), #27, #0412 -->
+ <xsl:when test="$number-shape-code = 39 or ($number-code-style = '4' and $language-country-code = 1042 )">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-language">ko</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">KR</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <!-- components of a format code: two digits for number shape codes, two for calendar types, four for LCID -->
+ <xsl:choose>
+ <!-- totally 223 language-country LCID codes, manually created, among which MS Office 2003 supports 134, OOo supports 91 -->
+ <xsl:when test="$language-country-code = 1078">
+ <!-- Afrikaans - South Africa, #0436 -->
+ <xsl:attribute name="number:language">af</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1052">
+ <!-- Albanian - Albania, #041c -->
+ <xsl:attribute name="number:language">sq</xsl:attribute>
+ <xsl:attribute name="number:country">AL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1118">
+ <!-- Amharic - Ethiopia, #045e -->
+ <xsl:attribute name="number:language">am</xsl:attribute>
+ <xsl:attribute name="number:country">ET</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1025">
+ <!-- Arabic - Saudi Arabia, #0401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">SA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5121">
+ <!-- Arabic - Algeria, #1401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">DZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15361">
+ <!-- Arabic - Bahrain, #3c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">BH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3073">
+ <!-- Arabic - Egypt, #0c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">EG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2049">
+ <!-- Arabic - Iraq, #0801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">IQ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11265">
+ <!-- Arabic - Jordan, #2c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">JO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13313">
+ <!-- Arabic - Kuwait, #3401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">KW</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12289">
+ <!-- Arabic - Lebanon, #3001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">LB</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4097">
+ <!-- Arabic - Libya, #1001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">LY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6145">
+ <!-- Arabic - Morocco, #1801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">MA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8193">
+ <!-- Arabic - Oman, #2001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">OM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 16385">
+ <!-- Arabic - Qatar, #4001 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">QA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10241">
+ <!-- Arabic - Syria, #2801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">SY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 7169">
+ <!-- Arabic - Tunisia, #1c01 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">TN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14337">
+ <!-- Arabic - U.A.E., #3801 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">AE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9217">
+ <!-- Arabic - Yemen, #2401 -->
+ <xsl:attribute name="number:language">ar</xsl:attribute>
+ <xsl:attribute name="number:country">YE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1067">
+ <!-- Armenian - Armenia, #042b -->
+ <xsl:attribute name="number:language">hy</xsl:attribute>
+ <xsl:attribute name="number:country">AM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1101">
+ <!-- Assamese, #044d -->
+ <xsl:attribute name="number:language">as</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2092">
+ <!-- Azeri - Cyrillic, #082c -->
+ <xsl:attribute name="number:language">az</xsl:attribute>
+ <xsl:attribute name="number:country">AZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1068">
+ <!-- Azeri - Latin, #042c -->
+ <xsl:attribute name="number:language">az</xsl:attribute>
+ <xsl:attribute name="number:country">AZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1069">
+ <!-- Basque - France/Spain, #042d -->
+ <xsl:attribute name="number:language">eu</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1059">
+ <!-- Belarusian - Belarus, #0423 -->
+ <xsl:attribute name="number:language">be</xsl:attribute>
+ <xsl:attribute name="number:country">BY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1093">
+ <!-- Bengali (India), #0445 -->
+ <xsl:attribute name="number:language">bn</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2117">
+ <!-- Bengali (Bangladesh), #0845 -->
+ <xsl:attribute name="number:language">bn</xsl:attribute>
+ <xsl:attribute name="number:country">BD</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5146">
+ <!-- Bosnian (Bosnia/Herzegovina), #141a -->
+ <xsl:attribute name="number:language">bs</xsl:attribute>
+ <xsl:attribute name="number:country">BA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1026">
+ <!-- Bulgarian, #0402 -->
+ <xsl:attribute name="number:language">bg</xsl:attribute>
+ <xsl:attribute name="number:country">BG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1109">
+ <!-- Burmese (Burma/Myanmar), #0455 -->
+ <xsl:attribute name="number:language">my</xsl:attribute>
+ <xsl:attribute name="number:country">MM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1027">
+ <!-- Catalan - Spain, #0403 -->
+ <xsl:attribute name="number:language">ca</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1116">
+ <!-- Cherokee - United States, #045c -->
+ <xsl:attribute name="number:language">chr</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2052">
+ <!-- Chinese - People's Republic of China, #0804 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4100">
+ <!-- Chinese - Singapore, #1004 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">SG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1028">
+ <!-- Chinese - Taiwan, #0404 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">TW</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3076">
+ <!-- Chinese - Hong Kong SAR, #0c04 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">HK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5124">
+ <!-- Chinese - Macao SAR, #1404 -->
+ <xsl:attribute name="number:language">zh</xsl:attribute>
+ <xsl:attribute name="number:country">MO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1050">
+ <!-- Croatian (Croatia), #041a -->
+ <xsl:attribute name="number:language">hr</xsl:attribute>
+ <xsl:attribute name="number:country">HR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4122">
+ <!-- Croatian (Bosnia/Herzegovina), #101a -->
+ <xsl:attribute name="number:language">hr</xsl:attribute>
+ <xsl:attribute name="number:country">BA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1029">
+ <!-- Czech, #0405 -->
+ <xsl:attribute name="number:language">cs</xsl:attribute>
+ <xsl:attribute name="number:country">CZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1030">
+ <!-- Danish, #0406 -->
+ <xsl:attribute name="number:language">da</xsl:attribute>
+ <xsl:attribute name="number:country">DK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1125">
+ <!-- Divehi, #0465 -->
+ <xsl:attribute name="number:language">dv</xsl:attribute>
+ <xsl:attribute name="number:country">MV</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1043">
+ <!-- Dutch - Netherlands, #0413 -->
+ <xsl:attribute name="number:language">nl</xsl:attribute>
+ <xsl:attribute name="number:country">NL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2067">
+ <!-- Dutch - Belgium, #0813 -->
+ <xsl:attribute name="number:language">nl</xsl:attribute>
+ <xsl:attribute name="number:country">BE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1126">
+ <!-- Edo (Bini - Nigeria), #0466 -->
+ <xsl:attribute name="number:language">bin</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1033">
+ <!-- English - United States, #0409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2057">
+ <!-- English - United Kingdom, #0809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">GB</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3081">
+ <!-- English - Australia, #0c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">AU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10249">
+ <!-- English - Belize, #2809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">BZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4105">
+ <!-- English - Canada, #1009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">CA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9225">
+ <!-- English - Caribbean (Cuba), #2409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">CU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15369">
+ <!-- English - Hong Kong SAR, #3c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">HK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 16393">
+ <!-- English - India, #4009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14345">
+ <!-- English - Indonesia, #3809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">ID</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6153">
+ <!-- English - Ireland, #1809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">IE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8201">
+ <!-- English - Jamaica, #2009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">JM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 17417">
+ <!-- English - Malaysia, #4409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">MY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5129">
+ <!-- English - New Zealand, #1409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">NZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13321">
+ <!-- English - Philippines, #3409 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">PH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 18441">
+ <!-- English - Singapore, #4809 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">SG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 7177">
+ <!-- English - South Africa, #1c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11273">
+ <!-- English - Trinidad, #2c09 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">TT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12297">
+ <!-- English - Zimbabwe, #3009 -->
+ <xsl:attribute name="number:language">en</xsl:attribute>
+ <xsl:attribute name="number:country">ZW</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1061">
+ <!-- Estonian (Estonia), #0425 -->
+ <xsl:attribute name="number:language">et</xsl:attribute>
+ <xsl:attribute name="number:country">EE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1080">
+ <!-- Faroese (Faroe Islands), #0438 -->
+ <xsl:attribute name="number:language">fo</xsl:attribute>
+ <xsl:attribute name="number:country">FO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1065">
+ <!-- Farsi (Persian/Iran), #0429 -->
+ <xsl:attribute name="number:language">fa</xsl:attribute>
+ <xsl:attribute name="number:country">IR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1124">
+ <!-- Filipino (Philippine), #0464 -->
+ <xsl:attribute name="number:language">phi</xsl:attribute>
+ <xsl:attribute name="number:country">PH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1035">
+ <!-- Finnish, #040b -->
+ <xsl:attribute name="number:language">fi</xsl:attribute>
+ <xsl:attribute name="number:country">FI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1036">
+ <!-- French - France, #040c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">FR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2060">
+ <!-- French - Belgium, #080c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">BE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11276">
+ <!-- French - Cameroon, #2c0c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3084">
+ <!-- French - Canada, #0c0c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9228">
+ <!-- French - Congo, #240c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12300">
+ <!-- French - Cote d'Ivoire, #300c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15372">
+ <!-- French - Haiti, #3c0c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">HT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5132">
+ <!-- French - Luxembourg, #140c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">LU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13324">
+ <!-- French - Mali, #340c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">ML</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6156">
+ <!-- French - Monaco, #180c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">MC</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14348">
+ <!-- French - Morocco, #380c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">MA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 58380">
+ <!-- French - North Africa (Algeria), #e40c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">DZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8204">
+ <!-- French - Reunion, #200c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">RE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10252">
+ <!-- French - Senegal, #280c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">SN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4108">
+ <!-- French - Switzerland, #100c -->
+ <xsl:attribute name="number:language">fr</xsl:attribute>
+ <xsl:attribute name="number:country">CH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1122">
+ <!-- Frisian - Netherlands, #0462 -->
+ <xsl:attribute name="number:language">fy</xsl:attribute>
+ <xsl:attribute name="number:country">NL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1127">
+ <!-- Fulfude (Fulah) - Nigeria, #0467 -->
+ <xsl:attribute name="number:language">ff</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1071">
+ <!-- FYRO Macedonian, #042f -->
+ <xsl:attribute name="number:language">mk</xsl:attribute>
+ <xsl:attribute name="number:country">MK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2108">
+ <!-- Gaelic (Ireland), #083c -->
+ <xsl:attribute name="number:language">gd</xsl:attribute>
+ <xsl:attribute name="number:country">IE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1084">
+ <!-- Gaelic (Scotland), #043c -->
+ <xsl:attribute name="number:language">gd</xsl:attribute>
+ <xsl:attribute name="number:country">GB</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1110">
+ <!-- Galician (Gallegan) - Spain, #0456 -->
+ <xsl:attribute name="number:language">gl</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1079">
+ <!-- Georgian - Georgia, #0437 -->
+ <xsl:attribute name="number:language">ka</xsl:attribute>
+ <xsl:attribute name="number:country">GE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1031">
+ <!-- German - Germany, #0407 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">DE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3079">
+ <!-- German - Austria, #0c07 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">AT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5127">
+ <!-- German - Liechtenstein, #1407 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">LI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4103">
+ <!-- German - Luxembourg, #1007 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">LU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2055">
+ <!-- German - Switzerland, #0807 -->
+ <xsl:attribute name="number:language">de</xsl:attribute>
+ <xsl:attribute name="number:country">CH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1032">
+ <!-- Greek, #0408 -->
+ <xsl:attribute name="number:language">el</xsl:attribute>
+ <xsl:attribute name="number:country">GR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1140">
+ <!-- Guarani - Paraguay, #0474 -->
+ <xsl:attribute name="number:language">gn</xsl:attribute>
+ <xsl:attribute name="number:country">PY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1095">
+ <!-- Gujarati - India, #0447 -->
+ <xsl:attribute name="number:language">gu</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1128">
+ <!-- Hausa - Nigeria, #0468 -->
+ <xsl:attribute name="number:language">ha</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1141">
+ <!-- Hawaiian - US, #0475 -->
+ <xsl:attribute name="number:language">haw</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1037">
+ <!-- Hebrew, #040d -->
+ <xsl:attribute name="number:language">he</xsl:attribute>
+ <xsl:attribute name="number:country">IL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1081">
+ <!-- Hindi (India), #0439 -->
+ <xsl:attribute name="number:language">hi</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1038">
+ <!-- Hungarian - Hungary, #040e -->
+ <xsl:attribute name="number:language">hu</xsl:attribute>
+ <xsl:attribute name="number:country">HU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1129">
+ <!-- Ibibio (Niger-Kordofanian) - Nigeria, #0469 -->
+ <xsl:attribute name="number:language">nic</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1039">
+ <!-- Icelandic, #040f -->
+ <xsl:attribute name="number:language">is</xsl:attribute>
+ <xsl:attribute name="number:country">IS</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1136">
+ <!-- Igbo - Nigeria, #0470 -->
+ <xsl:attribute name="number:language">ig</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1057">
+ <!-- Indonesian, #0421 -->
+ <xsl:attribute name="number:language">id</xsl:attribute>
+ <xsl:attribute name="number:country">ID</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1117">
+ <!-- Inuktitut - US, #045d -->
+ <xsl:attribute name="number:language">iu</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1040">
+ <!-- Italian - Italy, #0410 -->
+ <xsl:attribute name="number:language">it</xsl:attribute>
+ <xsl:attribute name="number:country">IT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2064">
+ <!-- Italian - Switzerland, #0810 -->
+ <xsl:attribute name="number:language">it</xsl:attribute>
+ <xsl:attribute name="number:country">CH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1041">
+ <!-- Japanese, #0411 -->
+ <xsl:attribute name="number:language">ja</xsl:attribute>
+ <xsl:attribute name="number:country">JP</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1099">
+ <!-- Kannada (India), #044b -->
+ <xsl:attribute name="number:language">kn</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1137">
+ <!-- Kanuri - Nigeria, #0471 -->
+ <xsl:attribute name="number:language">kr</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2144">
+ <!-- Kashmiri (India), #0860 -->
+ <xsl:attribute name="number:language">ks</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1120">
+ <!-- Kashmiri (Arabic), #0460 -->
+ <xsl:attribute name="number:language">ks</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1087">
+ <!-- Kazakh, #043f -->
+ <xsl:attribute name="number:language">kk</xsl:attribute>
+ <xsl:attribute name="number:country">KZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1107">
+ <!-- Khmer (Cambodian), #0453 -->
+ <xsl:attribute name="number:language">km</xsl:attribute>
+ <xsl:attribute name="number:country">KH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1111">
+ <!-- Konkani (India), #0457 -->
+ <xsl:attribute name="number:language">kok</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1042">
+ <!-- Korean, #0412 -->
+ <xsl:attribute name="number:language">ko</xsl:attribute>
+ <xsl:attribute name="number:country">KR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1088">
+ <!-- Kyrgyz ( Kirgiz / Cyrillic), #0440 -->
+ <xsl:attribute name="number:language">ky</xsl:attribute>
+ <xsl:attribute name="number:country">KG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1108">
+ <!-- Lao, #0454 -->
+ <xsl:attribute name="number:language">lo</xsl:attribute>
+ <xsl:attribute name="number:country">LA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1142">
+ <!-- Latin, #0476 -->
+ <xsl:attribute name="number:language">la</xsl:attribute>
+ <xsl:attribute name="number:country">IT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1062">
+ <!-- Latvian, #0426 -->
+ <xsl:attribute name="number:language">lv</xsl:attribute>
+ <xsl:attribute name="number:country">LV</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1063">
+ <!-- Lithuanian, #0427 -->
+ <xsl:attribute name="number:language">lt</xsl:attribute>
+ <xsl:attribute name="number:country">LT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1086">
+ <!-- Malay - Malaysia, #043e -->
+ <xsl:attribute name="number:language">ms</xsl:attribute>
+ <xsl:attribute name="number:country">MY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2110">
+ <!-- Malay - Brunei Darussalam, #083e -->
+ <xsl:attribute name="number:language">ms</xsl:attribute>
+ <xsl:attribute name="number:country">BN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1071">
+ <!-- Macedonian (FYROM), #042f -->
+ <xsl:attribute name="number:language">mk</xsl:attribute>
+ <xsl:attribute name="number:country">MK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1100">
+ <!-- Malayalam (India), #044c -->
+ <xsl:attribute name="number:language">ml</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1082">
+ <!-- Maltese, #043a -->
+ <xsl:attribute name="number:language">mt</xsl:attribute>
+ <xsl:attribute name="number:country">MT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1112">
+ <!-- Manipuri (India), #0458 -->
+ <xsl:attribute name="number:language">mni</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1153">
+ <!-- Maori - New Zealand, #0481 -->
+ <xsl:attribute name="number:language">mi</xsl:attribute>
+ <xsl:attribute name="number:country">NZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1102">
+ <!-- Marathi (India), #044e -->
+ <xsl:attribute name="number:language">mr</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1104">
+ <!-- Mongolian (Cyrillic), #0450 -->
+ <xsl:attribute name="number:language">mn</xsl:attribute>
+ <xsl:attribute name="number:country">MN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2128">
+ <!-- Mongolian (Mongolian), #0850 -->
+ <xsl:attribute name="number:language">mn</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1121">
+ <!-- Nepali, #0461 -->
+ <xsl:attribute name="number:language">ne</xsl:attribute>
+ <xsl:attribute name="number:country">NP</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2145">
+ <!-- Nepali (India), #0861 -->
+ <xsl:attribute name="number:language">ne</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1044">
+ <!-- Norwegian (Bokmal), #0414 -->
+ <xsl:attribute name="number:language">nb</xsl:attribute>
+ <xsl:attribute name="number:country">NO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2068">
+ <!-- Norwegian (Nynorsk), #0814 -->
+ <xsl:attribute name="number:language">nn</xsl:attribute>
+ <xsl:attribute name="number:country">NO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1096">
+ <!-- Oriya (India), #0448 -->
+ <xsl:attribute name="number:language">or</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1138">
+ <!-- Oromo (Ethiopia), #0472 -->
+ <xsl:attribute name="number:language">om</xsl:attribute>
+ <xsl:attribute name="number:country">ET</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1145">
+ <!-- Papiamentu (Netherlands Antilles), #0479 -->
+ <xsl:attribute name="number:language">pap</xsl:attribute>
+ <xsl:attribute name="number:country">AN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1123">
+ <!-- Pashto (Afghanistan), #0463 -->
+ <xsl:attribute name="number:language">ps</xsl:attribute>
+ <xsl:attribute name="number:country">AF</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1045">
+ <!-- Polish, #0415 -->
+ <xsl:attribute name="number:language">pl</xsl:attribute>
+ <xsl:attribute name="number:country">PL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1046">
+ <!-- Portuguese - Brazil, #0416 -->
+ <xsl:attribute name="number:language">pt</xsl:attribute>
+ <xsl:attribute name="number:country">BR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2070">
+ <!-- Portuguese - Portugal, #0816 -->
+ <xsl:attribute name="number:language">pt</xsl:attribute>
+ <xsl:attribute name="number:country">PT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1094">
+ <!-- Punjabi, #0446 -->
+ <xsl:attribute name="number:language">pa</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2118">
+ <!-- Punjabi (Pakistan), #0846 -->
+ <xsl:attribute name="number:language">pa</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1131">
+ <!-- Quecha - Blivia, #046b -->
+ <xsl:attribute name="number:language">qu</xsl:attribute>
+ <xsl:attribute name="number:country">BO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2155">
+ <!-- Quecha - Ecuador, #086b -->
+ <xsl:attribute name="number:language">qu</xsl:attribute>
+ <xsl:attribute name="number:country">EC</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3179">
+ <!-- Quecha - peru, #0c6b -->
+ <xsl:attribute name="number:language">qu</xsl:attribute>
+ <xsl:attribute name="number:country">PE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1047">
+ <!-- Rhaeto-Romanic (Italy), #0417 -->
+ <xsl:attribute name="number:language">rm</xsl:attribute>
+ <xsl:attribute name="number:country">IT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1048">
+ <!-- Romanian, #0418 -->
+ <xsl:attribute name="number:language">ro</xsl:attribute>
+ <xsl:attribute name="number:country">RO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2072">
+ <!-- Romanian - Moldova, #0818 -->
+ <xsl:attribute name="number:language">ro</xsl:attribute>
+ <xsl:attribute name="number:country">MD</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1049">
+ <!-- Russian, #0419 -->
+ <xsl:attribute name="number:language">ru</xsl:attribute>
+ <xsl:attribute name="number:country">RU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2073">
+ <!-- Russian - Moldova, #0819 -->
+ <xsl:attribute name="number:language">ru</xsl:attribute>
+ <xsl:attribute name="number:country">MD</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1083">
+ <!-- Sami (Lappish), # (Northern Sami - Sweden), #043b -->
+ <xsl:attribute name="number:language">se</xsl:attribute>
+ <xsl:attribute name="number:country">SE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1103">
+ <!-- Sanskrit (India), #044f -->
+ <xsl:attribute name="number:language">sa</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1132">
+ <!-- Sepedi (Northern Sotho - South Africa), #046c -->
+ <xsl:attribute name="number:language">nso</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3098">
+ <!-- Serbian (Cyrillic - Serbia Yugoslavia), #0c1a -->
+ <xsl:attribute name="number:language">sr</xsl:attribute>
+ <xsl:attribute name="number:country">YU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2074">
+ <!-- Serbian (Latin - Croatia), #081a -->
+ <xsl:attribute name="number:language">sr</xsl:attribute>
+ <xsl:attribute name="number:country">HR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1113">
+ <!-- Sindhi - India,#0459 -->
+ <xsl:attribute name="number:language">sd</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2137">
+ <!-- Sindhi - Pakistan, #0859 -->
+ <xsl:attribute name="number:language">sd</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1115">
+ <!-- Sinhalese - Sri Lanka, #045b -->
+ <xsl:attribute name="number:language">si</xsl:attribute>
+ <xsl:attribute name="number:country">LK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1051">
+ <!-- Slovak, #041b -->
+ <xsl:attribute name="number:language">sk</xsl:attribute>
+ <xsl:attribute name="number:country">SK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1060">
+ <!-- Slovenian, #0424 -->
+ <xsl:attribute name="number:language">sl</xsl:attribute>
+ <xsl:attribute name="number:country">SI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1143">
+ <!-- Somali, #0477 -->
+ <xsl:attribute name="number:language">so</xsl:attribute>
+ <xsl:attribute name="number:country">SO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1070">
+ <!-- Sorbian, #042e -->
+ <xsl:attribute name="number:language">wen</xsl:attribute>
+ <xsl:attribute name="number:country">DE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 3082">
+ <!-- Spanish - Spain (Modern/International Sort), #0c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1034">
+ <!-- Spanish - Spain (Traditional Sort), #040a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">ES</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 11274">
+ <!-- Spanish - Argentina, #2c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">AR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 16394">
+ <!-- Spanish - Bolivia, #400a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">BO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 13322">
+ <!-- Spanish - Chile, #340a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">CL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 9226">
+ <!-- Spanish - Colombia, #240a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">CO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 5130">
+ <!-- Spanish - Costa Rica, #140a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">CR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 7178">
+ <!-- Spanish - Dominican Republic, #1c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">DO</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 12298">
+ <!-- Spanish - Ecuador, #300a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">EC</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 17418">
+ <!-- Spanish - EL Salvador, #440a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">SV</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 4106">
+ <!-- Spanish - Guatemala, #100a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">GT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 18442">
+ <!-- Spanish - Honduras, #480a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">HN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 58378">
+ <!-- Spanish - Latin America (Argentina), #e40a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">AR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2058">
+ <!-- Spanish - Mexico, #080a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">MX</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 19466">
+ <!-- Spanish - Nicaragua, #4c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">NI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 6154">
+ <!-- Spanish - Panama, #180a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 15370">
+ <!-- Spanish - Paraguay, #3c0a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 10250">
+ <!-- Spanish - Peru, #280a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 20490">
+ <!-- Spanish - Puerto Rico, #500a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">PR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 21514">
+ <!-- Spanish - US, #540a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">US</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 14346">
+ <!-- Spanish - Uruguay, #380a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">UY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 8202">
+ <!-- Spanish - Venezuela, #200a -->
+ <xsl:attribute name="number:language">es</xsl:attribute>
+ <xsl:attribute name="number:country">VE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1072">
+ <!-- Sutu (Ngoni - Tanzania), #0430 -->
+ <xsl:attribute name="number:language">bnt</xsl:attribute>
+ <xsl:attribute name="number:country">TZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1089">
+ <!-- Swahili (Tanzania), #0441 -->
+ <xsl:attribute name="number:language">sw</xsl:attribute>
+ <xsl:attribute name="number:country">TZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1053">
+ <!-- Swedish (Sweden), #041d -->
+ <xsl:attribute name="number:language">sv</xsl:attribute>
+ <xsl:attribute name="number:country">SE</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2077">
+ <!-- Swedish - Finland, #081d -->
+ <xsl:attribute name="number:language">sv</xsl:attribute>
+ <xsl:attribute name="number:country">FI</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1114">
+ <!-- Syriac (Syria), #045a -->
+ <xsl:attribute name="number:language">syr</xsl:attribute>
+ <xsl:attribute name="number:country">SY</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1064">
+ <!-- Tajik, #0428 -->
+ <xsl:attribute name="number:language">tg</xsl:attribute>
+ <xsl:attribute name="number:country">TJ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1119">
+ <!-- Tamazight (Arabic), #045f -->
+ <xsl:attribute name="number:language">ber</xsl:attribute>
+ <xsl:attribute name="number:country">ML</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2143">
+ <!-- Tamazight (Latin), #085f -->
+ <xsl:attribute name="number:language">ber</xsl:attribute>
+ <xsl:attribute name="number:country">MA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1097">
+ <!-- Tamil (India), #0449 -->
+ <xsl:attribute name="number:language">ta</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1092">
+ <!-- Tatar (Russia), #0444 -->
+ <xsl:attribute name="number:language">tt</xsl:attribute>
+ <xsl:attribute name="number:country">RU</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1098">
+ <!-- Telugu (India), #044a -->
+ <xsl:attribute name="number:language">te</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1054">
+ <!-- Thai, #041e -->
+ <xsl:attribute name="number:language">th</xsl:attribute>
+ <xsl:attribute name="number:country">TH</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2129">
+ <!-- Tibetan - Bhutan, #0851 -->
+ <xsl:attribute name="number:language">bo</xsl:attribute>
+ <xsl:attribute name="number:country">BT</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1105">
+ <!-- Tibetan - Peoples' Republic of China, #0451 -->
+ <xsl:attribute name="number:language">bo</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2163">
+ <!-- Tigrigna (Tigrinya) - Eritrea, #0873 -->
+ <xsl:attribute name="number:language">ti</xsl:attribute>
+ <xsl:attribute name="number:country">ER</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1139">
+ <!-- Tigrigna (Tigrinya) - Ethiopia, #0473 -->
+ <xsl:attribute name="number:language">ti</xsl:attribute>
+ <xsl:attribute name="number:country">ET</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1073">
+ <!-- Tsonga (South Africa), #0431 -->
+ <xsl:attribute name="number:language">ts</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1074">
+ <!-- Tswana (South Africa), #0432 -->
+ <xsl:attribute name="number:language">tn</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1055">
+ <!-- Turkish, #041f -->
+ <xsl:attribute name="number:language">tr</xsl:attribute>
+ <xsl:attribute name="number:country">TR</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1090">
+ <!-- Turkmen, #0442 -->
+ <xsl:attribute name="number:language">tk</xsl:attribute>
+ <xsl:attribute name="number:country">TM</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1152">
+ <!-- Uighur - China, #0480 -->
+ <xsl:attribute name="number:language">ug</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1058">
+ <!-- Ukrainian, #0422 -->
+ <xsl:attribute name="number:language">uk</xsl:attribute>
+ <xsl:attribute name="number:country">UA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1056">
+ <!-- Urdu (Pakistan), #0420 -->
+ <xsl:attribute name="number:language">ur</xsl:attribute>
+ <xsl:attribute name="number:country">PK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2080">
+ <!-- Urdu - India, #0820 -->
+ <xsl:attribute name="number:language">ur</xsl:attribute>
+ <xsl:attribute name="number:country">IN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 2115">
+ <!-- Uzbek (Cyrillic), #0843 -->
+ <xsl:attribute name="number:language">uz</xsl:attribute>
+ <xsl:attribute name="number:country">UZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1091">
+ <!-- Uzbek (Latin), #0443 -->
+ <xsl:attribute name="number:language">uz</xsl:attribute>
+ <xsl:attribute name="number:country">UZ</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1075">
+ <!-- Venda (South Africa), #0433 -->
+ <xsl:attribute name="number:language">ve</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1066">
+ <!-- Vietnamese, #042a -->
+ <xsl:attribute name="number:language">vi</xsl:attribute>
+ <xsl:attribute name="number:country">VN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1106">
+ <!-- Welsh (UK), #0452 -->
+ <xsl:attribute name="number:language">cy</xsl:attribute>
+ <xsl:attribute name="number:country">UK</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1076">
+ <!-- Xhosa (South Africa), #0434 -->
+ <xsl:attribute name="number:language">xh</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1144">
+ <!-- Yi (Sino-Tibetan - China), #0478 -->
+ <xsl:attribute name="number:language">sit</xsl:attribute>
+ <xsl:attribute name="number:country">CN</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1085">
+ <!-- Yiddish (Jews - Israel), #043d -->
+ <xsl:attribute name="number:language">yi</xsl:attribute>
+ <xsl:attribute name="number:country">IL</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1130">
+ <!-- Yoruba (Nigeria), #046a -->
+ <xsl:attribute name="number:language">yo</xsl:attribute>
+ <xsl:attribute name="number:country">NG</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$language-country-code = 1077">
+ <!-- Zulu (South Africa), #0435 -->
+ <xsl:attribute name="number:language">zu</xsl:attribute>
+ <xsl:attribute name="number:country">ZA</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-format-condition">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="contains($number-format-unit, '[&gt;')">
+ <xsl:value-of select="concat('&gt;', substring-before( substring-after($number-format-unit,'[&gt;'), ']'))"/>
+ </xsl:when>
+ <xsl:when test="contains($number-format-unit, '[&lt;')">
+ <xsl:value-of select="concat('&lt;', substring-before( substring-after($number-format-unit,'[&lt;'), ']'))"/>
+ </xsl:when>
+ <xsl:when test="contains($number-format-unit, '[=')">
+ <xsl:value-of select="concat('=', substring-before( substring-after($number-format-unit,'[='), ']'))"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="add-number-text-value">
+ <xsl:param name="style-type-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="unit-pos"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:param name="isNumberTextElementOpened" select="false()"/>
+ <xsl:param name="numberTextValue"/>
+ <xsl:param name="posed-number-format-unit"/>
+ <xsl:param name="finished" select="false()"/>
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <xsl:choose>
+<!-- <xsl:when test="$style-type-name='number:text-style' or $style-type-name='number:date-style'"> -->
+ <xsl:when test="$style-type-name='number:text-style'">
+ <xsl:choose>
+ <xsl:when test="$isNumberTextElementOpened">
+ <number:text-content/>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ </number:text>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ </number:text>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$style-type-name='number:number-style'">
+ <xsl:choose>
+ <xsl:when test="$isNumberTextElementOpened">
+ <xsl:copy-of select="$numberTextValue"/>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="true()"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </number:text>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:text>
+ <xsl:copy-of select="$numberTextValue"/>
+ </number:text>
+ <xsl:choose>
+ <xsl:when test="starts-with($posed-number-format-unit, '\')">
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="false()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="finished" select="true()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-text-content">
+ <xsl:param name="style-type-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="unit-pos"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:param name="isNumberTextElementOpened" select="false()"/>
+ <xsl:param name="finished" select="false()"/>
+ <xsl:param name="posed-number-format-unit"/>
+ <!-- process number-format-unit by character string parser -->
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, '\') or starts-with( $posed-number-format-unit, '*')">
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <xsl:call-template name="add-number-text-value">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/>
+ <!-- place '*' temparily here, because now StarCalc doesn't support variable filling character definition -->
+ <xsl:with-param name="numberTextValue" select="substring($posed-number-format-unit,2,1)"/>
+ <xsl:with-param name="finished" select="$finished"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos +2)"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '_')">
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <xsl:call-template name="add-number-text-value">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/>
+ <!-- adding an empty string -->
+ <xsl:with-param name="numberTextValue" select="' '"/>
+ <xsl:with-param name="finished" select="$finished"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + 2)"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '&quot;')">
+ <xsl:choose>
+ <xsl:when test="not($finished)">
+ <!-- creating a pre-character string -->
+ <xsl:variable name="pre-character-string" select="substring-before(substring($posed-number-format-unit,2), '&quot;')"/>
+ <xsl:call-template name="add-number-text-value">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length($pre-character-string) + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + string-length($pre-character-string) + 2)"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="numberTextValue" select="$pre-character-string"/>
+ <xsl:with-param name="finished" select="$finished"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- creating a pre-character string -->
+ <xsl:variable name="pre-character-string" select="substring-before(substring($posed-number-format-unit,2), '&quot;')"/>
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length($pre-character-string) + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos + string-length($pre-character-string) + 2)"/>
+ <xsl:with-param name="finished" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$finished">
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-number-format-content">
+ <xsl:param name="style-type-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="unit-pos"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:param name="isNumberTextElementOpened" select="false()"/>
+ <xsl:variable name="posed-number-format-unit" select="substring($number-format-unit,$unit-pos)"/>
+ <xsl:variable name="calendar-type-name">
+ <xsl:if test="contains( $number-format-unit, '[$')">
+ <xsl:variable name="format-code" select="substring-before( substring-after( substring-after( $number-format-unit, '[$'), '-'), ']')"/>
+ <xsl:if test="string-length( $format-code) &gt; 4">
+ <xsl:call-template name="get-calendar-type-name">
+ <xsl:with-param name="calendar-type" select="substring( $format-code, string-length($format-code) -5, 2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:variable>
+ <!-- process number-format-unit by character string parser -->
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[$') and (not(starts-with($posed-number-format-unit, '[$-') ) )">
+ <xsl:element name="number:currency-symbol">
+ <xsl:call-template name="create-language-country-attribute">
+ <xsl:with-param name="attribute-code" select="substring-before(substring-after(substring-after($posed-number-format-unit,'[$'),'-'),']')"/>
+ </xsl:call-template>
+ <xsl:value-of select="substring-before( substring-after( $posed-number-format-unit, '[$'), '-')"/>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length( substring-before( $posed-number-format-unit, ']') ) + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '\') or starts-with( $posed-number-format-unit, '*') or starts-with( $posed-number-format-unit, '_') or starts-with( $posed-number-format-unit, '&quot;')">
+ <xsl:call-template name="get-number-text-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="(starts-with( $posed-number-format-unit, '0') or starts-with( $posed-number-format-unit, '#') or starts-with( $posed-number-format-unit, '?') ) and (not ( contains( $posed-number-format-unit, 's.00') ) )">
+ <xsl:variable name="valid-number-format-string">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '/')">
+ <xsl:element name="number:fraction">
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '/') ) - string-length(translate( substring-before($valid-number-format-string, '/'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:if test="contains( $valid-number-format-string, ',')">
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="number:min-numerator-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '/') ) - string-length(translate( substring-before($valid-number-format-string,'/'), '?', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-denominator-digits">
+ <xsl:value-of select="string-length(substring-after($valid-number-format-string, '/') )"/>
+ </xsl:attribute>
+ <!-- deal with number:embedded-text (removed, as SCHEMA demands element to be empty)
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ -->
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, '%')">
+ <xsl:element name="number:number">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="string-length( substring-before( substring-after( $valid-number-format-string, '.'), '%') ) - string-length( translate( substring-before( substring-after( $valid-number-format-string, '.'), '%'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="number:decimal-places">0</xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '%') ) - string-length(translate( substring-before($valid-number-format-string, '%'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, ',') and (substring( $valid-number-format-string,string-length($valid-number-format-string)) = ',')">
+ <xsl:variable name="display-factor">
+ <xsl:call-template name="get-display-factor">
+ <xsl:with-param name="start-number" select="1"/>
+ <xsl:with-param name="thousand-count" select="string-length($valid-number-format-string) - string-length( translate($valid-number-format-string, ',', '') )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="number:display-factor">
+ <xsl:value-of select="$display-factor"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, ',')">
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- deal with number:embedded-text -->
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:element>
+ <number:text>%</number:text>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, 'E') or contains ($valid-number-format-string, 'e')">
+ <xsl:element name="number:scientific-number">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="string-length( substring-before( substring-after( $valid-number-format-string, '.'), 'E') ) - string-length( translate( substring-before( substring-after( $valid-number-format-string, '.'), 'E'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="number:decimal-places">0</xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, 'E') ) - string-length(translate( substring-before($valid-number-format-string, 'E'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="number:min-exponent-digits">
+ <xsl:value-of select="string-length( substring-after( $valid-number-format-string, 'E') ) - string-length( translate( substring-after( $valid-number-format-string, 'E'), '0', '') )"/>
+ </xsl:attribute>
+ <!-- deal with number:embedded-text -->
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- -normal number format, currency, and accounting, e.g -->
+ <xsl:element name="number:number">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="string-length( substring-after( $valid-number-format-string, '.') ) - string-length( translate( substring-after( $valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( substring-before($valid-number-format-string, '.') ) - string-length(translate( substring-before($valid-number-format-string, '.'), '0', '') )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="number:decimal-places">0</xsl:attribute>
+ <xsl:attribute name="number:min-integer-digits">
+ <xsl:value-of select="string-length( $valid-number-format-string ) - string-length(translate( $valid-number-format-string, '0', '') )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, ',') and (substring( $valid-number-format-string,string-length($valid-number-format-string)) = ',')">
+ <xsl:variable name="display-factor">
+ <xsl:call-template name="get-display-factor">
+ <xsl:with-param name="start-number" select="1"/>
+ <xsl:with-param name="thousand-count">
+ <xsl:call-template name="thousand-count-temp">
+ <xsl:with-param name="format-unit" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="number:display-factor">
+ <xsl:value-of select="$display-factor"/>
+ </xsl:attribute>
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, ',')">
+ <xsl:attribute name="number:grouping">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- deal with number:embedded-text -->
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- deal with post number:text -->
+ <xsl:variable name="post-number-format-text">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$post-number-format-text"/>
+ <xsl:with-param name="unit-pos" select="1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ggg')">
+ <xsl:element name="number:era">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'gg')">
+ <xsl:element name="number:era">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'g')">
+ <xsl:element name="number:era">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ee')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'r')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'yyyy')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'yy')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'e') or starts-with( $posed-number-format-unit, 'y')">
+ <xsl:element name="number:year">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mmmmm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:attribute name="number:textual">true</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 5"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mmmm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:attribute name="number:textual">true</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mmm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:attribute name="number:textual">true</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[mm]')">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[m]')">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mm') and ( contains( $number-format-unit, 'h') or contains( $posed-number-format-unit, 's') )">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'mm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'm') and ( contains( $number-format-unit, 'h') or contains( $posed-number-format-unit, 's') )">
+ <xsl:element name="number:minutes">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'm')">
+ <xsl:element name="number:month">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'dddd') or starts-with( $posed-number-format-unit, 'aaaa')">
+ <xsl:element name="number:day-of-week">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ddd') or starts-with( $posed-number-format-unit, 'aaa')">
+ <xsl:element name="number:day-of-week">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'dd')">
+ <xsl:element name="number:day">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'd')">
+ <xsl:element name="number:day">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="string-length($calendar-type-name) &gt; 0">
+ <xsl:attribute name="number:calendar">
+ <xsl:value-of select="$calendar-type-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'hh')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 2"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[hh]')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'h')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[h]')">
+ <xsl:element name="number:hours">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'AM/PM') or starts-with( $posed-number-format-unit, 'am/pm')">
+ <number:am-pm/>
+ <!-- long: am-pm doesn't support long style yet -->
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 5"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'a/p'or starts-with( $posed-number-format-unit, 'A/P'))">
+ <number:am-pm/>
+ <!-- short: am-pm doesn't support short style yet -->
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ss')">
+ <xsl:variable name="decimal-places">
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, 'ss.0')">
+ <xsl:value-of select="string-length( $posed-number-format-unit) - string-length( translate( $posed-number-format-unit, '0', '') )"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ <xsl:if test="$decimal-places &gt; 0">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="$decimal-places"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:variable name="second-length">
+ <xsl:choose>
+ <xsl:when test="$decimal-places &gt; 0">
+ <xsl:value-of select="$decimal-places + 3"/>
+ </xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + $second-length"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[ss]')">
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">long</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 4"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, 's')">
+ <xsl:variable name="decimal-places">
+ <xsl:choose>
+ <xsl:when test="starts-with( $posed-number-format-unit, 's.0')">
+ <xsl:value-of select="string-length( $posed-number-format-unit) - string-length( translate( $posed-number-format-unit, '0', '') )"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ <xsl:if test="$decimal-places &gt; 0">
+ <xsl:attribute name="number:decimal-places">
+ <xsl:value-of select="$decimal-places"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:variable name="second-length">
+ <xsl:choose>
+ <xsl:when test="$decimal-places &gt; 0">
+ <xsl:value-of select="$decimal-places + 2"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + $second-length"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[s]')">
+ <xsl:element name="number:seconds">
+ <xsl:attribute name="number:style">short</xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 3"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '@')">
+ <number:text-content/>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'General Number'">
+ <number:number number:decimal-places="0" number:min-integer-digits="1"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'General Date'">
+ <number:year number:style="long"/>
+ <number:text>-</number:text>
+ <number:month number:style="short"/>
+ <number:text>-</number:text>
+ <number:day number:style="short"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ <number:hours number:style="short"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ </xsl:when>
+ <!-- special for General number:text-content output -->
+ <xsl:when test="starts-with($posed-number-format-unit , 'General')">
+ <xsl:choose>
+ <xsl:when test="$posed-number-format-unit = 'General' and $condition-pos = 1">
+ <number:number number:decimal-places="0" number:min-integer-digits="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="8"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Fixed'">
+ <number:number number:decimal-places="2" number:min-integer-digits="1"/>
+ <number:text/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Standard'">
+ <number:number number:decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Long Date'">
+ <number:year number:style="long"/>
+ <number:text>-</number:text>
+ <number:month number:style="long"/>
+ <number:text>-</number:text>
+ <number:day number:style="long"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Medium Date'">
+ <number:day number:style="short"/>
+ <number:text>-</number:text>
+ <number:month number:textual="true"/>
+ <number:text>-</number:text>
+ <number:year number:style="short"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Short Date'">
+ <number:day number:style="short"/>
+ <number:text>-</number:text>
+ <number:month number:style="short"/>
+ <number:text>-</number:text>
+ <number:year number:style="short"/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Long Time'">
+ <number:hours number:style="long"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>:</number:text>
+ <number:seconds number:style="long"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ <number:am-pm/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Medium Time'">
+ <number:hours number:style="short"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ <number:am-pm/>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Short Time'">
+ <number:hours number:style="short"/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>
+ <xsl:text> </xsl:text>
+ </number:text>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Percent'">
+ <number:number number:decimal-places="2" number:min-integer-digits="1"/>
+ <number:text>%</number:text>
+ </xsl:when>
+ <xsl:when test="$posed-number-format-unit = 'Scientific'">
+ <number:scientific-number number:decimal-places="2" number:min-integer-digits="1" number:min-exponent-digits="2"/>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '[')">
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + string-length( substring-before( $posed-number-format-unit, ']') ) + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, '/')">
+ <number:text>/</number:text>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( $posed-number-format-unit, ':')">
+ <number:text>:</number:text>
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length( $posed-number-format-unit ) &gt; 0">
+ <xsl:call-template name="create-number-format-content">
+ <xsl:with-param name="style-type-name" select="$style-type-name"/>
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ <xsl:with-param name="unit-pos" select="$unit-pos + 1"/>
+ <xsl:with-param name="condition-pos" select="$condition-pos"/>
+ <xsl:with-param name="isNumberTextElementOpened" select="$isNumberTextElementOpened"/>
+ <xsl:with-param name="posed-number-format-unit" select="$posed-number-format-unit"/>
+ <xsl:with-param name="numberTextValue" select="substring( $posed-number-format-unit, 1, 1)"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="thousand-count-temp">
+ <!-- thousand count for char ',' at the latter of format-unit by recursion -->
+ <xsl:param name="format-unit"/>
+ <xsl:choose>
+ <xsl:when test="contains($format-unit, ',#')">
+ <xsl:call-template name="thousand-count-temp">
+ <xsl:with-param name="format-unit" select="substring-after($format-unit, ',#')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($format-unit, ',0')">
+ <xsl:call-template name="thousand-count-temp">
+ <xsl:with-param name="format-unit" select="substring-after($format-unit, ',0')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($format-unit) - string-length( translate($format-unit, ',', ''))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-calendar-type-name">
+ <xsl:param name="calendar-type"/>
+ <xsl:variable name="temp-type">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$calendar-type"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="string-length($calendar-type)"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- Japanese (Emperor era), #03 -->
+ <xsl:when test="$temp-type = 3">gengou</xsl:when>
+ <!-- Taiwanese, #04 -->
+ <xsl:when test="$temp-type = 4">ROC</xsl:when>
+ <!-- Korean (Tangun era) hanja_yoil is ok too. #05 -->
+ <xsl:when test="$temp-type = 5">hanja</xsl:when>
+ <!-- Hijri (Arabic lunar), #06 -->
+ <xsl:when test="$temp-type = 6">hijri</xsl:when>
+ <!-- Thai, #07 -->
+ <xsl:when test="$temp-type = 7">buddhist</xsl:when>
+ <!-- 01: Gregorian (Localized), 02: Gregorian (United States), 09: Gregorian (Middle East French), 0A: Gregorian (Arabic), 0B: Gregorian (Transliterated English) -->
+ <xsl:otherwise>gregorian</xsl:otherwise>
+ <!-- not found jewish yet -->
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-valid-number-format-string">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="contains( $number-format-unit, '\')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '\'), substring( substring-after( $number-format-unit, '\'), 2) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $number-format-unit, '*')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '*'), substring( substring-after( $number-format-unit, '*'), 2) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $number-format-unit, '_')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '_'), substring( substring-after( $number-format-unit, '_'), 2) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $number-format-unit, '&quot;')">
+ <xsl:call-template name="get-valid-number-format-string">
+ <xsl:with-param name="number-format-unit" select="concat( substring-before( $number-format-unit, '&quot;'), substring-after( substring-after( $number-format-unit, '&quot;'), '&quot;') )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-display-factor">
+ <xsl:param name="start-number"/>
+ <xsl:param name="thousand-count"/>
+ <xsl:choose>
+ <xsl:when test="$thousand-count = 0">
+ <xsl:value-of select="$start-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-display-factor">
+ <xsl:with-param name="start-number" select="$start-number * 1000"/>
+ <xsl:with-param name="thousand-count" select="$thousand-count -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-post-number-format-text">
+ <xsl:param name="adapted-number-format-unit"/>
+ <xsl:param name="valid-number-format-string"/>
+ <xsl:variable name="first-embedded-character-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '\')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '\') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '_')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '_') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '*')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '*') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-string-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '&quot;')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '&quot;') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-text-pos">
+ <xsl:choose>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos = 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos = 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-embedded-text-pos &gt; string-length( $valid-number-format-string )">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos)"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-text-pos &gt; 0 and $first-embedded-text-pos &lt; string-length( $valid-number-format-string )">
+ <xsl:choose>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '\')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '\'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '_')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '_'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '*')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '*'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '&quot;')">
+ <xsl:call-template name="get-post-number-format-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '&quot;'), substring-after( substring-after( $adapted-number-format-unit, '&quot;'), '&quot;') )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-number-format-embedded-text">
+ <xsl:param name="adapted-number-format-unit"/>
+ <xsl:param name="valid-number-format-string"/>
+ <xsl:variable name="first-embedded-character-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '\')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '\') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '_')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '_') ) + 1"/>
+ </xsl:when>
+ <xsl:when test="contains( $adapted-number-format-unit, '*')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '*') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-string-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $adapted-number-format-unit, '&quot;')">
+ <xsl:value-of select="string-length( substring-before($adapted-number-format-unit, '&quot;') ) + 1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-embedded-text-pos">
+ <xsl:choose>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &lt; $first-embedded-string-pos and $first-embedded-character-pos = 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos &gt; 0">
+ <xsl:value-of select="$first-embedded-string-pos"/>
+ </xsl:when>
+ <xsl:when test="$first-embedded-character-pos &gt; $first-embedded-string-pos and $first-embedded-string-pos = 0">
+ <xsl:value-of select="$first-embedded-character-pos"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$first-embedded-text-pos &gt; 0 and $first-embedded-text-pos &lt; string-length( $valid-number-format-string )">
+ <xsl:variable name="text-pos">
+ <xsl:choose>
+ <xsl:when test="contains( $valid-number-format-string, '.')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '.'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, '/')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '/'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, '%')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, '%'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:when test="contains( $valid-number-format-string, 'E')">
+ <xsl:variable name="right-text-pos" select="substring( substring-before( $valid-number-format-string, 'E'), $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="right-text-pos" select="substring( $valid-number-format-string, $first-embedded-text-pos)"/>
+ <xsl:value-of select="string-length($right-text-pos) - string-length( translate( $right-text-pos, '0#?', '') )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '\')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '\'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '_')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '_'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '*')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring( $adapted-number-format-unit, $first-embedded-text-pos + 1, 1)"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '*'), substring( $adapted-number-format-unit, $first-embedded-text-pos + 2) )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with( substring( $adapted-number-format-unit, $first-embedded-text-pos, 1), '&quot;')">
+ <number:embedded-text number:position="{$text-pos}">
+ <xsl:value-of select="substring-before( substring( $adapted-number-format-unit, $first-embedded-text-pos + 1), '&quot;')"/>
+ </number:embedded-text>
+ <xsl:call-template name="create-number-format-embedded-text">
+ <xsl:with-param name="adapted-number-format-unit" select="concat( substring-before( $adapted-number-format-unit, '&quot;'), substring-after( substring-after( $adapted-number-format-unit, '&quot;'), '&quot;') )"/>
+ <xsl:with-param name="valid-number-format-string" select="$valid-number-format-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-master-styles">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat( 'TAB_', ../@ss:Name)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:display-name">
+ <xsl:value-of select="concat( 'PageStyle_', ../@ss:Name)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:page-layout-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat( 'pm_', ../@ss:Name)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Header/@x:Data">
+ <style:header>
+ <xsl:call-template name="translate-header-footer">
+ <xsl:with-param name="content" select="x:PageSetup/x:Header/@x:Data"/>
+ <xsl:with-param name="style-name-header" select="concat(../@ss:Name, substring(name(x:PageSetup/x:Header),1,1))"/>
+ </xsl:call-template>
+ </style:header>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:header style:display="false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Footer/@x:Data">
+ <style:footer>
+ <xsl:call-template name="translate-header-footer">
+ <xsl:with-param name="content" select="x:PageSetup/x:Footer/@x:Data"/>
+ <xsl:with-param name="style-name-header" select="concat(../@ss:Name, substring(name(x:PageSetup/x:Footer),1,1))"/>
+ </xsl:call-template>
+ </style:footer>
+ </xsl:when>
+ <xsl:otherwise>
+ <style:footer style:display="false"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="translate-header-footer">
+ <xsl:param name="content"/>
+ <xsl:param name="style-name-header"/>
+ <style:region-left>
+ <text:p>
+ <xsl:variable name="left-content">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="pos" select="'left'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$left-content"/>
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'L')"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </text:p>
+ </style:region-left>
+ <style:region-center>
+ <text:p>
+ <xsl:variable name="center-content">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="pos" select="'center'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$center-content"/>
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'C')"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </text:p>
+ </style:region-center>
+ <style:region-right>
+ <text:p>
+ <xsl:variable name="right-content">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="pos" select="'right'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$right-content"/>
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'R')"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </text:p>
+ </style:region-right>
+ </xsl:template>
+ <xsl:template name="locate-header-footer-data">
+ <xsl:param name="header-footer-data"/>
+ <xsl:param name="style-name-header"/>
+ <xsl:param name="index"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($header-footer-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;X') or starts-with($current-style-data,'&amp;Y') or starts-with($current-style-data,'&amp;S') or starts-with($current-style-data,'&amp;U') or starts-with($current-style-data,'&amp;E') or starts-with($current-style-data,'&amp;B')">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-pos+2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:variable name="font-size-length">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&amp;')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-pos+1+$font-size-length"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;')">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="string-length(substring-before(substring($header-footer-data,$current-pos+2),'&quot;'))+$current-pos+3"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="current-content-last-pos">
+ <xsl:call-template name="get-current-content-last-pos">
+ <xsl:with-param name="style-data" select="$header-footer-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$current-pos &gt; 1">
+ <text:span text:style-name="{concat($style-name-header,$index)}">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring($header-footer-data,$current-pos,$current-content-last-pos+1-$current-pos)"/>
+ </xsl:call-template>
+ </text:span>
+ <xsl:if test="$current-content-last-pos &lt; string-length($header-footer-data)">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index+1"/>
+ <xsl:with-param name="current-pos" select="$current-content-last-pos+1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring($header-footer-data,$current-pos,$current-content-last-pos+1-$current-pos)"/>
+ </xsl:call-template>
+ <xsl:if test="$current-content-last-pos &lt; string-length($header-footer-data)">
+ <xsl:call-template name="locate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="$header-footer-data"/>
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-content-last-pos+1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-current-content-last-pos">
+ <xsl:param name="style-data"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;') or starts-with($current-style-data,'&amp;X') or starts-with($current-style-data,'&amp;Y') or starts-with($current-style-data,'&amp;S') or starts-with($current-style-data,'&amp;U') or starts-with($current-style-data,'&amp;E') or starts-with($current-style-data,'&amp;B')or starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:value-of select="$current-pos - 1"/>
+ </xsl:when>
+ <xsl:when test="contains($current-style-data,'&amp;&quot;') or contains($current-style-data,'&amp;X') or contains($current-style-data,'&amp;Y') or contains($current-style-data,'&amp;S') or contains($current-style-data,'&amp;U') or contains($current-style-data,'&amp;E') or contains($current-style-data,'&amp;B')or contains($current-style-data,'&amp;0') or contains($current-style-data,'&amp;1') or contains($current-style-data,'&amp;2') or contains($current-style-data,'&amp;3') or contains($current-style-data,'&amp;4') or contains($current-style-data,'&amp;5') or contains($current-style-data,'&amp;6') or contains($current-style-data,'&amp;7') or contains($current-style-data,'&amp;8') or contains($current-style-data,'&amp;9')">
+ <xsl:variable name="temp" select="substring-before(substring($current-style-data,2),'&amp;')"/>
+ <xsl:variable name="next-amp-pos">
+ <xsl:value-of select="$current-pos+string-length($temp)+1"/>
+ </xsl:variable>
+ <xsl:call-template name="get-current-content-last-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$next-amp-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($style-data)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-header-footer-data">
+ <xsl:param name="header-footer-data"/>
+ <xsl:choose>
+ <xsl:when test="contains( $header-footer-data, '&amp;D')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;D')"/>
+ </xsl:call-template>
+ <text:date/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;D')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;T')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;T')"/>
+ </xsl:call-template>
+ <text:time/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;T')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;P')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;P')"/>
+ </xsl:call-template>
+ <text:page-number/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;P')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;N')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;N')"/>
+ </xsl:call-template>
+ <text:page-count/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;N')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;A')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;A')"/>
+ </xsl:call-template>
+ <text:sheet-name/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;A')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;Z&amp;F')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;Z&amp;F')"/>
+ </xsl:call-template>
+ <text:file-name text:display="full"/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;Z&amp;F')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;Z')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;Z')"/>
+ </xsl:call-template>
+ <text:file-name text:display="path"/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;Z')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains( $header-footer-data, '&amp;F')">
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-before( $header-footer-data, '&amp;F')"/>
+ </xsl:call-template>
+ <text:file-name text:display="name"/>
+ <xsl:call-template name="translate-header-footer-data">
+ <xsl:with-param name="header-footer-data" select="substring-after( $header-footer-data, '&amp;F')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$header-footer-data"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-page-master">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat( 'pm_', ../@ss:Name)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Layout/@x:Orientation = 'Landscape'">
+ <xsl:attribute name="style:print-orientation">landscape</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:print-orientation">portrait</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Layout/@x:StartPageNumber">
+ <xsl:attribute name="style:first-page-number">
+ <xsl:value-of select="x:PageSetup/x:Layout/@x:StartPageNumber"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:first-page-number">continue</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="x:PageSetup/x:PageMargins">
+ <xsl:attribute name="fo:margin-top">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Top,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Bottom,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Left,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:PageMargins/@x:Right,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="x:PageSetup/x:Header">
+ <style:header-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Header/@x:Margin">
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:Header/@x:Margin,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-bottom">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </style:header-style>
+ </xsl:if>
+ <xsl:if test="x:PageSetup/x:Footer">
+ <style:footer-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="x:PageSetup/x:Footer/@x:Margin">
+ <xsl:attribute name="fo:margin-top">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(x:PageSetup/x:Footer/@x:Margin,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-top">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </style:footer-style>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="ss:Style" name="style-style-content" mode="style-style-content">
+ <xsl:element name="style:table-cell-properties">
+ <xsl:if test="ss:Alignment">
+ <xsl:if test="ss:Alignment/@ss:Vertical">
+ <xsl:variable name="vertical-align">
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Top'">top</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Center'">middle</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Bottom'">bottom</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Vertical = 'Automatic'">middle</xsl:when>
+ <!-- actually for vertical writen characters, not supported by StarOffice/OpenOffice now yet -->
+ <xsl:otherwise>middle</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="$vertical-align"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:WrapText = '1'">
+ <xsl:attribute name="fo:wrap-option">wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:Indent">
+ <xsl:attribute name="fo:padding-left"><!-- Indent is ten times of a point -->
+ <xsl:variable name="indent" select="ss:Alignment/@ss:Indent * 10"/>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat($indent,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:Rotate">
+ <xsl:attribute name="style:rotation-angle">
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Rotate &lt; 0">
+ <xsl:value-of select="360 + ss:Alignment/@ss:Rotate"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ss:Alignment/@ss:Rotate"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="style:rotation-align">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Alignment/@ss:VerticalText = '1'">
+ <xsl:attribute name="style:direction">ttb</xsl:attribute>
+ <!-- The horizontal align default for vertical text in Excel is 'center' -->
+ <xsl:if test="not(ss:Alignment/@ss:Horizontal)">
+ <!-- OASIS XML removal
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>-->
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="ss:Borders">
+ <xsl:if test="ss:Borders/ss:Border">
+ <xsl:apply-templates select="ss:Borders/ss:Border"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="ss:Interior" mode="style-style-content"/>
+ <xsl:if test="ss:Protection">
+ <xsl:choose>
+ <xsl:when test="ss:Protection/@ss:Protected = '0'">
+ <xsl:choose>
+ <xsl:when test="ss:Protection/@ss:HideFormula = '1'">
+ <xsl:attribute name="style:cell-protect">hidden-and-protected</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Protection/@x:HideFormula = '1'">
+ <xsl:attribute name="style:cell-protect">protected formula-hidden</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!-- fix means the horizontal alignment is dependent on ss:Horizontal,
+ but set on paragaraph properties not cell paragraphs -->
+ <xsl:if test="ss:Alignment/@ss:Horizontal">
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Horizontal">
+ <xsl:element name="style:paragraph-properties">
+ <xsl:variable name="text-align">
+ <xsl:choose>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Left'">start</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Center'">center</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Right'">end</xsl:when>
+ <xsl:when test="ss:Alignment/@ss:Horizontal = 'Justify'">justify</xsl:when>
+ <!-- many other text-align not supported yet -->
+ <xsl:otherwise>start</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:text-align">
+ <xsl:value-of select="$text-align"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- The horizontal align default for vertical text in Excel is 'center' -->
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="ss:Alignment/@ss:VerticalText = '1'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Font">
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:FontName">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="ss:Font/@ss:FontName"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="ss:Font/@ss:FontName"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="ss:Font/@ss:FontName"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Arial</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- "ss:Font/@x:Family" is useless here, so can't map to "svg:font-family" attribute -->
+ <xsl:if test="ss:Font/@ss:Bold = '1'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:Color">
+ <xsl:attribute name="fo:color">
+ <xsl:value-of select="ss:Font/@ss:Color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-window-font-color">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Font/@ss:Italic = '1'">
+ <!-- omit font-style oblique -->
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:Size">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="concat( ss:Font/@ss:Size, 'pt')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">10pt</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Font/@ss:Outline = '1'">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Font/@ss:Shadow = '1'">
+ <!-- Not in DTD nor in docu <xsl:attribute name="style:text-shadow">shadow</xsl:attribute> -->
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Font/@ss:StrikeThrough = '1'">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Font/@ss:Underline">
+ <xsl:choose>
+ <xsl:when test="ss:Font/@ss:Underline = 'None'">
+ <xsl:attribute name="style:text-underline-type">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'Single'">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'Double'">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'SingleAccounting'">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>"</xsl:when>
+ <xsl:when test="ss:Font/@ss:Underline = 'DoubleAccounting'">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline-type">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="ss:Font/@x:Charset">
+ <!-- quite unclear till now, -->
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="ss:Interior" mode="style-style-content">
+ <xsl:choose>
+ <xsl:when test="@ss:Pattern = 'Solid'">
+ <xsl:if test="@ss:Color">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="@ss:Color"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@ss:PatternColor">
+ <xsl:variable name="pattern-value">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="concat('0.',substring-after(@ss:Pattern,'y'))"/>
+ <xsl:with-param name="color-value" select="@ss:Color"/>
+ <xsl:with-param name="pattern-color-value" select="@ss:PatternColor"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="$pattern-value"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="ss:Style">
+ <!-- style:default-style is meant for application defaults
+ <xsl:when test="@ss:ID = 'Default'">
+ <xsl:element name="style:default-style">
+ <xsl:call-template name="style-style-content" />
+ </xsl:element>
+ </xsl:when> -->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@ss:ID"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="@ss:Name" />
+ <xsl:choose>
+ <xsl:when test="@ss:Parent">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="@ss:Parent"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- no parent, but automatic style are automatically inheriting from a style called 'Default'
+ not necessary named style -->
+ <xsl:when test="not(key('Style', @ss:ID)/@ss:Name)">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:text>Default</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="ss:NumberFormat/@ss:Format">
+ <xsl:attribute name="style:data-style-name">
+ <xsl:value-of select="concat( @ss:ID, 'F')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:call-template name="style-style-content"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="cell-pattern-color">
+ <!-- generates a new color from cell-pattern-color -->
+ <xsl:param name="pattern"/>
+ <xsl:param name="color-value"/>
+ <xsl:param name="pattern-color-value"/>
+ <xsl:variable name="rev-pattern" select="1 - $pattern"/>
+ <xsl:variable name="color-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="R-value">
+ <xsl:variable name="combined-R-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-R-value * $rev-pattern + $pattern-R-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-R-value) = 1">
+ <xsl:value-of select="concat('0',$combined-R-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-R-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="G-value">
+ <xsl:variable name="combined-G-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-G-value * $rev-pattern + $pattern-G-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-G-value) = 1">
+ <xsl:value-of select="concat('0',$combined-G-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-G-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="B-value">
+ <xsl:variable name="combined-B-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-B-value * $rev-pattern + $pattern-B-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-B-value) = 1">
+ <xsl:value-of select="concat('0',$combined-B-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-B-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('#',$R-value,$G-value,$B-value)"/>
+ </xsl:template>
+ <xsl:template name="hex2decimal">
+ <!-- transforms a hex number to a decimal number.parses the string from left to right -->
+ <xsl:param name="hex-number"/>
+ <xsl:param name="index"/>
+ <xsl:param name="str-length"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="dec-char">
+ <xsl:call-template name="hexNumber2dec">
+ <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/>
+ <xsl:if test="$index &lt; $str-length">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$hex-number"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="str-length" select="$str-length"/>
+ <xsl:with-param name="last-value" select="$current-value"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $str-length">
+ <xsl:value-of select="$current-value"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="hexNumber2dec">
+ <!-- return a decimal number for a hex character -->
+ <xsl:param name="hex-value"/>
+ <xsl:choose>
+ <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hex-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="decimal2hex">
+ <!-- transforms a decimal number to a hex number,only for two-bit hex(less than 256 in decimal) currently -->
+ <xsl:param name="dec-number"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="current-value">
+ <xsl:call-template name="decNumber2hex">
+ <xsl:with-param name="dec-value">
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:value-of select="floor($dec-number div 16)"/>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="$dec-number"/>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$dec-number mod 16"/>
+ <xsl:with-param name="last-value" select="concat($last-value,$current-value)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="decNumber2hex">
+ <!-- return a hex number for a decimal character -->
+ <xsl:param name="dec-value"/>
+ <xsl:choose>
+ <xsl:when test="$dec-value = 10">
+ <xsl:value-of select="'A'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 11">
+ <xsl:value-of select="'B'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 12">
+ <xsl:value-of select="'C'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 13">
+ <xsl:value-of select="'D'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 14">
+ <xsl:value-of select="'E'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 15">
+ <xsl:value-of select="'F'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dec-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Border">
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="@ss:Position = 'Top'">fo:border-top</xsl:when>
+ <xsl:when test="@ss:Position = 'Bottom'">fo:border-bottom</xsl:when>
+ <xsl:when test="@ss:Position = 'Left'">fo:border-left</xsl:when>
+ <xsl:when test="@ss:Position = 'Right'">fo:border-right</xsl:when>
+ <!-- DiagonalLeft & DiagonalRight are not supported yet, -->
+ <xsl:otherwise>fo:border-left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="width">
+ <xsl:choose>
+ <!-- 0: Hairline -->
+ <xsl:when test="@ss:Weight = '0'">0.002cm</xsl:when>
+ <!-- 1: Thin -->
+ <xsl:when test="@ss:Weight = '1'">0.035cm</xsl:when>
+ <!-- 2: Medium -->
+ <xsl:when test="@ss:Weight = '2'">0.088cm</xsl:when>
+ <!-- 3: Thick -->
+ <xsl:when test="@ss:Weight = '3'">
+ <xsl:choose>
+ <xsl:when test="@ss:LineStyle = 'Double'">0.105cm</xsl:when>
+ <xsl:otherwise>0.141cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- invalid value, or parameter not exist at all -->
+ <xsl:otherwise>0.002cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="linestyle">
+ <xsl:choose>
+ <xsl:when test="@ss:LineStyle = 'None'">none</xsl:when>
+ <xsl:when test="@ss:LineStyle = 'Continuous'">solid</xsl:when>
+ <xsl:when test="@ss:LineStyle = 'Double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="color">
+ <xsl:choose>
+ <xsl:when test="@ss:Color">
+ <xsl:value-of select="@ss:Color"/>
+ </xsl:when>
+ <!-- default border color is black -->
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="{$position}">
+ <xsl:value-of select="concat( $width, ' ', $linestyle, ' ', $color)"/>
+ </xsl:attribute>
+ <xsl:if test="@ss:LineStyle = 'Double'">
+ <xsl:variable name="widthposition">
+ <xsl:choose>
+ <xsl:when test="@ss:Position = 'Top'">style:border-line-width-top</xsl:when>
+ <xsl:when test="@ss:Position = 'Bottom'">style:border-line-width-bottom</xsl:when>
+ <xsl:when test="@ss:Position = 'Left'">style:border-line-width-left</xsl:when>
+ <xsl:when test="@ss:Position = 'Right'">style:border-line-width-right</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="{$widthposition}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="ss:Font">
+ <xsl:choose>
+ <xsl:when test="@ss:VerticalAlign = 'Superscript'">
+ <style:style style:name="{concat(../@ss:ID,'T0')}" style:family="text">
+ <style:text-properties style:text-position="33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@ss:VerticalAlign = 'Subscript'">
+ <style:style style:name="{concat(../@ss:ID,'T0')}" style:family="text">
+ <style:text-properties style:text-position="-33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Table">
+ <xsl:variable name="default-column-width">
+ <xsl:choose>
+ <xsl:when test="@ss:DefaultColumnWidth">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@ss:DefaultColumnWidth,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <!-- Note: Specify where this value come from.. -->
+ <xsl:otherwise>2.096cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ </xsl:variable>
+ <!-- naming convention the default column style is name co<NumberOfSheet> e.g. co1 for the first sheet -->
+ <style:style style:family="table-column" style:name="{concat('co', $table-pos)}">
+ <style:table-column-properties fo:break-before="auto" style:column-width="{$default-column-width}"/>
+ </style:style>
+ <xsl:choose>
+ <xsl:when test="ss:Column">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns" select="0"/>
+ <xsl:with-param name="columnCount" select="count(./ss:Column)"/>
+ <xsl:with-param name="currentCount" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="../x:PageBreaks/x:ColBreaks">
+ <style:style style:name="{concat('cob',$table-pos)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="$default-column-width"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <xsl:variable name="default-row-height">
+ <xsl:choose>
+ <xsl:when test="@ss:DefaultRowHeight">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@ss:DefaultRowHeight,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <!-- Note: This is the default row hight value in spec it is written 255 point, this seems wrong -->
+ <!-- <xsl:otherwise>0.503cm</xsl:otherwise> -->
+ <xsl:otherwise>0.45cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <style:style style:family="table-row" style:name="{concat('ro', $table-pos)}">
+ <style:table-row-properties style:row-height="{$default-row-height}" style:use-optimal-row-height="false"/>
+ </style:style>
+ <xsl:if test="ss:Row">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="earlierRowNo" select="0"/>
+ <xsl:with-param name="rowNodeCount" select="count(./ss:Row)"/>
+ <xsl:with-param name="rowNodeIndex" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="../x:PageBreaks/x:RowBreaks">
+ <style:style style:name="{concat('rob',$table-pos)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:attribute name="style:row-height">
+ <xsl:value-of select="$default-row-height"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <!-- create table-style -->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat( 'ta', $table-pos)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <!-- ss:Name have to be from type 'NCNameChar' ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender -->
+ <xsl:attribute name="style:master-page-name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="../@ss:Name"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:element name="style:table-properties">
+ <xsl:choose>
+ <xsl:when test="../x:WorksheetOptions/x:Visible = 'SheetHidden'">
+ <xsl:attribute name="table:display">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:display">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="get-column-style-name">
+ <!-- generate stylename of colbreak after matching the column number and the colbreak number -->
+ <xsl:param name="finishedColumns"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentCount"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-column-width"/>
+ <xsl:if test="$currentCount &lt; ($columnCount + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Span">
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Index">
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Index - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../x:PageBreaks/x:ColBreaks/x:ColBreak/x:Column = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../x:PageBreaks/x:ColBreaks[(x:ColBreak/x:Column &gt; $finishedColumns) and (x:ColBreak/x:Column &lt; ($finishedColumns + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$column-break = 1">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:call-template name="encode-as-nc-name">
+ <xsl:with-param name="string" select="concat('cob', $table-pos, '-',$currentCount)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Width">
+ <xsl:attribute name="style:column-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Column[position() = $currentCount]/@ss:Width,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="$default-column-width"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:AutoFitWidth = '0'">
+ <xsl:attribute name="style:use-optimal-column-width">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Width &gt; 0">
+ <xsl:attribute name="style:use-optimal-column-width">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-column-width">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <style:style style:name="{concat('co', $table-pos, '-',$currentCount)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Width">
+ <xsl:attribute name="style:column-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Column[position() = $currentCount]/@ss:Width,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="$default-column-width"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ <xsl:if test="$currentCount &lt; $columnCount">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Index">
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Span">
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Index + ./ss:Column[position() = $currentCount]/@ss:Span"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./ss:Column[position() = $currentCount]/@ss:Index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Column[position() = $currentCount]/@ss:Span">
+ <xsl:value-of select="$finishedColumns + ./ss:Column[position() = $currentCount]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentCount" select="$currentCount + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-row-style-name">
+ <!-- generate stylename of rowbreak after matching the row number and the rowbreak number -->
+ <xsl:param name="earlierRowNo"/>
+ <xsl:param name="rowNodeCount"/>
+ <xsl:param name="rowNodeIndex"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-row-height"/>
+ <xsl:if test="$rowNodeIndex &lt; ($rowNodeCount + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Index">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index - $earlierRowNo+ ./ss:Row[position() = $rowNodeIndex]/@ss:Span"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Index">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierRowNo"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../x:PageBreaks/x:RowBreaks/x:RowBreak/x:Row = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../x:PageBreaks/x:RowBreaks[(x:RowBreak/x:Row &gt; $earlierRowNo) and (x:RowBreak/x:Row &lt; ($earlierRowNo + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$row-break = 1">
+ <xsl:element name="style:style">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:StyleID">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex,'-',ss:Row[position() = $rowNodeIndex]/@ss:StyleID)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+
+
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height">
+ <xsl:attribute name="style:row-height">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Row[position() = $rowNodeIndex]/@ss:Height,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height">
+ <xsl:value-of select="$default-row-height"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:AutoFitHeight = '0'">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)/ss:Interior" mode="style-style-content"/>
+ </xsl:element>
+ <!--
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)" mode="style-style-content" />
+ -->
+ </xsl:element>
+ </xsl:if>
+ <!--
+ <style:style style:name="{concat('ro', $table-pos, '-',$rowNodeIndex)}" style:family="table-row">
+ -->
+ <xsl:element name="style:style">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:StyleID">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex,'-',ss:Row[position() = $rowNodeIndex]/@ss:StyleID)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('ro', $table-pos, '-',$rowNodeIndex)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+
+
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height">
+ <xsl:attribute name="style:row-height">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(./ss:Row[position() = $rowNodeIndex]/@ss:Height,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height">
+ <xsl:value-of select="$default-row-height"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:AutoFitHeight">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:AutoFitHeight = '0'">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Height &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ <!-- apply to background -->
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)/ss:Interior" mode="style-style-content"/>
+ </xsl:element>
+ <!--
+ <xsl:apply-templates select="key('Style', ss:Row[position() = $rowNodeIndex]/@ss:StyleID)" mode="style-style-content" />
+ -->
+ </xsl:element>
+ <xsl:if test="$rowNodeIndex &lt; $rowNodeCount">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="earlierRowNo">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Index">
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index + ./ss:Row[position() = $rowNodeIndex]/@ss:Span"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./ss:Row[position() = $rowNodeIndex]/@ss:Index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Row[position() = $rowNodeIndex]/@ss:Span">
+ <xsl:value-of select="$earlierRowNo + ./ss:Row[position() = $rowNodeIndex]/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierRowNo + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="rowNodeCount" select="$rowNodeCount"/>
+ <xsl:with-param name="rowNodeIndex" select="$rowNodeIndex + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="count-spanned-columns">
+ <xsl:param name="expandedColumnCount" select="0"/>
+ <xsl:param name="columns"/>
+ <xsl:param name="columnsCount" select="count($columns)"/>
+ <xsl:param name="columnIndex" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$columnIndex &lt;= $columnsCount">
+ <xsl:call-template name="count-spanned-columns">
+ <xsl:with-param name="columns" select="$columns"/>
+ <xsl:with-param name="columnsCount" select="$columnsCount"/>
+ <xsl:with-param name="columnIndex" select="$columnIndex + 1"/>
+ <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount + $columns[$columnIndex]/@ss:Span"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedColumnCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Worksheet">
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:attribute>
+ <!-- other attributes aren't suitable to apply yet -->
+ <xsl:if test="ss:Table">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat( 'ta', count(preceding-sibling::ss:Worksheet)+1)"/>
+ </xsl:attribute>
+ <xsl:if test="@ss:Protected = '1'">
+ <xsl:attribute name="table:protected">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="descendant::ss:NamedRange[@ss:Name = 'Print_Area' and contains( @ss:RefersTo, '!R')]">
+ <xsl:variable name="referto">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="descendant::ss:NamedRange/@ss:RefersTo"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:print-ranges">
+ <xsl:value-of select="translate( $referto, '=', '$')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::ss:Worksheet)+1"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <xsl:choose>
+ <xsl:when test="not(ss:Table/ss:Column)">
+ <!-- no columns exist -->
+ <xsl:call-template name="create-columns-without-input">
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="ss:Table/@ss:ExpandedColumnCount"/>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Table/ss:Column/@ss:Span">
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes and spanned columns -->
+ <xsl:variable name="spannedColumns">
+ <xsl:call-template name="count-spanned-columns">
+ <xsl:with-param name="columns" select="ss:Table/ss:Column[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="count(ss:Table/ss:Column) + number($spannedColumns)"/>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes -->
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="count(ss:Table/ss:Column)"/>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[1]"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- generates the string of row\column position if ConditionalFormatting exists -->
+ <xsl:variable name="condition-pos-str1">
+ <xsl:if test="./x:ConditionalFormatting">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(./x:ConditionalFormatting)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str2">
+ <xsl:if test="./x:DataValidation">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(./x:DataValidation)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str" select="concat($condition-pos-str1, $condition-pos-str2)"/>
+ <xsl:choose>
+ <xsl:when test="./ss:Table/ss:Row">
+ <xsl:call-template name="create-rows">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./x:PageBreaks/x:RowBreaks">
+ <xsl:for-each select="./x:PageBreaks/x:RowBreaks/x:RowBreak">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./x:Row"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=". - preceding::x:RowBreak[position()=count(.)]/x:Row - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-row">
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('ro',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="$number-repeated"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <table:table-cell table:number-columns-repeated="{ss:Table/@ss:ExpandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-row">
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('rob',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <table:table-cell table:number-columns-repeated="{ss:Table/@ss:ExpandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- in case no table row exists (empty spreadsheet) -->
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ <xsl:element name="table:table-cell">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('ro',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:element name="table:table-cell"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="./x:ConditionalFormatting">
+ <xsl:variable name="condition-row-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'R'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-col-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="break-row-max">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="1"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="count-value" select="count(./x:PageBreaks/x:RowBreaks/x:RowBreak)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$condition-row-max &lt; $break-row-max">
+ <xsl:value-of select="$break-row-max"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$condition-row-max"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="1"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-value"/>
+ <xsl:with-param name="total-col" select="$condition-col-max"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!-- if exists attribute of StyleID in tag of ss:Table but no Row/Column -->
+ <xsl:if test="./ss:Table/@ss:StyleID">
+ <table:table-row table:style-name="{concat('ro',$table-pos)}" table:number-rows-repeated="65564">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!-- Note: Need to be refactored -->
+ <xsl:template name="create-columns-without-input">
+ <xsl:param name="table-pos"/>
+ <xsl:choose>
+ <xsl:when test="./x:PageBreaks/x:ColBreaks">
+ <xsl:for-each select="./x:PageBreaks/x:ColBreaks/x:ColBreak">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./x:Column"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=". - preceding::x:ColBreak[position()=count(.)]/x:Column - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:if test="ancestor::ss:Worksheet/ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('co',$table-pos)"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$number-repeated"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <!-- column style be made out beforehead -->
+ <xsl:if test="ancestor::ss:Worksheet/ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="ancestor::ss:Worksheet/ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$table-pos)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:text>co1</xsl:text>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="ss:Table/@ss:ExpandedColumnCount and ss:Table/@ss:ExpandedColumnCount > 0">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="ss:Table/@ss:ExpandedColumnCount"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:text>Default</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ Example:
+ <ss:Table>
+ <ss:Column ss:Index="4" ss:Width="500" ss:Span="3" />
+ <ss:Column ss:Width="200" />
+ </ss:Table>
+
+ Prior column (ss:Index - 1) is written
+ The given fourth cell (ss:Index="4") is handled as repeated three times (ss:Span="3").
+ The eight column got a width of "200"
+
+ ContextNode: ss:Worksheet
+ -->
+ <xsl:key match="/ss:Workbook/ss:Worksheet/x:PageBreaks/x:ColBreaks/x:ColBreak" name="ColBreak" use="Column"/>
+ <xsl:template name="create-columns">
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentColumn" select="1"/>
+ <xsl:param name="finishedColumns" select="0"/>
+ <xsl:param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$finishedColumns &lt; $columnCount">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:Index - $finishedColumns &gt; 1">
+ <!-- found column with index.
+ filling up table with empty columns until Index is reached -->
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:if test="$currentColumnNode/@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$currentColumnNode/@ss:Span">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$currentColumnNode/@ss:Span + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob', $worksheetNo, '-', $currentColumn)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('co', $worksheetNo, '-', $currentColumn)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:StyleID">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="$currentColumnNode/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:text>Default</xsl:text>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn + 1"/>
+ <xsl:with-param name="finishedColumns">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:Span">
+ <xsl:value-of select="$finishedColumns + $currentColumnNode/@ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="currentColumnNode" select="ss:Table/ss:Column[$currentColumn + 1]"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- <xsl:if test="not($finishedColumns + 1 = $columnCount)"> -->
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$currentColumn = $columnCount">
+ <!-- Note: name test document for this case and refactor the template -->
+ <xsl:if test="x:PageBreaks/x:ColBreaks/x:ColBreak/x:Column &gt; $finishedColumns">
+ <xsl:call-template name="get-column-beyond-last">
+ <xsl:with-param name="index-value" select="$finishedColumns"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--Note: Test Scenario for this case: generates some special tags for whole row style
+ <xsl:if test="(./ss:Table[@ss:StyleID] or ./ss:Table/ss:Row[@ss:StyleID]) and (256 - $finishedColumns &gt; 0)">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:choose><xsl:when test="./ss:Table[@ss:StyleID]"><xsl:value-of select="./ss:Table/@ss:StyleID" /></xsl:when><xsl:otherwise><xsl:value-of select="'Default'" /></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="'co1'" /></xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="256 - $finishedColumns" /></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ -->
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-default-column">
+ <xsl:param name="currentColumn"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="nextColumnNo"/>
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:call-template name="get-default-cell-style">
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="$nextColumnNo - $currentColumn"/></xsl:attribute> -->
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('co',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-rows">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:apply-templates select="ss:Table/ss:Row[1]" mode="create-rows">
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:with-param name="rowNodeCount" select="count(ss:Table/ss:Row)"/>
+ <xsl:with-param name="rowNodeIndex" select="1"/>
+ <xsl:with-param name="expandedRowCount">
+ <xsl:call-template name="get-expanded-row-count"/>
+ </xsl:with-param>
+ <xsl:with-param name="expandedRowCountIndex" select="1"/>
+ <xsl:with-param name="expandedColumnCount">
+ <xsl:call-template name="get-expanded-column-count"/>
+ </xsl:with-param>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="ss:Row" mode="create-rows">
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="rowNodeCount"/>
+ <xsl:param name="rowNodeIndex" select="1"/>
+ <xsl:param name="expandedRowCount"/>
+ <xsl:param name="expandedRowCountIndex" select="1"/>
+ <xsl:param name="expandedColumnCount"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:variable name="currentRowNo">
+ <xsl:choose>
+ <xsl:when test="@ss:Index">
+ <xsl:value-of select="@ss:Index"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedRowCountIndex"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="@ss:Index - $expandedRowCountIndex &gt; 0">
+ <!-- create the precding missing rows -->
+ <xsl:element name="table:table-row">
+ <!-- fill the preceding gap with rows without a cell -->
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="@ss:Index - $expandedRowCountIndex"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-row">
+ <xsl:attribute name="table:style-name">
+ <xsl:choose>
+ <xsl:when test="@ss:StyleID">
+ <xsl:value-of select="concat('ro',$worksheetNo, '-',$rowNodeIndex,'-', @ss:StyleID)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('ro',$worksheetNo,'-',$rowNodeIndex)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:if test="@ss:Hidden = '1'">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Span">
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="@ss:Span + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <!-- Excel row without content -->
+ <xsl:when test="not(*)">
+ <!-- OASIS OpenDocument Format does not allow rows without a cell -->
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-cells">
+ <xsl:with-param name="row-pos" select="$currentRowNo"/>
+ <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <!-- columns are painting over the expanded RowCount -->
+ <xsl:choose>
+ <xsl:when test="count(following-sibling::ss:Row) != 0">
+ <xsl:apply-templates select="following-sibling::ss:Row[1]" mode="create-rows">
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="rowNodeCount" select="$rowNodeCount"/>
+ <xsl:with-param name="rowNodeIndex" select="$rowNodeIndex + 1"/>
+ <xsl:with-param name="expandedRowCount" select="$expandedRowCount"/>
+ <xsl:with-param name="expandedRowCountIndex">
+ <xsl:choose>
+ <xsl:when test="@ss:Index and @ss:Span">
+ <xsl:value-of select="@ss:Index + @ss:Span + 1"/>
+ </xsl:when>
+ <xsl:when test="@ss:Index">
+ <xsl:value-of select="@ss:Index + 1"/>
+ </xsl:when>
+ <xsl:when test="@ss:Span">
+ <xsl:value-of select="$expandedRowCountIndex + @ss:Span + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedRowCountIndex + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="expandedColumnCount" select="$expandedColumnCount"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$currentRowNo &lt; 65536">
+ <xsl:element name="table:table-row">
+ <!-- fill the preceding gap with rows without a cell -->
+ <xsl:attribute name="table:number-rows-repeated">
+ <xsl:value-of select="65536 - $currentRowNo"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-expanded-column-count">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedColumnCount">
+ <xsl:value-of select="ss:Table/@ss:ExpandedColumnCount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Table/ss:Column/@ss:Span">
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes and spanned columns -->
+ <xsl:variable name="spannedColumns">
+ <xsl:call-template name="count-spanned-columns">
+ <xsl:with-param name="columns" select="ss:Table/ss:Column[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="count(ss:Table/ss:Column) + number($spannedColumns)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- No absolute column number (ss:ExpandedColumnCount) is add the nodes -->
+ <xsl:value-of select="count(ss:Table/ss:Column)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-expanded-row-count">
+ <xsl:choose>
+ <xsl:when test="ss:Table/@ss:ExpandedRowCount">
+ <xsl:value-of select="ss:Table/@ss:ExpandedRowCount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="ss:Table/ss:Row/@ss:Index and not(ss:Table/ss:Row/@ss:Span)">
+ <xsl:variable name="lastIndexedRow" select="ss:Table/ss:Row[@ss:Index][last()]"/>
+ <xsl:value-of select="number($lastIndexedRow/@ss:Index) + count($lastIndexedRow/following-sibling::ss:Row)"/>
+ </xsl:when>
+ <xsl:when test="ss:Table/ss:Row/@ss:Index and ss:Table/ss:Row/@ss:Span">
+ <xsl:variable name="lastIndexedRow" select="ss:Table/ss:Row[@ss:Index][last()]"/>
+ <xsl:variable name="spannedRows">
+ <xsl:call-template name="count-spanned-rows">
+ <xsl:with-param name="rows" select="$lastIndexedRow/following-sibling::ss:Row[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="number($lastIndexedRow/@ss:Index) + count($lastIndexedRow/following-sibling::ss:Row) + number($spannedRows)"/>
+ </xsl:when>
+ <xsl:when test="not(ss:Table/ss:Row/@ss:Index) and ss:Table/ss:Row/@ss:Span">
+ <xsl:variable name="spannedRows">
+ <xsl:call-template name="count-spanned-rows">
+ <xsl:with-param name="rows" select="ss:Table/ss:Rows[@ss:Span]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="count(ss:Table/ss:Row + number($spannedRows))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="count(ss:Table/ss:Row)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="count-spanned-rows">
+ <xsl:param name="expandedRowCount" select="0"/>
+ <xsl:param name="rows"/>
+ <xsl:param name="rowsCount" select="count($rows)"/>
+ <xsl:param name="rowIndex" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$rowIndex &lt;= $rowsCount">
+ <xsl:call-template name="count-spanned-rows">
+ <xsl:with-param name="rows" select="$rows"/>
+ <xsl:with-param name="rowsCount" select="$rowsCount"/>
+ <xsl:with-param name="rowIndex" select="$rowIndex + 1"/>
+ <xsl:with-param name="expandedRowCount" select="$expandedRowCount + $rows[$rowIndex]/@ss:Span"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$expandedRowCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-default-cell-style">
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@ss:StyleID">
+ <xsl:value-of select="$currentColumnNode/@ss:StyleID"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./ss:Table[@ss:StyleID]">
+ <xsl:value-of select="./ss:Table/@ss:StyleID"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-row-beyond-last">
+ <!-- dealing the RowBreak after last row by recursion -->
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="end-pos"/>
+ <xsl:param name="total-col"/>
+ <xsl:variable name="current" select="concat('R',$index-value)"/>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="./x:PageBreaks/x:RowBreaks/x:RowBreak/x:Row = ($index-value - 1)">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('rob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('ro',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <!-- Note: 2 be refactored
+ <xsl:when test="./ss:Table/ss:Column[@ss:StyleID] or ./ss:Table[@ss:StyleID]">
+ <xsl:if test="256 - count(ss:Table/ss:Column) &gt; 0">
+ <table:table-cell table:number-columns-repeated="{256 - count(ss:Table/ss:Column)}" />
+ </xsl:if>
+ </xsl:when>-->
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$index-value"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end" select="$total-col"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML does not allow rows without a cell -->
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$index-value &lt; ($end-pos + 1)">
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="$index-value + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-pos"/>
+ <xsl:with-param name="total-col" select="$total-col"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="break-row-beyond-max">
+ <!-- returns the max position of the row from condition-pos-str -->
+ <xsl:param name="pos"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="count-value"/>
+ <xsl:variable name="pre-value" select="./x:PageBreaks/x:RowBreaks/x:RowBreak[position() = $pos]/x:Row"/>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$pos &lt; $count-value">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="$pos + 1"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="count-value" select="$count-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-column-beyond-last">
+ <!-- dealing the ColBreak after last column by recursion -->
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:for-each select="./x:PageBreaks/x:ColBreaks/x:ColBreak">
+ <xsl:variable name="each-column-value" select="./x:Column"/>
+ <xsl:choose>
+ <xsl:when test="$each-column-value + 1 &gt; $index-value">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::x:ColBreak[position()=count(.)]/x:Column + 1 = $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::x:ColBreak[position()=count(.)]/x:Column - 1"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::x:ColBreak[position()=count(.)]/x:Column + 1 &gt; $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::x:ColBreak[position()=count(.)]/x:Column - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$each-column-value - $index-value + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="'co1'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$number-repeated"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <xsl:if test="./../../../ss:Table[@ss:StyleID]">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="./ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$each-column-value + 1 = $index-value">
+ <xsl:element name="table:table-column">
+ <xsl:if test="./../../../ss:Table[@ss:StyleID]">
+ <xsl:attribute name="table:default-cell-style-name">
+ <xsl:value-of select="./../../../ss:Table/@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="concat('cob',$worksheetNo)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="create-spanning-cells">
+ <!-- judge the position of the Cell in the condition-pos-str -->
+ <xsl:param name="row-pos"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="condition-pos-str"/>
+
+ <xsl:variable name="current" select="concat('R',$row-pos,'C',$c-start,',')"/>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- as for the spanned cells no style is taken.. -->
+ <xsl:choose>
+ <!-- inherit style from parent row style-->
+ <xsl:when test="../@ss:StyleID">
+ <xsl:value-of select="../@ss:StyleID"/>
+ </xsl:when>
+ <!-- if no correspondent column style exisit.. -->
+ <!-- inherit style from parent table style -->
+ <xsl:when test="../../@ss:StyleID">
+ <!-- function to give in col-pos and get back column style -->
+ <xsl:variable name="relatedColumnStyle">
+ <xsl:call-template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:with-param name="calculatedCellPosition" select="$c-start" />
+ <!-- all columns in XML -->
+ <xsl:with-param name="columnXMLNodes" select="../../ss:Column"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$relatedColumnStyle = ''">
+ <xsl:value-of select="../../@ss:StyleID"/>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="table:table-cell">
+ <xsl:if test="not($style-name = '')">
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-name, 'ce')">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$c-start &lt; $c-end">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$c-end - $c-start + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="condition-row-col-pos-max">
+ <!-- returns the max position of the column or row from condition-pos-str -->
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="div-value"/>
+ <xsl:variable name="pre-value">
+ <xsl:choose>
+ <xsl:when test="$div-value = 'R'">
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$div-value)">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="substring-after($condition-pos-str,$div-value)"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="div-value" select="$div-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-str">
+ <!-- returns the string of style name of condition-pos-str -->
+ <xsl:param name="param-str"/>
+ <xsl:choose>
+ <xsl:when test="contains($param-str,'(')">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($param-str,':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:key name="Style" match="/ss:Workbook/ss:Styles/ss:Style" use="@ss:ID"/>
+ <xsl:template name="create-cells">
+ <xsl:param name="row-pos"/>
+ <xsl:param name="expandedColumnCount"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:choose>
+ <xsl:when test="ss:Cell">
+ <xsl:apply-templates select="ss:Cell[1]" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$expandedColumnCount"/>
+ <!--
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str" />
+ <xsl:with-param name="last-value" select="0" />
+ <xsl:with-param name="div-value" select="'C'" />
+ </xsl:call-template>
+ </xsl:with-param> -->
+ <xsl:with-param name="col-pos-written" select="0"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="current" select="concat('R',$row-pos,'C')"/>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML does not allow an empty row -->
+ <xsl:choose>
+ <xsl:when test="$expandedColumnCount != 0">
+ <table:table-cell table:number-columns-repeated="{$expandedColumnCount}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- OASIS XML row can not be empty -->
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Cell" name="ss:Cell" mode="selected">
+ <!-- Contains the max position of the column or row from the concatenation from
+ x:ConditionalFormatting
+ and
+ x:DataValidation -->
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-written" select="0"/>
+ <xsl:param name="col-pos-current" select="0"/>
+ <xsl:param name="row-pos"/>
+ <xsl:param name="col-repeated" select="1"/>
+
+ <!-- The column position of the cell (might jumped by ss:Index) -->
+ <xsl:variable name="col-pos">
+ <xsl:choose>
+ <xsl:when test="@ss:Index">
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:value-of select="@ss:MergeAcross + @ss:Index"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@ss:Index"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:value-of select="1 + @ss:MergeAcross + $col-pos-current"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1 + $col-pos-current"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="nextCell" select="following-sibling::ss:Cell[1]"/>
+ <!-- Multiple empty cells with the same or no style will be moved to one cell with a 'table:number-columns-repeated' attribute -->
+ <xsl:variable name="cell-is-repeatable" select="
+ not(current()/*)
+ and
+ not(current()/text())
+ and
+ (
+ not($nextCell)
+ and $col-pos &gt; $col-pos-written + 1
+ or
+ (
+ $nextCell
+ and
+ not($nextCell/*)
+ and
+ not($nextCell/text())
+ and
+ (
+ (current()/@ss:StyleID = $nextCell/@ss:StyleID)
+ or
+ (not(current()/@ss:StyleID) and not($nextCell/@ss:StyleID))
+ )
+ and
+ (
+ not($nextCell/@ss:Index)
+ or
+ ($nextCell/@ss:Index = $col-pos + 1)
+ )
+ )
+ ) "/>
+ <xsl:choose>
+ <!-- Scenario: The missing cells scipped by using the ss:Index attribute will be added -->
+ <xsl:when test="@ss:Index and @ss:Index &gt; $col-pos-written + 1">
+ <!-- In Open Document nothing comparable to Index exists,
+ the missing cells might have to be created, if they had content as only style will be repeated-->
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos-current + 1"/>
+ <xsl:with-param name="c-end" select="@ss:Index - 1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ <xsl:call-template name="ss:Cell">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="@ss:Index - 1"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Scenario: A sequence of cells can be put together as one cell -->
+ <xsl:when test="$cell-is-repeatable">
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos-written"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if the cell wasn't repeated yet, created first -->
+ <xsl:if test="$col-repeated = 1">
+ <xsl:element name="table:table-cell">
+ <!-- in case the cell has an Index and is repeatable (s.above) and therefore has not been repeated earlier -->
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:if test="$col-pos - @ss:MergeAcross &gt; $col-pos-written + 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-pos - $col-pos-written"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$col-pos &gt; $col-pos-written + 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-pos - $col-pos-written"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="create-table-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-table-cell-content">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ </xsl:element>
+ <!-- ss:MergeAcross (column spanned) indicates a covered table-cell in Open Document XML-->
+ <xsl:if test="@ss:MergeAcross">
+ <xsl:element name="table:covered-table-cell">
+ <xsl:if test="@ss:MergeAcross &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="@ss:MergeAcross"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <!-- the following block is not used, if the cell had been repeated earlier -->
+ <xsl:when test="$nextCell and not($cell-is-repeatable and $col-repeated = 1)">
+ <xsl:choose>
+ <!-- After cells can not longer be repeated write out the attribute -->
+ <xsl:when test="not($cell-is-repeatable) and $col-repeated > 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-repeated"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- At the end of the row -->
+ <xsl:when test="not($nextCell)">
+ <xsl:if test="../../../x:ConditionalFormatting">
+ <!-- at the last position of the Cell tag,inspecting the following cell before condition-row-col-pos-max -->
+ <xsl:call-template name="create-spanning-cells">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos"/>
+ <xsl:with-param name="c-end" select="$col-pos-max"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <!-- If the cells can not be repeated (default) -->
+ <xsl:when test="not($cell-is-repeatable)">
+ <!-- Traverse the following Cell -->
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- Go on with started repetition -->
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated + 1"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="not($nextCell)">
+ <xsl:choose>
+ <xsl:when test="$col-repeated = 1 and ($col-pos &lt; $col-pos-max)">
+ <table:table-cell table:number-columns-repeated="{$col-pos-max - $col-pos}"/>
+ </xsl:when>
+ <xsl:when test="$col-repeated &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated">
+ <xsl:value-of select="$col-repeated"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextCell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Cell" mode="skip">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-written"/>
+ <xsl:param name="row-pos"/>
+
+ <xsl:variable name="nextCell" select="following-sibling::ss:Cell[1]"/>
+ <!-- Multiple empty cells with the same style will be moved to one cell with a 'table:number-columns-repeated' attribute -->
+ <xsl:variable name="cell-is-repeatable" select="not($nextCell/*) and not($nextCell/text()) and ((current()/@ss:StyleID = $nextCell/@ss:StyleID) or (not(current()/@ss:StyleID) and not($nextCell/@ss:StyleID))) and not($nextCell/@ss:Index)"/>
+ <xsl:choose>
+ <xsl:when test="$cell-is-repeatable">
+ <xsl:apply-templates select="$nextCell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos-written + 1"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$nextCell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-written" select="$col-pos-written + 1"/>
+ <xsl:with-param name="col-pos-current" select="$col-pos-written + 1"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-table-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+
+ <xsl:choose>
+ <xsl:when test="$condition-pos-str">
+ <xsl:call-template name="get-condition-dependent-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="current-pos-str" select="concat('R',$row-pos,'C',$col-pos,',')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- inherit style from parent row style-->
+ <xsl:when test="../@ss:StyleID">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="../@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- if no correspondent column style exisit.. -->
+ <!-- inherit style from parent table style -->
+ <xsl:when test="../../@ss:StyleID">
+ <!-- function to give in col-pos and get back column style -->
+ <xsl:variable name="relatedColumnStyle">
+ <xsl:call-template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:with-param name="calculatedCellPosition" select="$col-pos" />
+ <!-- all columns in XML -->
+ <xsl:with-param name="columnXMLNodes" select="../../ss:Column"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$relatedColumnStyle = ''">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="../../@ss:StyleID"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@ss:MergeAcross or @ss:MergeDown">
+ <xsl:choose>
+ <xsl:when test="@ss:MergeAcross">
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:value-of select="@ss:MergeAcross + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-columns-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@ss:MergeDown">
+ <xsl:attribute name="table:number-rows-spanned">
+ <xsl:value-of select="@ss:MergeDown+1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-rows-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@ss:Formula">
+ <!-- formula translation from Excel to Calc -->
+ <xsl:variable name="calc-formula">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$col-pos"/>
+ <xsl:with-param name="expression" select="@ss:Formula"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:formula">
+ <xsl:value-of select="$calc-formula"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ss:Data">
+ <xsl:variable name="data-format">
+ <xsl:value-of select="key('Style', @ss:StyleID)/ss:NumberFormat/@ss:Format"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="ss:Data/@ss:Type = 'Number'">
+ <xsl:choose>
+ <xsl:when test="$data-format = 'Percent' or contains( $data-format, '%')">
+ <xsl:attribute name="office:value-type">percentage</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(key('Style', @ss:StyleID)/ss:NumberFormat/@ss:Format, 'Currency')">
+ <xsl:attribute name="office:value-type">currency</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="office:value">
+ <xsl:value-of select="ss:Data"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Data/@ss:Type = 'DateTime'">
+ <xsl:choose>
+ <xsl:when test="(contains( $data-format, 'Date') or contains($data-format,'y') or contains($data-format,'g') or contains($data-format,'d') or contains($data-format,'e') or starts-with( substring( ss:Data, 11), 'T00:00:00.000' ) ) and (not (contains( $data-format, 'Time') ) )">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="office:date-value">
+ <xsl:value-of select="substring-before(ss:Data, 'T')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="office:time-value">
+ <xsl:value-of select="concat('P',substring(ss:Data, 11, 3), 'H', substring(ss:Data, 15, 2), 'M', substring(ss:Data, 18,2), 'S')"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="ss:Data/@ss:Type = 'Boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="office:boolean-value">
+ <xsl:choose>
+ <xsl:when test="ss:Data = '1'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ss:Data/@ss:Type = 'String'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:param name="calculatedCellPosition" />
+ <!-- the current position of the column as XML node -->
+ <xsl:param name="columnXMLPosition" select="1" />
+ <!-- all columns in XML -->
+ <xsl:param name="columnXMLNodes" />
+ <!-- the ending column position of the earlier column style in the table -->
+ <xsl:param name="earlierCalculatedColumnEnd" select="0" />
+
+ <!-- the current column as XML node -->
+ <xsl:variable name="columnXMLNode" select="$columnXMLNodes[1]" />
+ <xsl:if test="$columnXMLNodes and count($columnXMLNodes) > 0">
+ <!-- the starting column position of the style in the table -->
+ <xsl:variable name="calculatedColumnStart">
+ <!-- if ss:Index exists, this is the start of the column -->
+ <xsl:choose>
+ <xsl:when test="$columnXMLNode/@ss:Index">
+ <xsl:value-of select="$columnXMLNode/@ss:Index" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$earlierCalculatedColumnEnd + 1" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- the ending column position of the style in the table -->
+ <xsl:variable name="calculatedColumnEnd">
+ <xsl:choose>
+ <xsl:when test="$columnXMLNode/@ss:Span">
+ <xsl:value-of select="$calculatedColumnStart + $columnXMLNode/@ss:Span" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$calculatedColumnStart" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$calculatedColumnStart &gt;= $calculatedCellPosition and $calculatedCellPosition &lt;= $calculatedColumnEnd">
+ <xsl:value-of select="$columnXMLNode/@ss:StyleID"/>
+ </xsl:when>
+ <xsl:when test="$calculatedColumnEnd &lt;= $calculatedCellPosition">
+ <xsl:call-template name="get-related-column-style">
+ <!-- the given position of the cell in the table, a column style is searched -->
+ <xsl:with-param name="calculatedCellPosition" select="$calculatedCellPosition" />
+ <!-- all columns in XML -->
+ <xsl:with-param name="columnXMLNodes" select="$columnXMLNodes[position() != 1]"/>
+ <!-- the ending column position of the style in the table -->
+ <xsl:with-param name="earlierCalculatedColumnEnd" select="$calculatedColumnEnd" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="create-table-cell-content">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+ <xsl:apply-templates select="ss:Comment" mode="body"/>
+ <xsl:if test="ss:Data">
+ <text:p>
+ <xsl:call-template name="create-data-content">
+ <xsl:with-param name="style-id" select="@ss:StyleID"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-data-content">
+ <xsl:param name="style-id" select="@ss:StyleID"/>
+ <!-- collect every HTML 3.2 children, which are not empty -->
+ <xsl:variable name="html-children" select="ss:Data/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/>
+ <xsl:choose>
+ <xsl:when test="$html-children and $html-children != ''">
+ <xsl:for-each select="$html-children">
+ <text:span text:style-name="{concat($style-id, 'T', count(preceding::ss:Data[child::html:*]), '_', position())}">
+ <xsl:copy-of select="text()"/>
+ </text:span>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="contains(key('Style', $style-id)/ss:Font/@ss:VerticalAlign, 'script')">
+ <text:span text:style-name="{concat($style-id, 'T0')}">
+ <xsl:choose>
+ <xsl:when test="@ss:HRef">
+ <text:a xlink:href="{@ss:HRef}">
+ <xsl:value-of select="ss:Data"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ss:Data"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:span>
+ </xsl:when>
+ <xsl:when test="@ss:HRef">
+ <text:a xlink:href="{@ss:HRef}">
+ <xsl:value-of select="ss:Data"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ss:Data"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-condition-dependent-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="current-pos-str"/>
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str, $current-pos-str) and starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat(@ss:StyleID, '-ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@ss:StyleID">
+ <xsl:value-of select="@ss:StyleID"/>
+ </xsl:when>
+ <xsl:when test="../@ss:StyleID">
+ <xsl:value-of select="../@ss:StyleID"/>
+ </xsl:when>
+ <xsl:when test="../../@ss:StyleID">
+ <xsl:value-of select="../../@ss:StyleID"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not($style-name = '')">
+ <xsl:attribute name="table:style-name">
+ <xsl:value-of select="$style-name"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- maybe multi functions occur at same time in the same Cell, such as ConditionalFormatting and DataValidation -->
+ <xsl:if test="contains($condition-pos-str, $current-pos-str)">
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="after-str" select="substring-after($condition-pos-str, $current-pos-str)"/>
+ <xsl:if test="contains( $after-str, $current-pos-str)">
+ <xsl:variable name="temp-str-2">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before( $after-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="starts-with( $temp-str-2, 'v')">
+ <xsl:attribute name="table:content-validation-name">
+ <xsl:value-of select="concat('val', substring-after($temp-str-2, 'v'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="validation-row-column-string">
+ <!-- returns a string with structer,including row\column position by extraction from x:DataValidation -->
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="./x:DataValidation[position() = $index]/x:Range"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(v',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-row-column-string">
+ <!-- returns a string with structer,including row\column position by extraction from x:ConditionalFormatting -->
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::ss:Worksheet)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="./x:ConditionalFormatting[position() = $index]/x:Range"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(c',$table-pos,'-',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="parse-range">
+ <!-- returns a string,input param:the value of x:Range -->
+ <xsl:param name="range-value"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="first-pit">
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:value-of select="substring-before($range-value,',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$range-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current">
+ <xsl:choose>
+ <xsl:when test="contains($first-pit,':')">
+ <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/>
+ <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/>
+ <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/>
+ <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/>
+ <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/>
+ <xsl:variable name="the-str">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$R-start"/>
+ <xsl:with-param name="r-end" select="$R-end"/>
+ <xsl:with-param name="c-start" select="$C-start"/>
+ <xsl:with-param name="c-end" select="$C-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$the-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($first-pit,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="substring-after($range-value,',')"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-rc-str">
+ <!-- dealing the range of row\column -->
+ <xsl:param name="r-start"/>
+ <xsl:param name="r-end"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="concat('R',$r-start)"/>
+ <xsl:with-param name="start" select="$c-start"/>
+ <xsl:with-param name="end" select="$c-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$r-start &lt; $r-end">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$r-start + 1"/>
+ <xsl:with-param name="r-end" select="$r-end"/>
+ <xsl:with-param name="c-start" select="$c-start"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$r-start = $r-end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-c-str">
+ <!-- return value for the template condition-rc-str -->
+ <xsl:param name="rc-str"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/>
+ <xsl:if test="$start &lt; $end">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="$rc-str"/>
+ <xsl:with-param name="start" select="$start + 1"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$start = $end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="ss:Data">
+ <xsl:for-each select="descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]">
+ <style:style style:name="{concat(ancestor::ss:Cell/@ss:StyleID,'T',count(preceding::ss:Data[child::html:*]), '_', position())}" style:family="text">
+ <xsl:element name="style:text-properties">
+ <xsl:if test="ancestor-or-self::html:Font/@html:Face">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="ancestor-or-self::html:Font/@html:Face"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Font/@html:Size">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="concat(ancestor-or-self::html:Font/@html:Size,'pt')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Font/@html:Color">
+ <xsl:attribute name="fo:color">
+ <xsl:value-of select="ancestor-or-self::html:Font/@html:Color"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:B">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:I">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:U">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:S">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Sup">
+ <xsl:attribute name="style:text-position">33% 58%</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="ancestor-or-self::html:Sub">
+ <xsl:attribute name="style:text-position">-33% 58%</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="get-pos-content">
+ <xsl:param name="content"/>
+ <xsl:param name="pos"/>
+ <xsl:choose>
+ <xsl:when test="$pos = 'left'">
+ <xsl:choose>
+ <xsl:when test="contains($content,'&amp;C')">
+ <xsl:value-of select="substring-before( substring-after( $content, '&amp;L'), '&amp;C')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;R')">
+ <xsl:value-of select="substring-before( substring-after( $content, '&amp;L'), '&amp;R')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;L')">
+ <xsl:value-of select="substring-after( $content, '&amp;L')"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$pos = 'center'">
+ <xsl:choose>
+ <xsl:when test="contains($content,'&amp;R')">
+ <xsl:value-of select="substring-before( substring-after( $content, '&amp;C'), '&amp;R')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;C')">
+ <xsl:value-of select="substring-after( $content, '&amp;C')"/>
+ </xsl:when>
+ <xsl:when test="contains($content,'&amp;L')"/>
+ <xsl:otherwise>
+ <xsl:value-of select="$content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$pos = 'right'">
+ <xsl:value-of select="substring-after( $content, '&amp;R')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="@x:Data">
+ <xsl:variable name="style-name-header">
+ <xsl:value-of select="concat(ancestor::ss:Worksheet/@ss:Name, substring(name(..),1,1))"/>
+ </xsl:variable>
+ <xsl:variable name="left-style-data">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="."/>
+ <xsl:with-param name="pos" select="'left'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($left-style-data)&gt;0 and contains($left-style-data,'&amp;')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'L')"/>
+ <xsl:with-param name="style-data" select="$left-style-data"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:variable name="center-style-data">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="."/>
+ <xsl:with-param name="pos" select="'center'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($center-style-data)&gt;0 and contains($center-style-data,'&amp;')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'C')"/>
+ <xsl:with-param name="style-data" select="$center-style-data"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:variable name="right-style-data">
+ <xsl:call-template name="get-pos-content">
+ <xsl:with-param name="content" select="."/>
+ <xsl:with-param name="pos" select="'right'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($right-style-data)&gt;0 and contains($right-style-data,'&amp;')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="concat($style-name-header,'R')"/>
+ <xsl:with-param name="style-data" select="$right-style-data"/>
+ <xsl:with-param name="index" select="0"/>
+ <xsl:with-param name="current-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-header-footer-style">
+ <xsl:param name="style-name-header"/>
+ <xsl:param name="style-data"/>
+ <xsl:param name="index"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;D') or starts-with($current-style-data,'&amp;T') or starts-with($current-style-data,'&amp;P') or starts-with($current-style-data,'&amp;N') or starts-with($current-style-data,'&amp;A') or starts-with($current-style-data,'&amp;F') or starts-with($current-style-data,'&amp;Z')">
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="$current-pos +2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;')">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat($style-name-header,$index)"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ <xsl:variable name="next-style-header-pos">
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="index" select="$index+1"/>
+ <xsl:with-param name="current-pos" select="$next-style-header-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($current-style-data,'&amp;')">
+ <xsl:variable name="temp" select="substring-before($current-style-data,'&amp;')"/>
+ <xsl:call-template name="create-header-footer-style">
+ <xsl:with-param name="style-name-header" select="$style-name-header"/>
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="index" select="$index"/>
+ <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-header-footer-style-properties">
+ <xsl:param name="style-data"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- stack operations necessary -->
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;')">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="substring-before(substring-after($current-style-data,'&amp;&quot;'),',')"/>
+ </xsl:attribute>
+ <xsl:if test="contains(substring-before(substring-after($current-style-data,','),'&quot;'),'Bold')">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(substring-before(substring-after($current-style-data,','),'&quot;'),'Italic')">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="temp" select="substring-before(substring($style-data,$current-pos+2),'&quot;')"/>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos+3"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:variable name="font-size-length">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&amp;')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="concat(substring($current-style-data,2,$font-size-length),'pt')"/>
+ </xsl:attribute>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 1 + $font-size-length"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- dont' consider tangled or adjoined '&X' and '&Y', '&U' & '&E', processing-check is necessary, too complex. :( -->
+ <xsl:when test="starts-with($current-style-data,'&amp;X')">
+ <xsl:variable name="superscript-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;X'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$superscript-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-position">33% 58%</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;B')">
+ <xsl:variable name="subscript-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;B'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$subscript-count-before mod 2 = 0">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;Y')">
+ <xsl:variable name="subscript-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;Y'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$subscript-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-position">-33% 58%</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;S')">
+ <xsl:variable name="strikethrough-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;S'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$strikethrough-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;U')">
+ <xsl:variable name="single-underline-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;U'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$single-underline-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-underline-type">single</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;E')">
+ <xsl:variable name="double-underline-count-before">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring($style-data,1,$current-pos)"/>
+ <xsl:with-param name="substyle" select="'&amp;E'"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$double-underline-count-before mod 2 = 0">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-header-footer-style-properties">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-substyle-count-in-data">
+ <xsl:param name="style-data"/>
+ <xsl:param name="substyle"/>
+ <xsl:param name="count"/>
+ <xsl:choose>
+ <xsl:when test="contains($style-data,$substyle)">
+ <xsl:call-template name="get-substyle-count-in-data">
+ <xsl:with-param name="style-data" select="substring-after($style-data,$substyle)"/>
+ <xsl:with-param name="substyle" select="$substyle"/>
+ <xsl:with-param name="count" select="$count+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$count"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-current-content-pos">
+ <xsl:param name="style-data"/>
+ <xsl:param name="current-pos"/>
+ <xsl:variable name="current-style-data">
+ <xsl:value-of select="substring($style-data,$current-pos)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($current-style-data,'&amp;X') or starts-with($current-style-data,'&amp;Y') or starts-with($current-style-data,'&amp;S') or starts-with($current-style-data,'&amp;U') or starts-with($current-style-data,'&amp;E') or starts-with($current-style-data,'&amp;B')">
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos+2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;0') or starts-with($current-style-data,'&amp;1') or starts-with($current-style-data,'&amp;2') or starts-with($current-style-data,'&amp;3') or starts-with($current-style-data,'&amp;4') or starts-with($current-style-data,'&amp;5') or starts-with($current-style-data,'&amp;6') or starts-with($current-style-data,'&amp;7') or starts-with($current-style-data,'&amp;8') or starts-with($current-style-data,'&amp;9')">
+ <xsl:variable name="font-size-length">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after($current-style-data,'&amp;')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="$current-pos+1+$font-size-length"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="starts-with($current-style-data,'&amp;&quot;')">
+ <xsl:variable name="temp" select="substring-before(substring($style-data,$current-pos+2),'&quot;')"/>
+ <xsl:call-template name="get-current-content-pos">
+ <xsl:with-param name="style-data" select="$style-data"/>
+ <xsl:with-param name="current-pos" select="string-length($temp)+$current-pos+3"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$current-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- OASIS OpenDocument Format change:
+ Excel "=RC4*6"
+ OOoXML "=$D22*6"
+ OASIS XML "oooc:=[.$D22]*6" -->
+ <xsl:template name="translate-expression">
+ <!-- return position or range for formula or other -->
+ <xsl:param name="cell-row-pos"/>
+ <!-- the position in row (vertical) of cell -->
+ <xsl:param name="cell-column-pos"/>
+ <!-- the position in column (horizontal of cell -->
+ <xsl:param name="expression"/>
+ <!-- recomposed expression containing cell positions after every conversion -->
+ <xsl:param name="is-range-mode" select="false()"/>
+ <!-- as mode changes a '[.' resp. ']' is written out -->
+ <xsl:param name="return-value"/>
+ <!-- expression of table:cell-range-address is different than formula (e.g. no prefix) -->
+ <xsl:param name="isRangeAddress"/>
+ <!-- determines if the currently processed expression is relative -->
+ <xsl:param name="isRelative" select="false()" />
+
+ <!-- value to be given out later -->
+ <!-- to judge whether this input expression contains any cell position to convert -->
+ <xsl:variable name="temp-range">
+ <xsl:choose>
+ <xsl:when test="$expression != ''">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="$expression"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- if $range-type = 1, then range is representing a sheet, function's name or separated symbol, but not cell position,
+ or if $range-type = 2, range should be handled because it contains certain cell position.
+ The first character marks the type of that expression. -->
+ <xsl:variable name="range-type">
+ <xsl:choose>
+ <xsl:when test="substring($temp-range, 1, 1) = '1'">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="substring($temp-range, 1, 1) = '2'">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- remove that added range type token -->
+ <xsl:variable name="current-range">
+ <xsl:value-of select="substring($temp-range, 2)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$range-type = 1">
+ <!-- Nothing to convert, so just join the front and behind strings. -->
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression">
+ <!-- get current converting position from $temp-token or $current-range, then join the expression. -->
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '#$')">
+ <!-- because of recomposing of string, the $current-range may not be the pit
+ of $expression, so the char #$ should not be used for nominal -->
+ <xsl:variable name="temp-token">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '\')">
+ <xsl:value-of select="concat(']', substring-after($current-range, '#$'), &quot;&apos;&quot;)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, '#$')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($expression, $temp-token)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($expression, $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="return-value">
+ <!-- react on range mode change (when to insert closing ']' or in case of '!' change the mode to RANGE and create open '[' -->
+ <xsl:choose>
+ <xsl:when test="$current-range = '=' and $return-value = '' and not($isRangeAddress)">
+ <xsl:text>oooc:=</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($current-range, '!') and not($isRangeAddress)">
+ <xsl:value-of select="concat($return-value, '[', $current-range)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true' and $current-range != ':' and not($isRangeAddress)">
+ <xsl:value-of select="concat($return-value, ']', substring-before($expression, $current-range), $current-range)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode">
+ <xsl:choose>
+ <!-- ! is the separator of worksheet and range
+ : is the separator for a cell range -->
+ <xsl:when test="contains($current-range, '!') or $current-range = ':'">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="false()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- types of range to handle in $current-range, i.e. the cell position expression to convert
+ 1: special cell including row and column; e.g. R4C5
+ 2: whole row; e.g. R3
+ 3: whole column; e.g. C5
+ 4: other name not for cell or row/column; e.g. RANDOM() or something unknown
+ -->
+ <xsl:variable name="handle-type">
+ <xsl:choose>
+ <xsl:when test="starts-with($current-range, 'R')">
+ <!-- It's type 1 or type 2 or 4/unknown cell position. -->
+ <xsl:choose>
+ <xsl:when test="contains($current-range, 'C')">
+ <!-- It's type 1, specifying the cell position or 4/unknown -->
+ <xsl:variable name="part-type-r">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-before( substring-after($current-range, 'R'), 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="part-type-c">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($part-type-r = 1) and ($part-type-c = 1)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- It's type 2 specifying the cell position, or 4/unknown. -->
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'R')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($current-range, 'C')">
+ <!-- It's type 3 of cell position, or 4/unknown -->
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- It's type 4, not cell position -->
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Start to convert that cell position expression, that cell position unit -->
+ <xsl:choose>
+ <xsl:when test="$handle-type = 1">
+ <!-- It's type 1, e.g. R1C2 -->
+ <!-- process the row part -->
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- found one cell unit -->
+ <xsl:when test="$after-R='C' or $after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos+substring-before( substring-after($current-range,'R['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-R='C'">
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($current-range,'R'),'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='C'">relative</xsl:when>
+ <xsl:otherwise>absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- process the column part -->
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="column-digit-length">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after(substring-after($current-range,'R'),'C')"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + substring-before(substring-after(substring-after($current-range,'R'),'C['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,$column-digit-length)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">absolute</xsl:when>
+ <xsl:otherwise>relative</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="$column-pos-style"/>
+ <xsl:with-param name="row-pos-style" select="$row-pos-style"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before(substring-after($expression, '('),'R'),',!', ';.'))"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 2">
+ <!-- It's type 2, e.g. R3 -->
+ <!-- process the range only including a whole row -->
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-number">
+ <xsl:choose>
+ <xsl:when test="$after-R = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'R['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'R')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos + $row-number"/>
+ </xsl:when>
+ <xsl:when test="$after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:value-of select="$row-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="1"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="256"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'R'),',!', ';.'),'R')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 3">
+ <!-- It's type 3, e.g. C4 -->
+ <!-- process the range only including a whole column -->
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after($current-range,'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-C='[' or $after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:variable name="column-number">
+ <xsl:choose>
+ <xsl:when test="$after-C = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'C['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + $column-number"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="$column-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="1"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="65565"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'C'),',!', ';.'),'C')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'C')"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$is-range-mode = 'true'">
+ <xsl:value-of select="concat($return-value, $name-unit)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, '[.', $name-unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="is-range-mode" select="true()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- It's unknown, so just jump over it -->
+ <xsl:variable name="next-pit" select="substring-after($expression, $current-range)"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-pit, '+') or contains($next-pit, '-') or contains($next-pit, '*') or contains($next-pit, '/') or contains($next-pit, ')') or contains($next-pit, '^') or contains($next-pit, ':') or contains($next-pit, '&quot;') or contains($next-pit, ';') or contains($next-pit, ',') or contains($next-pit, '[')">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ <xsl:with-param name="is-range-mode" select="false()"/>
+ <xsl:with-param name="isRangeAddress" select="$isRangeAddress"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- return the final range or formula -->
+ <xsl:choose>
+ <!-- in case the closing bracket of the range wasn't set, do it now -->
+ <xsl:when test="$is-range-mode = 'true' and $current-range = ''">
+ <xsl:value-of select="translate( concat($return-value, ']'),',!', ';.')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate( concat($return-value, substring-before($expression, $current-range), $current-range),',!', ';.')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="parse-range-name">
+ <!-- return the string or name for next handle. the type 1 is names of function, sheet, special separated symbol, not to parse as range; type 2 is the range including R/C to be parsed -->
+ <xsl:param name="expression"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="first-one" select="substring($expression,1,1)"/>
+ <xsl:choose>
+ <xsl:when test="$first-one = '='">
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($return-value)) &gt; 0">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1=</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='(' or $first-one='!' or $first-one='&amp;'">
+ <xsl:value-of select="concat('1', $return-value, $first-one)"/>
+ </xsl:when>
+ <xsl:when test="$first-one='['">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after($expression, ']'), 'C')">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring-after($expression, ']')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(substring-before($expression, ']'), '.') and contains(substring-after($expression, ']'), '!')">
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, substring-before(substring-after($expression, '['), ']'), &quot;&apos;&quot;, '#$', substring-before(substring-after($expression, ']'), '!'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='&quot;'">
+ <xsl:value-of select="concat('1', $first-one, substring-before(substring-after($expression, '&quot;'), '&quot;'), '&quot;')"/>
+ </xsl:when>
+ <xsl:when test="$first-one=&quot;&apos;&quot;">
+ <!-- here the string &quot;&apos;&quot; represents a char &apos; -->
+ <xsl:variable name="str-in" select="substring-before(substring-after($expression, &quot;&apos;&quot;), &quot;&apos;&quot;)"/>
+ <xsl:choose>
+ <!-- for file path transformation -->
+ <xsl:when test="contains($str-in, '\') and contains($str-in, '[') and contains($str-in, ']')">
+ <xsl:variable name="first-pos" select="substring-before($str-in, '[')"/>
+ <xsl:variable name="second-pos" select="substring-before(substring-after($str-in, '['), ']')"/>
+ <xsl:variable name="third-pos" select="substring-after($str-in, ']')"/>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $first-pos, $second-pos, &quot;&apos;&quot;, '#$', $third-pos)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $str-in, &quot;&apos;&quot;)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='+' or $first-one='-' or $first-one='*' or $first-one='/' or $first-one=')' or $first-one='^' or $first-one=':' or $first-one='&quot;' or $first-one=';' or $first-one=',' or $first-one='&gt;' or $first-one='&lt;'">
+ <xsl:choose>
+ <xsl:when test="$return-value = ''">
+ <xsl:value-of select="concat('1', $first-one)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$expression = ''">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring($expression, 2, string-length($expression)-1)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring($expression, 1, 1))"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="handle-type-number">
+ <!-- to handle the part between R and C, or after C in range string in translate-expression. return type: 1: number or cell range; 2: other, not for next step -->
+ <xsl:param name="t-part"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($t-part, '[')">
+ <xsl:variable name="tt-str" select="substring-before( substring-after( $t-part, '['), ']')"/>
+ <xsl:choose>
+ <xsl:when test="($tt-str &lt; 0) or ($tt-str &gt; 0) or ($tt-str = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="($t-part &lt; 0) or ($t-part &gt; 0) or ($t-part = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="$t-part = ''">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-unit">
+ <!-- convert cell position expression unit, R1C1, R3, C4 -->
+ <xsl:param name="column-number"/>
+ <xsl:param name="row-number"/>
+ <xsl:param name="column-pos-style"/>
+ <xsl:param name="row-pos-style"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- position styles are 'absolute' or 'relative', -->
+ <xsl:choose>
+ <xsl:when test="$column-pos-style = 'absolute'">
+ <xsl:value-of select="concat( '$', $column-character1, $column-character2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( $column-character1, $column-character2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$row-pos-style ='absolute'">
+ <xsl:value-of select="concat( '$', $row-number)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-number"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-character">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number = 0"/>
+ <xsl:when test="$number = 1">A</xsl:when>
+ <xsl:when test="$number = 2">B</xsl:when>
+ <xsl:when test="$number = 3">C</xsl:when>
+ <xsl:when test="$number = 4">D</xsl:when>
+ <xsl:when test="$number = 5">E</xsl:when>
+ <xsl:when test="$number = 6">F</xsl:when>
+ <xsl:when test="$number = 7">G</xsl:when>
+ <xsl:when test="$number = 8">H</xsl:when>
+ <xsl:when test="$number = 9">I</xsl:when>
+ <xsl:when test="$number = 10">J</xsl:when>
+ <xsl:when test="$number = 11">K</xsl:when>
+ <xsl:when test="$number = 12">L</xsl:when>
+ <xsl:when test="$number = 13">M</xsl:when>
+ <xsl:when test="$number = 14">N</xsl:when>
+ <xsl:when test="$number = 15">O</xsl:when>
+ <xsl:when test="$number = 16">P</xsl:when>
+ <xsl:when test="$number = 17">Q</xsl:when>
+ <xsl:when test="$number = 18">R</xsl:when>
+ <xsl:when test="$number = 19">S</xsl:when>
+ <xsl:when test="$number = 20">T</xsl:when>
+ <xsl:when test="$number = 21">U</xsl:when>
+ <xsl:when test="$number = 22">V</xsl:when>
+ <xsl:when test="$number = 23">W</xsl:when>
+ <xsl:when test="$number = 24">X</xsl:when>
+ <xsl:when test="$number = 25">Y</xsl:when>
+ <xsl:when test="$number = 26">Z</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-digit-length">
+ <xsl:param name="complexive-string"/>
+ <xsl:variable name="first-char">
+ <xsl:value-of select="substring( $complexive-string, 1, 1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-char = '1' or $first-char = '2' or $first-char = '3' or $first-char = '4' or $first-char = '5' or $first-char = '6' or $first-char = '7' or $first-char = '8' or $first-char = '9' or $first-char = '0' ">
+ <xsl:variable name="temp">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring( $complexive-string, 2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$temp+1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="ss:Comment" mode="body">
+ <xsl:element name="office:annotation">
+ <xsl:if test="@ss:ShowAlways = '1'">
+ <xsl:attribute name="office:display">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@ss:Author">
+ <xsl:element name="dc:creator">
+ <xsl:value-of select="@ss:Author"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="ss:Data">
+ <text:p>
+ <xsl:call-template name="create-data-content">
+ <xsl:with-param name="style-id" select="@ss:StyleID"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Names">
+ <xsl:variable name="namedRanges" select="/ss:Workbook/ss:Worksheet/ss:Names/ss:NamedRange |
+ /ss:Workbook/ss:Names/ss:NamedRange" />
+ <xsl:if test="$namedRanges">
+ <table:named-expressions>
+ <xsl:for-each select="$namedRanges">
+ <xsl:choose>
+ <xsl:when test="contains( @ss:RefersTo, '!R')">
+ <xsl:variable name="referto">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="isRangeAddress" select="true()"/>
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="@ss:RefersTo"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="table:named-range">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:base-cell-address">
+ <xsl:variable name="worksheetName" select="translate(substring-before(@ss:RefersTo, '!'), '=', '$')" />
+ <xsl:call-template name="encode-as-cell-address">
+ <xsl:with-param name="string" select="concat($worksheetName,'.$A$1')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="table:cell-range-address">
+ <xsl:call-template name="encode-as-cell-range-address">
+ <xsl:with-param name="string" select="translate( $referto, '=', '$')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="@ss:Name = 'Print_Area'">
+ <xsl:attribute name="table:range-usable-as">print-range</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="expression-name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:variable>
+ <xsl:element name="table:named-expression">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="@ss:Name"/>
+ </xsl:attribute>
+ <!-- just set '$Sheet1.$A$1' as named-expressions virtual base-cell-address -->
+ <xsl:attribute name="table:base-cell-address">
+ <xsl:variable name="worksheetName" select="following-sibling::ss:Worksheet/@ss:Name" />
+ <xsl:call-template name="encode-as-cell-address">
+ <xsl:with-param name="string" select="concat('$', $worksheetName,'.$A$1')"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="table:expression">
+ <xsl:value-of select="substring( @ss:RefersTo, 2)"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </table:named-expressions>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="transform-advanced-filter">
+ <!-- transform the params of Advanced Filter.it's different from AutoFilter -->
+ <xsl:param name="target-value"/>
+ <xsl:param name="condition-pos"/>
+ <xsl:element name="table:database-range">
+ <xsl:variable name="target-range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="$target-value"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="$condition-pos"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:target-range-address">
+ <xsl:value-of select="$target-range"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat($target-range, '.filter')"/>
+ </xsl:attribute>
+ <xsl:element name="table:filter">
+ <xsl:attribute name="table:condition-source-range-address">
+ <xsl:value-of select="$condition-range"/>
+ </xsl:attribute>
+ <xsl:element name="table:filter-condition">
+ <xsl:attribute name="table:field-number">0</xsl:attribute>
+ <!-- The two attributes are recommended by OASIS -->
+ <xsl:attribute name="table:value"/>
+ <xsl:attribute name="table:operator"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="x:AutoFilter">
+ <!-- for AutoFilter -->
+ <xsl:element name="table:database-range">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat(../@ss:Name,'_',@x:Range)"/>
+ </xsl:attribute>
+ <xsl:variable name="range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="@x:Range"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:target-range-address">
+ <xsl:value-of select="concat('$',../@ss:Name,'.',$range)"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:display-filter-buttons">true</xsl:attribute>
+ <xsl:element name="table:filter">
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="item-pos" select="1"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="total" select="count(./x:AutoFilterColumn)"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="auto-filter-condition">
+ <!--?? generate element of filter-condition for AutoCondition to get position of index -->
+ <xsl:param name="item-pos"/>
+ <xsl:param name="index"/>
+ <xsl:param name="total"/>
+ <xsl:if test="($index - 1 &lt; $total) or ($index - 1 = $total)">
+ <xsl:element name="table:filter-condition">
+ <xsl:attribute name="table:data-type">number</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'TopPercent'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'top value'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Top'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'top values'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'TopPercent'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'top percent'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Bottom'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'bottom values'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'BottomPercent'">
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'bottom percent'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Type = 'Custom'">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/x:AutoFilterOr or ./x:AutoFilterColumn[position() = $item-pos]/x:AutoFilterAnd">
+ <xsl:attribute name="table:operator">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'Equals'">
+ <xsl:value-of select="'='"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'DoesNotEquals'">
+ <xsl:value-of select="'!='"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'GreaterThan'">
+ <xsl:value-of select="'&gt;'"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'GreaterThanOrEqual'">
+ <xsl:value-of select="'&gt;='"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'LessThan'">
+ <xsl:value-of select="'&lt;'"/>
+ </xsl:when>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]//@x:Operator = 'LessThanOrEqual'">
+ <xsl:value-of select="'&lt;='"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'='"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]//@x:Value"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:operator">
+ <xsl:value-of select="'bottom percent'"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:value">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]//@x:Value"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="table:field-number">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Index">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Index - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$index - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="item-pos" select="$item-pos + 1"/>
+ <xsl:with-param name="index">
+ <xsl:choose>
+ <xsl:when test="./x:AutoFilterColumn[position() = $item-pos]/@x:Index">
+ <xsl:value-of select="./x:AutoFilterColumn[position() = $item-pos]/@x:Index + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$index + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="total" select="count(./x:AutoFilterColumn)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="x:Sorting">
+ <!-- for Sorting don't contains header row -->
+ <xsl:if test="contains(./x:Sort, 'Column')">
+ <xsl:element name="table:database-range">
+ <xsl:variable name="first-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 1], 'Column'))"/>
+ <xsl:variable name="second-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 2], 'Column'))"/>
+ <xsl:variable name="third-sort-letter" select="normalize-space(substring-after(./x:Sort[position() = 3], 'Column'))"/>
+ <xsl:variable name="first-sort-num">
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="$first-sort-letter"/>
+ <xsl:with-param name="return-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="second-sort-num">
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="$second-sort-letter"/>
+ <xsl:with-param name="return-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="third-sort-num">
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="$third-sort-letter"/>
+ <xsl:with-param name="return-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="min-left-num">
+ <xsl:call-template name="min-of-three">
+ <xsl:with-param name="first-num" select="$first-sort-num"/>
+ <xsl:with-param name="second-num" select="$second-sort-num"/>
+ <xsl:with-param name="third-num" select="$third-sort-num"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="max-right-num">
+ <xsl:call-template name="max-of-three">
+ <xsl:with-param name="first-num" select="$first-sort-num"/>
+ <xsl:with-param name="second-num" select="$second-sort-num"/>
+ <xsl:with-param name="third-num" select="$third-sort-num"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="left-column">
+ <xsl:call-template name="number-to-letter">
+ <xsl:with-param name="source-number" select="$min-left-num"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="right-column">
+ <xsl:call-template name="number-to-letter">
+ <xsl:with-param name="source-number" select="$max-right-num"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:target-range-address">
+ <xsl:value-of select="concat(../@ss:Name, '.', $left-column, '1:', ../@ss:Name, '.', $right-column, '32000')"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat(../@ss:Name, '.sort')"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:contains-header">
+ <xsl:value-of select="'false'"/>
+ </xsl:attribute>
+ <xsl:element name="table:sort">
+ <xsl:for-each select="./x:Sort">
+ <xsl:element name="table:sort-by">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="0"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:data-type">
+ <xsl:value-of select="'automatic'"/>
+ </xsl:attribute>
+ <xsl:variable name="after-sort" select="following-sibling::*"/>
+ <xsl:if test="name($after-sort[position() = 1]) = 'Descending'">
+ <xsl:attribute name="table:order">
+ <xsl:value-of select="'descending'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="$first-sort-num - $min-left-num"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="position() = 2">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="$second-sort-num - $min-left-num"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="position() = 3">
+ <xsl:attribute name="table:field-number">
+ <xsl:value-of select="$third-sort-num - $min-left-num"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="letter-to-number">
+ <!-- convert letter to number for sorting. the string source-letter should be normalize-space and the first return-value should be zero -->
+ <xsl:param name="source-letter"/>
+ <xsl:param name="return-value"/>
+ <xsl:choose>
+ <xsl:when test="string-length($source-letter) &gt; 0">
+ <xsl:variable name="first-pit" select="substring($source-letter, 1, 1)"/>
+ <xsl:variable name="pit-number">
+ <xsl:choose>
+ <xsl:when test="($first-pit = 'A') or ($first-pit = 'a')">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'B') or ($first-pit = 'b')">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'C') or ($first-pit = 'c')">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'D') or ($first-pit = 'd')">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'E') or ($first-pit = 'e')">
+ <xsl:value-of select="5"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'F') or ($first-pit = 'f')">
+ <xsl:value-of select="6"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'G') or ($first-pit = 'g')">
+ <xsl:value-of select="7"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'H') or ($first-pit = 'h')">
+ <xsl:value-of select="8"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'I') or ($first-pit = 'i')">
+ <xsl:value-of select="9"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'J') or ($first-pit = 'j')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'K') or ($first-pit = 'k')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'L') or ($first-pit = 'l')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'M') or ($first-pit = 'm')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'N') or ($first-pit = 'n')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'O') or ($first-pit = 'o')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'P') or ($first-pit = 'p')">
+ <xsl:value-of select="16"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'Q') or ($first-pit = 'q')">
+ <xsl:value-of select="17"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'R') or ($first-pit = 'r')">
+ <xsl:value-of select="18"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'S') or ($first-pit = 's')">
+ <xsl:value-of select="19"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'T') or ($first-pit = 't')">
+ <xsl:value-of select="20"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'U') or ($first-pit = 'u')">
+ <xsl:value-of select="21"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'V') or ($first-pit = 'v')">
+ <xsl:value-of select="22"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'W') or ($first-pit = 'w')">
+ <xsl:value-of select="23"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'X') or ($first-pit = 'x')">
+ <xsl:value-of select="24"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'Y') or ($first-pit = 'y')">
+ <xsl:value-of select="25"/>
+ </xsl:when>
+ <xsl:when test="($first-pit = 'Z') or ($first-pit = 'z')">
+ <xsl:value-of select="26"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="letter-to-number">
+ <xsl:with-param name="source-letter" select="substring($source-letter, 2)"/>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="string-length($source-letter) &gt;= 2">
+ <xsl:value-of select="$pit-number * 26 + $return-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$pit-number + $return-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-letter">
+ <!--?? convert number to letter for sorting -->
+ <xsl:param name="source-number"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="current-value">
+ <xsl:call-template name="num-conv-letter">
+ <xsl:with-param name="first-pit">
+ <xsl:choose>
+ <xsl:when test="$source-number &gt; 26">
+ <xsl:value-of select="floor($source-number div 26)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$source-number"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$source-number &gt; 26">
+ <xsl:call-template name="number-to-letter">
+ <xsl:with-param name="source-number" select="$source-number mod 26"/>
+ <xsl:with-param name="return-value" select="concat($return-value,$current-value)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$source-number &lt; 27">
+ <xsl:value-of select="concat($return-value,$current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="num-conv-letter">
+ <!-- convert number to number by pit of 26 -->
+ <xsl:param name="first-pit"/>
+ <xsl:choose>
+ <xsl:when test="$first-pit = 1">
+ <xsl:value-of select="'A'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 2">
+ <xsl:value-of select="'B'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 3">
+ <xsl:value-of select="'C'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 4">
+ <xsl:value-of select="'D'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 5">
+ <xsl:value-of select="'E'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 6">
+ <xsl:value-of select="'F'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 7">
+ <xsl:value-of select="'G'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 8">
+ <xsl:value-of select="'H'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 9">
+ <xsl:value-of select="'I'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 10">
+ <xsl:value-of select="'J'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 11">
+ <xsl:value-of select="'K'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 12">
+ <xsl:value-of select="'L'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 13">
+ <xsl:value-of select="'M'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 14">
+ <xsl:value-of select="'N'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 15">
+ <xsl:value-of select="'O'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 16">
+ <xsl:value-of select="'P'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 17">
+ <xsl:value-of select="'Q'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 18">
+ <xsl:value-of select="'R'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 19">
+ <xsl:value-of select="'S'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 20">
+ <xsl:value-of select="'T'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 21">
+ <xsl:value-of select="'U'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 22">
+ <xsl:value-of select="'V'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 23">
+ <xsl:value-of select="'W'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 24">
+ <xsl:value-of select="'X'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 25">
+ <xsl:value-of select="'Y'"/>
+ </xsl:when>
+ <xsl:when test="$first-pit = 26">
+ <xsl:value-of select="'Z'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'A'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="min-of-three">
+ <!-- return minest of three for sorting -->
+ <xsl:param name="first-num"/>
+ <xsl:param name="second-num"/>
+ <xsl:param name="third-num"/>
+ <xsl:variable name="first-comp">
+ <xsl:choose>
+ <xsl:when test="$first-num = 0">
+ <xsl:value-of select="$second-num"/>
+ </xsl:when>
+ <xsl:when test="($first-num &lt; $second-num) or ($second-num = 0)">
+ <xsl:value-of select="$first-num"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="second-comp">
+ <xsl:choose>
+ <xsl:when test="($first-comp &lt; $third-num) or ($third-num = 0)">
+ <xsl:value-of select="$first-comp"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$third-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$second-comp"/>
+ </xsl:template>
+ <xsl:template name="max-of-three">
+ <!-- return maxest of three for sorting -->
+ <xsl:param name="first-num"/>
+ <xsl:param name="second-num"/>
+ <xsl:param name="third-num"/>
+ <xsl:variable name="first-comp">
+ <xsl:choose>
+ <xsl:when test="$first-num &gt; $second-num">
+ <xsl:value-of select="$first-num"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$second-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="second-comp">
+ <xsl:choose>
+ <xsl:when test="$first-comp &gt; $third-num">
+ <xsl:value-of select="$first-comp"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$third-num"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$second-comp"/>
+ </xsl:template>
+ <xsl:template name="set-calculation">
+ <xsl:element name="table:calculation-settings">
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:PrecisionAsDisplayed">
+ <xsl:attribute name="table:precision-as-shown">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:Date1904">
+ <table:null-date office:date-value="1904-01-01"/>
+ </xsl:if>
+ <xsl:element name="table:iteration">
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:Iteration">
+ <xsl:attribute name="table:status">enable</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:MaxIterations">
+ <xsl:attribute name="table:steps">
+ <xsl:value-of select="/ss:Workbook/x:ExcelWorkbook/x:MaxIterations"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/ss:Workbook/x:ExcelWorkbook/x:MaxChange">
+ <xsl:attribute name="table:maximum-difference">
+ <xsl:value-of select="/ss:Workbook/x:ExcelWorkbook/x:MaxChange"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="x:DataValidation">
+ <!-- for DataValidation. don't support the attribute IMEMode currently. -->
+ <xsl:element name="table:content-validation">
+ <xsl:attribute name="table:name">
+ <xsl:value-of select="concat('val', position())"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:condition"><!-- don't support two type of qualifier: List, Custom -->
+ <xsl:variable name="qualifier-content">
+ <xsl:choose>
+ <xsl:when test="./x:Qualifier = 'NotBetween'">
+ <xsl:value-of select="concat('cell-content-is-not-between(', ./x:Min, ',', ./x:Max, ')')"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'NotEqual'">
+ <xsl:value-of select="concat('!=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'Equal'">
+ <xsl:value-of select="concat('=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'Less'">
+ <xsl:value-of select="concat('&lt;', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'Greater'">
+ <xsl:value-of select="concat('&gt;', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'GreaterOrEqual'">
+ <xsl:value-of select="concat('&gt;=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:when test="./x:Qualifier = 'LessOrEqual'">
+ <xsl:value-of select="concat('&lt;=', ./x:Value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-between(', ./x:Min, ',', ./x:Max)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="qualifier-value">
+ <xsl:choose>
+ <xsl:when test="./x:Type = 'Whole'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-whole-number() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-whole-number() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'Decimal'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-decimal-number() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-decimal-number() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'Date'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-date() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-date() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'Time'">
+ <xsl:choose>
+ <xsl:when test="(./x:Qualifier = 'NotBetween') or ./x:Max">
+ <xsl:value-of select="concat('cell-content-is-time() and ', $qualifier-content, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-is-time() and ', 'cell-content()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="./x:Type = 'TextLength'">
+ <xsl:choose>
+ <xsl:when test="./x:Qualifier = 'NotBetween'">
+ <xsl:value-of select="concat('cell-content-text-length-is-not-between(', ./x:Min, ',', ./x:Max, ')')"/>
+ </xsl:when>
+ <xsl:when test="./x:Max and ./x:Min">
+ <xsl:value-of select="concat('cell-content-text-length-is-between(', ./x:Min, ',', ./x:Max, ')')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content-text-length()', $qualifier-content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./x:Type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$qualifier-value"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:base-cell-address">
+ <xsl:variable name="first-range">
+ <xsl:choose>
+ <xsl:when test="contains(./x:Range, ',')">
+ <xsl:value-of select="substring-before(./x:Range, ',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./x:Range"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="range">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="$first-range"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="encode-as-cell-address">
+ <xsl:with-param name="string" select="concat(../../ss:Worksheet/@ss:Name, '.', $range)"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:element name="table:help-message">
+ <xsl:attribute name="table:title">
+ <xsl:value-of select="./x:InputTitle"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:display">
+ <xsl:choose>
+ <xsl:when test="./x:InputHide">
+ <xsl:value-of select="'false'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'true'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="./x:InputMessage"/>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="table:error-message">
+ <xsl:attribute name="table:message-type">
+ <xsl:choose>
+ <xsl:when test="./x:ErrorStyle= 'Info'">
+ <xsl:value-of select="'information'"/>
+ </xsl:when>
+ <xsl:when test="./x:ErrorStyle= 'Warn'">
+ <xsl:value-of select="'warning'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'stop'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="table:title">
+ <xsl:value-of select="./x:ErrorTitle"/>
+ </xsl:attribute>
+ <xsl:attribute name="table:display">
+ <xsl:choose>
+ <xsl:when test="./x:ErrorHide">
+ <xsl:value-of select="'false'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'true'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="./x:ErrorMessage"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <!-- Note: Move template to common section -->
+ <xsl:template name="encode-as-cell-range-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-nc-name">
+ <xsl:param name="string"/>
+ <xsl:value-of select="translate($string, '.%()/\+[]', '')"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/uof/uof2odf_presentation.xsl b/filter/source/xslt/import/uof/uof2odf_presentation.xsl
new file mode 100644
index 000000000000..8e03235c63bc
--- /dev/null
+++ b/filter/source/xslt/import/uof/uof2odf_presentation.xsl
@@ -0,0 +1,3478 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" 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:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:template match="uof:UOF">
+ <office:document 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:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:apply-templates select="uof:元数据"/>
+ <office:settings>
+ <xsl:variable name="PageNumberFormat" select="/uof:UOF/uof:演示文稿/演:公用处理规则/演:页面设置集/演:页面设置/演:页码格式[1]"/>
+ <xsl:variable name="proportion">
+ <xsl:value-of select="substring-before(/uof:UOF/uof:演示文稿/演:公用处理规则/演:显示比例,'%')"/>
+ </xsl:variable>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleAreaWidth" config:type="int">14098</config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">9998</config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">view1</config:config-item>
+ <config:config-item config:name="GridIsVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="GridIsFront" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsSnapToGrid" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsSnapToPageMargins" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsSnapToSnapLines" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsSnapToObjectFrame" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsSnapToObjectPoints" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsPlusHandlesAlwaysVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsFrameDragSingles" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="EliminatePolyPointLimitAngle" config:type="int">1500</config:config-item>
+ <config:config-item config:name="IsEliminatePolyPoints" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="VisibleLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item>
+ <config:config-item config:name="PrintableLayers" config:type="base64Binary">//////////////////////////////////////////8=</config:config-item>
+ <config:config-item config:name="LockedLayers" config:type="base64Binary"/>
+ <config:config-item config:name="NoAttribs" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="NoColors" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="RulerIsVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PageKind" config:type="short">0</config:config-item>
+ <config:config-item config:name="SelectedPage" config:type="short">0</config:config-item>
+ <config:config-item config:name="IsLayerMode" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsBigHandles" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsDoubleClickTextEdit" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsClickChangeRotation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SlidesPerRow" config:type="short">4</config:config-item>
+ <config:config-item config:name="EditModeStandard" config:type="int">0</config:config-item>
+ <config:config-item config:name="EditModeNotes" config:type="int">0</config:config-item>
+ <config:config-item config:name="EditModeHandout" config:type="int">1</config:config-item>
+ <config:config-item config:name="VisibleAreaTop" config:type="int">-5402</config:config-item>
+ <config:config-item config:name="VisibleAreaLeft" config:type="int">-441</config:config-item>
+ <config:config-item config:name="VisibleAreaWidth" config:type="int">
+ <xsl:value-of select="(100*13997) div $proportion"/>
+ </config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">
+ <xsl:value-of select="(100*15426) div $proportion"/>
+ </config:config-item>
+ <config:config-item config:name="GridCoarseWidth" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridCoarseHeight" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridFineWidth" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridFineHeight" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridSnapWidth" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridSnapHeight" config:type="int">1000</config:config-item>
+ <config:config-item config:name="GridSnapWidthXNumerator" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridSnapWidthXDenominator" config:type="int">1</config:config-item>
+ <config:config-item config:name="GridSnapWidthYNumerator" config:type="int">500</config:config-item>
+ <config:config-item config:name="GridSnapWidthYDenominator" config:type="int">1</config:config-item>
+ <config:config-item config:name="IsAngleSnapEnabled" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SnapAngle" config:type="int">1500</config:config-item>
+ <config:config-item config:name="ZoomOnPage" config:type="boolean">true</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="PageNumberFormat" config:type="int">
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:演示文稿/演:公用处理规则/演:页面设置集/演:页面设置/演:页码格式">
+ <xsl:choose>
+ <xsl:when test="$PageNumberFormat='upper-letter'">0</xsl:when>
+ <xsl:when test="$PageNumberFormat='lower-letter'">1</xsl:when>
+ <xsl:when test="$PageNumberFormat='upper-roman'">2</xsl:when>
+ <xsl:when test="$PageNumberFormat='lower-letter'">3</xsl:when>
+ <xsl:when test="$PageNumberFormat='decimal'">4</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>5</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ <office:scripts/>
+ <xsl:element name="office:font-face-decls">
+ <style:font-face style:name="宋体" svg:font-family="宋体" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <xsl:apply-templates select="uof:式样集/uof:字体集"/>
+ </xsl:element>
+ <office:styles>
+ <xsl:apply-templates select="uof:演示文稿/演:公用处理规则/演:页面版式集/演:页面版式"/>
+ <xsl:call-template name="编号字体"/>
+ <xsl:for-each select="uof:式样集/uof:段落式样">
+ <xsl:variable name="outline" select="@字:标识符"/>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]">
+ <xsl:call-template name="段落式样"/>
+ </xsl:when>
+ <xsl:when test="contains($outline,'outline')">
+ <xsl:call-template name="段落式样"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:apply-templates select="uof:演示文稿/演:公用处理规则/演:配色方案集/演:配色方案"/>
+ <xsl:apply-templates select="uof:式样集/uof:句式样"/>
+ <xsl:for-each select="uof:式样集/uof:段落式样">
+ <xsl:variable name="outline" select="@字:标识符"/>
+ <xsl:if test="not(/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]) and not(contains($outline,'outline'))">
+ <xsl:call-template name="段落式样"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:对象集"/>
+ <xsl:call-template name="create-page-master">
+ <xsl:with-param name="impressoptions" select="uof:演示文稿/演:公用处理规则/演:页面设置集/演:页面设置"/>
+ </xsl:call-template>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形/图:文本内容/字:段落/字:段落属性/字:自动编号信息">
+ <xsl:variable name="currlistid" select="@字:编号引用"/>
+ <xsl:variable name="currlist" select="."/>
+ <xsl:variable name="rootlist" select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符 =$currlistid]"/>
+ <xsl:if test="not(ancestor::字:段落/preceding-sibling::字:段落[1]/字:段落属性/字:自动编号信息/@字:编号引用= $currlistid)">
+ <xsl:element name="text:list-style">
+ <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::字:自动编号信息)"/></xsl:attribute>
+ <xsl:for-each select="$rootlist">
+ <xsl:call-template name="自动编号"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:apply-templates select="uof:演示文稿/演:主体/演:母版集"/>
+ </office:master-styles>
+ <office:body>
+ <office:presentation>
+ <xsl:apply-templates select="uof:演示文稿/演:主体/演:幻灯片集"/>
+ <xsl:apply-templates select="uof:演示文稿/演:公用处理规则/演:放映设置"/>
+ </office:presentation>
+ </office:body>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="演:放映设置">
+ <presentation:settings>
+ <xsl:variable name="start-page">
+ <xsl:choose>
+ <xsl:when test="contains(演:幻灯片序列,' ')">
+ <xsl:value-of select="substring-before(演:幻灯片序列,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="演:幻灯片序列"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-page">
+ <xsl:value-of select="/uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片[1]/@演:名称"/>
+ </xsl:variable>
+ <xsl:if test="not($start-page = $first-page)">
+ <xsl:attribute name="presentation:start-page"><xsl:value-of select="$start-page"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:全屏放映='false'">
+ <xsl:attribute name="presentation:full-screen">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:循环放映='true'">
+ <xsl:attribute name="presentation:endless">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:放映间隔">
+ <xsl:attribute name="presentation:pause"><xsl:variable name="OOtime"><xsl:value-of select="substring-after(演:放映间隔,'P0Y0M0DT')"/></xsl:variable><xsl:value-of select="concat('PT',$OOtime)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:手动方式='true'">
+ <xsl:attribute name="presentation:force-manual">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:导航帮助='true'">
+ <xsl:attribute name="presentation:start-with-navigator">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:放映动画='false'">
+ <xsl:attribute name="presentation:animations">disabled</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:前端显示='true'">
+ <xsl:attribute name="presentation:stay-on-top">true</xsl:attribute>
+ </xsl:if>
+ </presentation:settings>
+ </xsl:template>
+ <xsl:template name="自动编号">
+ <xsl:for-each select="字:级别">
+ <xsl:choose>
+ <xsl:when test="字:项目符号">
+ <xsl:call-template name="xiangmufuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="字:图片符号引用">
+ <xsl:call-template name="imagefuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="jibianhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="编号字体">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号">
+ <xsl:if test="字:级别/字:符号字体">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat( @字:标识符,字:级别/@字:级别值)"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:attribute name="fo:color"><xsl:value-of select="字:级别/字:符号字体/字:字体/@字:颜色"/></xsl:attribute>
+ <xsl:if test="字:级别/字:符号字体/字:粗体 and 字:级别/字:符号字体/字:粗体/@字:值='true'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="ziti">
+ <xsl:value-of select="字:级别/字:符号字体/字:字体/@字:中文字体引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:字体集/uof:字体声明">
+ <xsl:if test="@uof:标识符=$ziti">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:attribute name="fo:font-style">normal</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">normal</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="uof:对象集">
+ <xsl:apply-templates select="图:图形"/>
+ <xsl:apply-templates select="图:图形/图:文本内容/字:段落/字:句/字:句属性" mode="style"/>
+ </xsl:template>
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="/uof:UOF/uof:演示文稿/演:公用处理规则/演:度量单位"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">inch</xsl:when>
+ <xsl:otherwise>pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:key match="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版/uof:锚点 | /uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片/uof:锚点 | /uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片/演:幻灯片备注/uof:锚点" name="rel_graphic_name" use="@uof:图形引用"/>
+ <xsl:template match="图:图形">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:call-template name="graphic-fill">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:填充/图:渐变"/>
+ </xsl:call-template>
+ <xsl:variable name="biaozhifu" select="@图:标识符"/>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="图:预定义图形/图:类别='3' or 图:预定义图形/图:类别='67'">presentation</xsl:when><xsl:otherwise>graphic</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版/uof:锚点[@uof:图形引用=$biaozhifu]">
+ <xsl:variable name="duan" select="图:文本内容/字:段落/字:段落属性/@字:式样引用"/>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="/uof:UOF/uof:式样集/uof:段落式样[@字:标识符=$duan]/@字:基式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:graphic-properties">
+ <xsl:call-template name="process-graphics">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="图:预定义图形/图:类别='3' or 图:预定义图形/图:类别='67'">presentation</xsl:when><xsl:otherwise>graphic</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版/uof:锚点[@uof:图形引用=$biaozhifu]">
+ <xsl:variable name="duan" select="图:文本内容/字:段落/字:段落属性/@字:式样引用"/>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="/uof:UOF/uof:式样集/uof:段落式样[@字:标识符=$duan]/@字:基式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="@图:其他对象">
+ <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute>
+ <xsl:attribute name="draw:color-mode">standard</xsl:attribute>
+ <xsl:attribute name="draw:luminance">0%</xsl:attribute>
+ <xsl:attribute name="draw:contrast">0%</xsl:attribute>
+ <xsl:attribute name="draw:gamma">100%</xsl:attribute>
+ <xsl:attribute name="draw:red">0%</xsl:attribute>
+ <xsl:attribute name="draw:green">0%</xsl:attribute>
+ <xsl:attribute name="draw:blue">0%</xsl:attribute>
+ <xsl:attribute name="draw:image-opacity">100%</xsl:attribute>
+ <xsl:attribute name="style:mirror">none</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-graphics"/>
+ </xsl:element>
+ <xsl:if test="图:文本内容/@图:文字排列方向='vert-r2l' or 图:文本内容/@图:文字排列方向='vert-l2r'">
+ <xsl:element name="style:paragraph-properties">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-graphics">
+ <xsl:param name="draw-name"/>
+ <xsl:if test="not(key('rel_graphic_name',@图:标识符)/@uof:随动方式='movesize')">
+ <xsl:attribute name="style:protect"><xsl:choose><xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:随动方式='move'">size</xsl:when><xsl:otherwise>position size</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(图:预定义图形/图:属性/图:填充)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:attribute>
+ <xsl:if test="not(图:预定义图形/图:属性/图:填充/图:图片/@图:位置='title')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:前景色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:渐变/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="图:预定义图形/图:属性/图:线颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')">
+ <xsl:variable name="linetype" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$linetype='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$linetype='dot-dot-dash' or $linetype='dash-dot-dot-heavy'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$linetype='dash' or $linetype='dashed-heavy'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$linetype='dotted' or $linetype='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$linetype='double'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$linetype='dot-dash' or $linetype='dash-dot-heavy'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$linetype='wave' or $linetype='wavy-heavy'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$linetype='wavy-double'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:otherwise>Fine Dashed</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线粗细">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头">
+ <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头/图:大小">
+ <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头">
+ <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头/图:大小">
+ <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:透明度">
+ <xsl:attribute name="draw:opacity"><xsl:variable name="opacity"><xsl:value-of select="./图:预定义图形/图:属性/图:透明度"/></xsl:variable><xsl:value-of select="concat((1 - $opacity)*100,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:for-each select="图:文本内容">
+ <xsl:if test="@图:上边距">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(@图:上边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(@图:下边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(@图:左边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(@图:右边距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@图:文字排列方向='middle')">
+ <xsl:variable name="hori-or-vert" select="@图:文字排列方向"/>
+ <xsl:choose>
+ <xsl:when test="$hori-or-vert='vert-l2r'">
+ <xsl:attribute name="draw:textarea-vertical-align">bottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$hori-or-vert='hori-l2r'">
+ <xsl:attribute name="draw:textarea-horizontal-align">left</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$hori-or-vert='hori-r2l'">
+ <xsl:attribute name="draw:textarea-horizontal-align">right</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hori-or-vert"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@图:自动换行">
+ <xsl:attribute name="fo:wrap-option">no-wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:auto-grow-width"><xsl:choose><xsl:when test="@图:大小适应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="bina_graphic">
+ <xsl:param name="refGraphic"/>
+ <xsl:element name="office:binary-data">
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]">
+ <xsl:value-of select="uof:数据"/>
+ </xsl:for-each>
+ </xsl:element>
+ <text:p/>
+ </xsl:template>
+ <xsl:template name="graphic-fill">
+ <xsl:param name="draw-name"/>
+ <xsl:param name="gradient-name"/>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:渐变方向 * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="$gradient-name/@图:种子X位置">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:种子X位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$gradient-name/@图:种子Y位置">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:种子Y位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line_20_Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow_20_concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square_20_45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型">
+ <xsl:variable name="line" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:element name="draw:stroke-dash">
+ <xsl:choose>
+ <xsl:when test="$line='dash-long' or $line='dash-long-heavy'">
+ <xsl:attribute name="draw:name">Fine_20_Dashed</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Fine dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dot-dash' or $line='dash-dot-dot-heavy'">
+ <xsl:attribute name="draw:name">_32__20_Dots_20_1_20_Dash</xsl:attribute>
+ <xsl:attribute name="draw:display-name">2 Dots 1 Dash</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.203cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.203cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dash' or $line='dashed-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine_20_Dashed</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Ultrafine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.051cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dotted' or $line='dotted-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine_20_Dotted_20__28_var_29_</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Ultrafine Dotted (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:distance">50%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wave' or $line='wavy-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Ultrafine 2 Dots 3 Dashes</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.254cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.127cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dash' or $line='dash-dot-heavy'">
+ <xsl:attribute name="draw:name">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:attribute>
+ <xsl:attribute name="draw:display-name">3 Dashes 3 Dots (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">3</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:distance">100%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='double'">
+ <xsl:attribute name="draw:name">Line_20_with_20_Fine_20_Dots</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Line with Fine Dots</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">2.007cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">10</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.152cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wavy-double'">
+ <xsl:attribute name="draw:name">Fine_20_Dashed_20__28_var_29_</xsl:attribute>
+ <xsl:attribute name="draw:display-name">Fine Dashed (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:distance">197%</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:name">Fine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-page-master">
+ <xsl:param name="impressoptions"/>
+ <xsl:for-each select="$impressoptions">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="@演:标识符"/></xsl:call-template></xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:if test="演:纸张/@uof:宽度">
+ <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(演:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:纸张/@uof:高度">
+ <xsl:attribute name="fo:page-height"><xsl:value-of select="concat((演:纸张/@uof:高度),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:页边距">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(演:页边距/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(演:页边距/@uof:下,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(演:页边距/@uof:左,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(演:页边距/@uof:右,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="演:纸张方向 = 'landscape'">
+ <xsl:attribute name="style:print-orientation">landscape</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:print-orientation">portrait</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="encode-as-nc-name">
+ <xsl:param name="string"/>
+ <xsl:value-of select="translate($string, '. %()/\+', '')"/>
+ </xsl:template>
+ <xsl:key name="tianchongmu" match="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版" use="@演:配色方案引用"/>
+ <xsl:key name="tianchonghuan" match="/uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片" use="@演:标识符"/>
+ <xsl:template match="演:配色方案">
+ <xsl:if test="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:call-template name="officestyle"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:call-template name="officestyle"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">drawing-page</xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:element name="style:drawing-page-properties">
+ <xsl:if test="演:填充">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="演:背景色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:背景色">
+ <xsl:attribute name="draw:background-size">border</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:阴影">
+ <xsl:attribute name="draw:shadow">visible</xsl:attribute>
+ <xsl:attribute name="draw:shadow-color"><xsl:value-of select="演:阴影"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:文本和线条">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="演:文本和线条"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchongmu',@演:标识符)/演:背景">
+ <xsl:call-template name="background"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:for-each select="key('tianchonghuan',@演:标识符)/演:背景">
+ <xsl:call-template name="background"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:element>
+ <xsl:variable name="style-name">
+ <xsl:value-of select="@演:标识符"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:演示文稿/演:主体/演:幻灯片集/演:幻灯片[@演:标识符=$style-name]/演:切换">
+ <style:drawing-page-properties>
+ <xsl:if test="@演:速度='slow'">
+ <xsl:attribute name="presentation:transition-speed">slow</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@演:效果 = 'none')">
+ <xsl:variable name="effect">
+ <xsl:value-of select="@演:效果"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$effect='box in'">
+ <xsl:attribute name="smil:type">irisWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">rectangle</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='box out'">
+ <xsl:attribute name="smil:type">irisWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">rectangle</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='checkerboard across'">
+ <xsl:attribute name="smil:type">checkerBoardWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">across</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='checkerboard down'">
+ <xsl:attribute name="smil:type">checkerBoardWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">down</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='comb horizontal'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">combHorizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='comb vertical'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">combVertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTop</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover left'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover right'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover left-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover left-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover right-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopLeft</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='uncover right-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomLeft</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTop</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover left'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover right'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover left-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover left-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover right-down'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTopLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='cover right-up'">
+ <xsl:attribute name="smil:type">slideWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottomLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='fade through black'">
+ <xsl:attribute name="smil:type">fade</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fadeOverColor</xsl:attribute>
+ <xsl:attribute name="smil:fadeColor">#000000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push down'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromTop</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push left'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push right'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromLeft</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='push up'">
+ <xsl:attribute name="smil:type">pushWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fromBottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='random bars horizontal'">
+ <xsl:attribute name="smil:type">randomBarWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='random bars vertical'">
+ <xsl:attribute name="smil:type">randomBarWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='shape circle'">
+ <xsl:attribute name="smil:type">ellipseWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">circle</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='shape diamond'">
+ <xsl:attribute name="smil:type">irisWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">diamond</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='shape plus'">
+ <xsl:attribute name="smil:type">fourBoxWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">cornersOut</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split horizontal in'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split horizontal out'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split vertical in'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='split vertical out'">
+ <xsl:attribute name="smil:type">barnDoorWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wedge'">
+ <xsl:attribute name="smil:type">fanWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">centerTop</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 1 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">oneBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 2 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">twoBladeVertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 3 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">threeBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 4 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">fourBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wheel clockwise – 8 spoke'">
+ <xsl:attribute name="smil:type">pinWheelWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">eightBlade</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe left'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">leftToRight</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe right'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">leftToRight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe up'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">topToBottom</xsl:attribute>
+ <xsl:attribute name="smil:direction">reverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='wipe down'">
+ <xsl:attribute name="smil:type">barWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">topToBottom</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='blinds vertical'">
+ <xsl:attribute name="smil:type">blindsWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">vertical</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='blinds horizontal'">
+ <xsl:attribute name="smil:type">blindsWipe</xsl:attribute>
+ <xsl:attribute name="smil:subtype">horizontal</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='dissolve'">
+ <xsl:attribute name="smil:type">dissolve</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$effect='random transition'">
+ <xsl:attribute name="smil:type">random</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="演:方式/演:单击鼠标='false'">
+ <xsl:attribute name="presentation:transition-type">automatic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:方式/演:时间间隔">
+ <xsl:attribute name="presentation:duration"><xsl:value-of select="concat('PT00H00M',演:方式/演:时间间隔,'S')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(演:声音/@演:预定义声音 and not(演:声音/@演:预定义声音='none')) or 演:声音/@演:自定义声音">
+ <xsl:choose>
+ <xsl:when test="演:声音/@演:预定义声音">
+ <xsl:variable name="voice">
+ <xsl:value-of select="演:声音/@演:预定义声音"/>
+ </xsl:variable>
+ <presentation:sound xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">
+ <xsl:attribute name="xlink:href"><xsl:choose><xsl:when test="$voice='applause'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/applause.wav</xsl:when><xsl:when test="$voice='explosion'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/explos.wav</xsl:when><xsl:when test="$voice='laser'">../../../../../../../softwware/Redoffcie%203.0/share/gallery/sounds/laser.wav</xsl:when><xsl:otherwise><xsl:value-of select="演:声音/@演:预定义声音"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </presentation:sound>
+ </xsl:when>
+ <xsl:otherwise>
+ <presentation:sound xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="演:声音/@演:自定义声音"/></xsl:attribute>
+ </presentation:sound>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </style:drawing-page-properties>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="officestyle">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="图:渐变">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="图:渐变/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="图:渐变/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="图:渐变/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="图:渐变/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat(图:渐变/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat(图:渐变/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="图:渐变/@图:渐变方向 * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat(图:渐变/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="图:渐变/@图:种子X位置">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat(图:渐变/@图:种子X位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:渐变/@图:种子Y位置">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat(图:渐变/@图:种子Y位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="图:图片/@图:图形引用 or 图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:图案/@图:图形引用"><xsl:value-of select="图:图案/@图:类型"/></xsl:when><xsl:when test="图:图片/@图:图形引用"><xsl:value-of select="图:图片/@图:名称"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:图案/@图:图形引用">
+ <xsl:value-of select="图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:图片/@图:图形引用">
+ <xsl:value-of select="图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="background">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:图片/@图:名称"/></xsl:attribute>
+ <xsl:if test="not(图:图片/@图:位置='title')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:图案/@图:前景色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:颜色">
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:渐变">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:渐变/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="演:母版集">
+ <draw:layer-set>
+ <draw:layer draw:name="layout"/>
+ <draw:layer draw:name="background"/>
+ <draw:layer draw:name="backgroundobjects"/>
+ <draw:layer draw:name="controls"/>
+ <draw:layer draw:name="measurelines"/>
+ </draw:layer-set>
+ <xsl:apply-templates select="演:母版"/>
+ </xsl:template>
+ <xsl:template match="演:母版">
+ <xsl:choose>
+ <xsl:when test="@演:类型 = 'handout' ">
+ <xsl:element name="style:handout-master">
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@演:页面设置引用"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:配色方案引用"/></xsl:attribute>
+ <xsl:for-each select="uof:锚点[@uof:缩略图='true']">
+ <draw:page-thumbnail draw:layer="backgroundobjects">
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ </draw:page-thumbnail>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:锚点[not(@uof:缩略图='true')]"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@演:类型 = 'slide'">
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@演:页面设置引用"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:配色方案引用"/></xsl:attribute>
+ <xsl:apply-templates select="uof:锚点 "/>
+ <xsl:for-each select="/uof:UOF/uof:演示文稿/演:主体/演:母版集/演:母版">
+ <xsl:if test="@演:类型 = 'notes'">
+ <xsl:element name="presentation:notes">
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="@演:页面设置引用"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:配色方案引用"/></xsl:attribute>
+ <xsl:apply-templates select="uof:锚点 "/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:句式样">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@字:基式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="ancestor::字:段落式样">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="段落式样">
+ <xsl:element name="style:style">
+ <xsl:variable name="outline" select="@字:标识符"/>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]">presentation</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@字:基式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符=$outline]">
+ <style:graphic-properties draw:stroke="none" draw:fill="none">
+ <xsl:element name="text:list-style">
+ <xsl:call-template name="自动编号"/>
+ </xsl:element>
+ </style:graphic-properties>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="字:自动编号信息">
+ <xsl:attribute name="text:enable-numbering">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($outline,'title')">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="paragraph-properties"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="paragraph-properties">
+ <xsl:choose>
+ <xsl:when test="descendant::字:页边距[@uof:左]">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="number(((descendant::字:页边距/@uof:左)div 10) *1)"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="descendant::字:页边距[@uof:右]">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="number(((descendant::字:页边距/@uof:右)div 10) *1)"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:text-indent">0cm</xsl:attribute>
+ <xsl:call-template name="bidi"/>
+ </xsl:template>
+ <xsl:template name="bidi">
+ </xsl:template>
+ <xsl:template name="jibianhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:element name="text:list-level-style-number">
+ <xsl:variable name="currlevel" select="number(@字:级别值)"/>
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute>
+ <xsl:if test="字:起始编号">
+ <xsl:attribute name="text:start-value"><xsl:value-of select="字:起始编号"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:正规格式">
+ <xsl:attribute name="text:num-regular-exp"><xsl:value-of select="字:正规格式/@值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(字:编号格式表示) - string-length(translate(字:编号格式表示,'%','') )"/></xsl:attribute>
+ <xsl:if test="字:编号格式">
+ <xsl:call-template name="编号格式"/>
+ </xsl:if>
+ <xsl:if test="字:编号格式表示">
+ <xsl:attribute name="style:num-prefix"><xsl:choose><xsl:when test="number($currlevel) =1"><xsl:value-of select="substring-before(字:编号格式表示,concat('%',$currlevel))"/></xsl:when><xsl:otherwise><xsl:value-of select="substring-after(substring-after( substring-before(字:编号格式表示,concat('%',$currlevel)),concat('%',string(number($currlevel) -1))),'.')"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,concat('%',$currlevel))"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:list-level-properties">
+ <xsl:if test="@字:编号对齐方式">
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="@字:编号对齐方式"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="字:符号字体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="字:符号字体/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="字:符号字体">
+ <xsl:apply-templates select="*"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="xiangmufuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值)"/>
+ <xsl:element name="text:list-level-style-bullet">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute>
+ <xsl:attribute name="text:bullet-char"><xsl:value-of select="字:项目符号"/></xsl:attribute>
+ <xsl:element name="style:list-level-properties">
+ <xsl:if test="@字:编号对齐方式">
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="@字:编号对齐方式"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="字:符号字体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="字:符号字体/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样[@字:标识符=$Font-ID]">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="字:符号字体">
+ <xsl:apply-templates select="*"/>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="suojinleixing">
+ <xsl:if test="字:缩进/字:左/字:绝对/@字:值">
+ <xsl:attribute name="text:space-before"><xsl:value-of select="concat(number(字:缩进/字:左/字:绝对/@字:值),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:缩进/字:右/字:绝对/@字:值">
+ <xsl:attribute name="text:min-label-width"><xsl:value-of select="concat(number(字:缩进/字:右/字:绝对/@字:值),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:缩进/字:首行/字:绝对/@字:值">
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="concat(number(字:缩进/字:首行/字:绝对/@字:值),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="imagefuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值)"/>
+ <xsl:element name="text:list-level-style-image" style:vertical-pos="middle" style:vertical-rel="line" fo:width="0.265cm" fo:height="0.265cm">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute>
+ <xsl:if test="字:图片符号引用">
+ <xsl:variable name="gid">
+ <xsl:value-of select="字:图片符号引用"/>
+ </xsl:variable>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="style:list-level-properties">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+ <xsl:attribute name="fo:width"><xsl:value-of select="concat(字:图片符号引用/@字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:height"><xsl:value-of select="concat(字:图片符号引用/@字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="字:符号字体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="字:符号字体/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@字:编号对齐方式">
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="@字:编号对齐方式"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:for-each select="字:符号字体">
+ <xsl:apply-templates select="*"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="编号格式">
+ <xsl:attribute name="style:num-format"><xsl:choose><xsl:when test="string(字:编号格式)='lower-letter'">a</xsl:when><xsl:when test="string(字:编号格式)='upper-letter'">A</xsl:when><xsl:when test="string(字:编号格式)='lower-roman'">i</xsl:when><xsl:when test="string(字:编号格式)='upper-roman'">I</xsl:when><xsl:when test="string(字:编号格式)='decimal-enclosed-circle'">①, ②, ③, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-traditional'">甲, 乙, 丙, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-zodiac'">子, 丑, 寅, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-counting'">一, 二, 三, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-legal-simplified'">壹, 贰, 叁, ...</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="演:幻灯片集">
+ <xsl:for-each select="演:幻灯片">
+ <xsl:element name="draw:page">
+ <xsl:attribute name="draw:name"><xsl:value-of select="@演:名称"/></xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:master-page-name"><xsl:value-of select="@演:母版引用"/></xsl:attribute>
+ <xsl:if test="@演:页面版式引用">
+ <xsl:attribute name="presentation:presentation-page-layout-name"><xsl:value-of select="@演:页面版式引用"/></xsl:attribute>
+ </xsl:if>
+ <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+ <xsl:apply-templates select="uof:锚点"/>
+ <xsl:apply-templates select="演:动画"/>
+ <xsl:element name="presentation:notes">
+ <xsl:attribute name="draw:style-name">dp2</xsl:attribute>
+ <xsl:apply-templates select="./演:幻灯片备注/uof:锚点"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="演:动画">
+ <xsl:element name="anim:par">
+ <xsl:attribute name="presentation:node-type">timing-root</xsl:attribute>
+ <anim:seq presentation:node-type="main-sequence">
+ <xsl:for-each select="演:序列">
+ <anim:par begin="next">
+ <anim:par smil:begin="0s">
+ <xsl:variable name="animnodename">anim:par</xsl:variable>
+ <xsl:choose>
+ <xsl:when test="演:效果//演:其他">
+ <xsl:copy-of select="演:效果//演:其他/*"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="{$animnodename}">
+ <xsl:attribute name="smil:fill"><xsl:choose><xsl:when test="演:定时/@演:回卷='true'">remove</xsl:when><xsl:otherwise>hold</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="演:增强/演:动画播放后/@演:播放后隐藏='true'">
+ <xsl:attribute name="presentation:preset-property">Direction;Accelerate;Decelerate</xsl:attribute>
+ </xsl:when>
+ <xsl:when test=".//演:轮子">
+ <xsl:attribute name="presentation:preset-property">Spokes</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改填充颜色">
+ <xsl:attribute name="presentation:preset-property">FillColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改字体颜色">
+ <xsl:attribute name="presentation:preset-property">CharColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改字号">
+ <xsl:attribute name="presentation:preset-property">CharHeight</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改字形">
+ <xsl:attribute name="presentation:preset-property">CharDecoration</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:陀螺旋">
+ <xsl:attribute name="presentation:preset-property">Rotate;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:透明">
+ <xsl:attribute name="presentation:preset-property">Transparency</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:效果/演:强调/演:更改线条颜色">
+ <xsl:attribute name="presentation:preset-property">LineColor;ColorStyle;Accelerate;Decelerate;AutoReverse</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="presentation:node-type"><xsl:choose><xsl:when test="演:定时/@演:事件='on click'">on-click</xsl:when><xsl:otherwise><xsl:value-of select="演:定时/@演:事件"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="smil:begin"><xsl:value-of select="演:定时/@演:延时"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="演:定时/@演:重复='until next click' ">
+ <xsl:attribute name="smil:repeatCount">indefinite</xsl:attribute>
+ <xsl:attribute name="smil:end">next</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:定时/@演:重复='until next slide' ">
+ <xsl:attribute name="smil:repeatCount ">indefinite</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="演:定时/@演:重复 !='none'">
+ <xsl:attribute name="smil:repeatCount"><xsl:value-of select="演:定时/@演:重复"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="演:增强/演:动画文本/@演:发送">
+ <xsl:attribute name="anim:iterate-type"><xsl:choose><xsl:when test="演:增强/演:动画文本/@演:发送='by word'">by-word</xsl:when><xsl:when test="演:增强/演:动画文本/@演:发送='by letter'">by-letter</xsl:when><xsl:otherwise>all at once</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="演:增强/演:动画文本/@演:间隔">
+ <xsl:attribute name="anim:iterate-interval"><xsl:value-of select="演:增强/演:动画文本/@演:间隔"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$animnodename='anim:iterate' ">
+ <xsl:attribute name="anim:id"><xsl:value-of select="@演:动画对象"/></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="演:效果"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </anim:par>
+ </anim:par>
+ </xsl:for-each>
+ </anim:seq>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="演:效果">
+ <xsl:apply-templates select="演:进入 "/>
+ <xsl:apply-templates select="演:强调"/>
+ <xsl:apply-templates select="演:退出"/>
+ </xsl:template>
+ <xsl:template match="演:进入">
+ <xsl:attribute name="presentation:preset-class">entrance</xsl:attribute>
+ <xsl:apply-templates select="." mode="entrance"/>
+ </xsl:template>
+ <xsl:template match="演:强调">
+ <xsl:attribute name="presentation:preset-class">emphasis</xsl:attribute>
+ <xsl:apply-templates select="." mode="emphasis"/>
+ </xsl:template>
+ <xsl:template match="演:退出">
+ <xsl:attribute name="presentation:preset-class">exit</xsl:attribute>
+ <xsl:apply-templates select="." mode="exit"/>
+ </xsl:template>
+ <xsl:template name="演速度">
+ <xsl:choose>
+ <xsl:when test="./@演:速度='very fast' ">0.5s</xsl:when>
+ <xsl:when test="./@演:速度='fast'">1s</xsl:when>
+ <xsl:when test="./@演:速度='medium'">2s</xsl:when>
+ <xsl:when test="./@演:速度='slow'">3s</xsl:when>
+ <xsl:when test="./@演:速度='very slow'">5s</xsl:when>
+ <xsl:otherwise>1s</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="演:出现" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-appear</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" anim:sub-item="text" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:盒状" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-box</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:棋盘" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-checkerboard</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='down'">downward</xsl:when><xsl:when test="@演:方向='across'">across</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:dur="2s" anim:sub-item="text" smil:type="checkerBoardWipe" smil:subtype="down">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:圆形扩展" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-circle</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:阶梯状" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-diagonal-squares</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='left down'">left-to-bottom</xsl:when><xsl:when test="@演:方向='left up'">left-to-top</xsl:when><xsl:when test="@演:方向='right down'">right-to-bottom</xsl:when><xsl:when test="@演:方向='right up'">right-to-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="waterfallWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向='left down'">horizontalLeft</xsl:when><xsl:when test="@演:方向='left up'">horizontalLeft</xsl:when><xsl:when test="@演:方向='right down'">horizontalRight</xsl:when><xsl:when test="@演:方向='right up'">horizontalRight</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:菱形" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-diamond</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:内向溶解" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-dissolve-in</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="dissolve" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:闪烁一次" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-flash-once</xsl:attribute>
+ <anim:set smil:begin="0s" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:飞入" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-fly-in</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from top-right'">from-top-right</xsl:when><xsl:when test="@演:方向 = 'from top-left'">from-top-left</xsl:when><xsl:when test="@演:方向 = 'from bottom-left'">from-bottom-left</xsl:when><xsl:when test="@演:方向 = 'from bottom-right'">from-bottom-right</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'right')">1+width/2;x</xsl:when>
+ <xsl:when test="contains(@演:方向,'left')">0-width/2;x</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'bottom')">1+height/2;y</xsl:when>
+ <xsl:when test="contains(@演:方向,'top')">0-height/2;y</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ </xsl:template>
+ <xsl:template match="演:缓慢飞入" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-fly-in-slow</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'right')">1+width/2;x</xsl:when>
+ <xsl:when test="contains(@演:方向,'left')">0-width/2;x</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'bottom')">1+height/2;y</xsl:when>
+ <xsl:when test="contains(@演:方向,'top')">0-height/2;y</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ </xsl:template>
+ <xsl:template match="演:切入" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-peek-in</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="slideWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">fromBottom</xsl:when><xsl:when test="@演:方向 = 'from right'">fromRight</xsl:when><xsl:when test="@演:方向 = 'from left'">fromLeft</xsl:when><xsl:when test="@演:方向 = 'from top'">fromTop</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:十字形扩展" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-plus</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="fourBoxWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'in'">cornersIn</xsl:when><xsl:when test="@演:方向 = 'out'">cornersOut</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:随机线条" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-bars</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="randomBarWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:劈裂" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-split</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal-out</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal-in</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical-in</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical-out</xsl:when></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="barnDoorWipe">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:百叶窗" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-venetian-blinds</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="blindsWipe" smil:direction="reverse">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:扇形展开" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-wedge</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.0015s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:轮子" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-wheel</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:辐射状"/></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="pinWheelWipe">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:辐射状='1'">oneBlade</xsl:when><xsl:when test="@演:辐射状='2'">twoBlade</xsl:when><xsl:when test="@演:辐射状='3'">threeBlade</xsl:when><xsl:when test="@演:辐射状='4'">fourBlade</xsl:when><xsl:when test="@演:辐射状='8'">eightBlade</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:擦除" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-wipe</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:速度 = 'from right'">from-right</xsl:when><xsl:when test="@演:速度 = 'from left'">from-left</xsl:when><xsl:when test="@演:速度 = 'from top'">from-top</xsl:when><xsl:when test="@演:速度 = 'from bottom'">from-bottom</xsl:when><xsl:otherwise>from-left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.006s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="(@演:速度 = 'from right') or (@演:速度 = 'from left')">leftToRight</xsl:when><xsl:when test="(@演:速度 = 'from top') or (@演:速度 = 'from bottom')">topToBottom</xsl:when><xsl:otherwise>leftToRight</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="演:随机效果" mode="entrance">
+ <xsl:attribute name="presentation:preset-id">ooo-entrance-random</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ <anim:animate smil:dur="1s" smil:fill="hold" smil:attributeName="width" smil:values="0;width" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="height" smil:values="0;height" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="rotate" smil:values="90;0" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:animate>
+ <anim:transitionFilter smil:type="fade" smil:subtype="crossfade">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:transitionFilter>
+ </xsl:template>
+ <xsl:template match="更改填充颜色" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-fill-color</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateColor smil:fill="hold" smil:attributeName="fill-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute>
+ </anim:animateColor>
+ <anim:set smil:dur="0.5s" smil:fill="hold" smil:attributeName="fill" smil:to="solid">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="更改字体颜色" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-color</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateColor smil:fill="hold" smil:attributeName="fill-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute>
+ </anim:animateColor>
+ </xsl:template>
+ <xsl:template match="演:更改字号" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-size</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animate smil:fill="hold" smil:attributeName="font-size" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义尺寸='tiny' ">0.25,1</xsl:when><xsl:when test="@演:预定义尺寸='smaller' ">0.5,1</xsl:when><xsl:when test="@演:预定义尺寸='larger' ">1.5,1</xsl:when><xsl:when test="@演:预定义尺寸='huge' ">4,1</xsl:when><xsl:when test="@演:自定义尺寸"><xsl:value-of select="@演:自定义尺寸"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:animate>
+ </xsl:template>
+ <xsl:template name="emp_font_style">
+ <xsl:param name="fontstyle"/>
+ <xsl:choose>
+ <xsl:when test="contains($fontstyle,' ')">
+ <anim:set smil:dur="indefinite" smil:attributeName="font-style">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="substring-before($fontstyle,' ')"/></xsl:attribute>
+ </anim:set>
+ <xsl:variable name="fontstyle1">
+ <xsl:choose>
+ <xsl:when test="contains($fontstyle,' ')">
+ <xsl:value-of select="substring-after($fontstyle,' ')"/>
+ </xsl:when>
+ <xsl:when test="not($fontstyle=' ')">
+ <xsl:value-of select="$fontstyle"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="emp_font_style">
+ <xsl:with-param name="fontstyle">
+ <xsl:value-of select="$fontstyle1"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="演:更改字形" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-font-style</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">1</xsl:attribute>
+ <xsl:call-template name="emp_font_style">
+ <xsl:with-param name="fontstyle">
+ <xsl:value-of select="@演:字形"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template match="演:更改线条颜色" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-line-color</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateColor smil:dur="0s" smil:fill="hold" smil:attributeName="stroke-color" presentation:additive="base" anim:color-interpolation="rgb" anim:color-interpolation-direction="clockwise">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:value-of select="@演:颜色"/></xsl:attribute>
+ </anim:animateColor>
+ <anim:set smil:dur="0s" smil:fill="hold" anim:sub-item="text" smil:attributeName="stroke" smil:to="solid">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:陀螺旋" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-spin</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type">2</xsl:attribute>
+ <anim:animateTransform smil:fill="hold" smil:by="180" presentation:additive="base" svg:type="rotate">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:by"><xsl:choose><xsl:when test="@演:预定义角度='quarter spin'">90</xsl:when><xsl:when test="@演:预定义角度='half spin'">180</xsl:when><xsl:when test="@演:预定义角度='full spin'">360</xsl:when><xsl:when test="@演:预定义角度='two spins'">720 </xsl:when><xsl:when test="@演:自定义角度"><xsl:value-of select="@演:自定义角度"/></xsl:when></xsl:choose></xsl:attribute>
+ </anim:animateTransform>
+ </xsl:template>
+ <xsl:template match="演:透明" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-transparency</xsl:attribute>
+ <xsl:attribute name="smil:repeatCount"><xsl:choose><xsl:when test="(@演:期间 = 'until next click') or (@演:期间 ='until next slide') ">indefinite</xsl:when><xsl:when test="@演:期间='2' or @演:期间 ='3' or @演:期间 ='4' or @演:期间 ='5' or @演:期间 ='10'"><xsl:value-of select="@演:期间"/></xsl:when><xsl:otherwise>2</xsl:otherwise></xsl:choose></xsl:attribute>
+ <anim:set smil:dur="indefinite" anim:sub-item="text" smil:attributeName="opacity">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义透明度='25' ">0.25</xsl:when><xsl:when test="@演:预定义透明度='50' ">0.5</xsl:when><xsl:when test="@演:预定义透明度='75' ">0.75</xsl:when><xsl:when test="@演:预定义透明度='100' ">1</xsl:when><xsl:when test="@演:自定义透明度"><xsl:value-of select="@演:自定义透明度"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:缩放" mode="emphasis">
+ <xsl:attribute name="presentation:preset-id">ooo-emphasis-grow-and-shrink</xsl:attribute>
+ <anim:animateTransform smil:fill="hold" anim:sub-item="text" presentation:additive="base" svg:type="scale">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:to"><xsl:choose><xsl:when test="@演:预定义尺寸='tiny' ">0.25,1</xsl:when><xsl:when test="@演:预定义尺寸='smaller' ">0.5,1</xsl:when><xsl:when test="@演:预定义尺寸='larger' ">1.5,1</xsl:when><xsl:when test="@演:预定义尺寸='huge' ">4,1</xsl:when><xsl:when test="@演:自定义尺寸"><xsl:value-of select="@演:自定义尺寸"/></xsl:when><xsl:otherwise>0.5,1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:animateTransform>
+ </xsl:template>
+ <xsl:template match="演:盒状" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-box</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="rectangle" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:棋盘" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-checkerboard</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='down'">downward</xsl:when><xsl:when test="@演:方向='across'">across</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:dur="2s" anim:sub-item="text" smil:type="checkerBoardWipe" smil:subtype="down" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.004s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:圆形扩展" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-circle</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:transitionFilter smil:type="ellipseWipe" smil:subtype="horizontal" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:阶梯状" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-diagonal-squares</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向='left down'">left-to-bottom</xsl:when><xsl:when test="@演:方向='left up'">left-to-top</xsl:when><xsl:when test="@演:方向='right down'">right-to-bottom</xsl:when><xsl:when test="@演:方向='right up'">right-to-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:type="waterfallWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向='left down'">horizontalLeft</xsl:when><xsl:when test="@演:方向='left up'">horizontalLeft</xsl:when><xsl:when test="@演:方向='right down'">horizontalRight</xsl:when><xsl:when test="@演:方向='right up'">horizontalRight</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:菱形" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-diamond</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:transitionFilter smil:type="irisWipe" smil:subtype="diamond" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:消失" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-disappear</xsl:attribute>
+ <anim:set smil:begin="0s" smil:dur="0.001s" smil:fill="hold" anim:sub-item="text" smil:attributeName="visibility" smil:to="visible">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:向外溶解" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-dissolve</xsl:attribute>
+ <anim:transitionFilter smil:type="dissolve" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:闪烁一次" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-flash-once</xsl:attribute>
+ <anim:animate smil:attributeName="visibility" smil:values="hidden;visible" smil:keyTimes="0;0.5" smil:calcMode="discrete" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0s" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:飞出" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-fly-out</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'to bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'to top-right'">from-top-right</xsl:when><xsl:when test="@演:方向 = 'to top-left'">from-top-left</xsl:when><xsl:when test="@演:方向 = 'to bottom-left'">from-bottom-left</xsl:when><xsl:when test="@演:方向 = 'to bottom-right'">from-bottom-right</xsl:when><xsl:when test="@演:方向 = 'to right'">from-right</xsl:when><xsl:when test="@演:方向 = 'to left'">from-left</xsl:when><xsl:when test="@演:方向 = 'to top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'right')">x;1+width/2</xsl:when>
+ <xsl:when test="contains(@演:方向,'left')">x;0-width/2</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'bottom')">y;1+height/2</xsl:when>
+ <xsl:when test="contains(@演:方向,'top')">y;0-height/2</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:缓慢移出" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-crawl-out</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'to bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'to right'">from-right</xsl:when><xsl:when test="@演:方向 = 'to left'">from-left</xsl:when><xsl:when test="@演:方向 = 'to top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="smilvalueX">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'right')">x;1+width/2</xsl:when>
+ <xsl:when test="contains(@演:方向,'left')">x;0-width/2</xsl:when>
+ <xsl:otherwise>x;x</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="smilvalueY">
+ <xsl:choose>
+ <xsl:when test="contains(@演:方向,'bottom')">y;1+height/2</xsl:when>
+ <xsl:when test="contains(@演:方向,'top')">y;0-height/2</xsl:when>
+ <xsl:otherwise>y;y</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <anim:animate smil:fill="hold" smil:attributeName="x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueX"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:fill="hold" smil:attributeName="y" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:values"><xsl:value-of select="$smilvalueY"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:切出" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-peek-out</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">from-bottom</xsl:when><xsl:when test="@演:方向 = 'from right'">from-right</xsl:when><xsl:when test="@演:方向 = 'from left'">from-left</xsl:when><xsl:when test="@演:方向 = 'from top'">from-top</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:type="slideWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'from bottom'">fromBottom</xsl:when><xsl:when test="@演:方向 = 'from right'">fromRight</xsl:when><xsl:when test="@演:方向 = 'from left'">fromLeft</xsl:when><xsl:when test="@演:方向 = 'from top'">fromTop</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0005s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:十字形扩展" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-plus</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:transitionFilter smil:type="fourBoxWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'in'">cornersIn</xsl:when><xsl:when test="@演:方向 = 'out'">cornersOut</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:随机线条" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-random-bars</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:transitionFilter smil:type="randomBarWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:劈裂" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-split</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal-out</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal-in</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical-in</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical-out</xsl:when></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="barnDoorWipe" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向 = 'horizontal out'">horizontal</xsl:when><xsl:when test="@演:方向= 'horizontal in'">horizontal</xsl:when><xsl:when test="@演:方向= 'vertical in'">vertical</xsl:when><xsl:when test="@演:方向= 'vertical out'">vertical</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:百叶窗" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-venetian-blinds</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:方向"/></xsl:attribute>
+ <anim:transitionFilter smil:type="blindsWipe" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:方向= 'horizontal'">vertical</xsl:when><xsl:when test="@演:方向 = 'vertical'">horizontal</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:扇形展开" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-wedge</xsl:attribute>
+ <anim:transitionFilter smil:type="fanWipe" smil:subtype="centerTop" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.0015s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:轮子" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-wheel</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:value-of select="@演:辐射状"/></xsl:attribute>
+ <anim:transitionFilter smil:dur="0.5s" smil:type="pinWheelWipe" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="@演:辐射状='1'">oneBlade</xsl:when><xsl:when test="@演:辐射状='2'">twoBlade</xsl:when><xsl:when test="@演:辐射状='3'">threeBlade</xsl:when><xsl:when test="@演:辐射状='4'">fourBlade</xsl:when><xsl:when test="@演:辐射状='8'">eightBlade</xsl:when></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.00025s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:擦除" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-wipe</xsl:attribute>
+ <xsl:attribute name="presentation:preset-sub-type"><xsl:choose><xsl:when test="@演:速度 = 'from right'">from-right</xsl:when><xsl:when test="@演:速度 = 'from left'">from-left</xsl:when><xsl:when test="@演:速度 = 'from top'">from-top</xsl:when><xsl:when test="@演:速度 = 'from bottom'">from-bottom</xsl:when><xsl:otherwise>from-left</xsl:otherwise></xsl:choose></xsl:attribute>
+ <anim:transitionFilter smil:type="barWipe" smil:subtype="leftToRight" smil:direction="reverse" smil:mode="out">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:subtype"><xsl:choose><xsl:when test="(@演:速度 = 'from right') or (@演:速度 = 'from left')">leftToRight</xsl:when><xsl:when test="(@演:速度 = 'from top') or (@演:速度 = 'from bottom')">topToBottom</xsl:when><xsl:otherwise>leftToRight</xsl:otherwise></xsl:choose></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:set smil:dur="0.006s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="演:随机效果" mode="exit">
+ <xsl:attribute name="presentation:preset-id">ooo-exit-random</xsl:attribute>
+ <anim:transitionFilter smil:type="fade" smil:subtype="crossfade" smil:mode="out">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:transitionFilter>
+ <anim:animate smil:attributeName="x" smil:values="x;x" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:dur"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:dur="0.1s" smil:decelerate="1" smil:attributeName="y" smil:values="y;y-.03" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:animate smil:begin="0.1s" smil:dur="0.9s" smil:accelerate="1" smil:attributeName="y" smil:values="y;y+1" smil:keyTimes="0;1" presentation:additive="base">
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:animate>
+ <anim:set smil:dur="0.001s" smil:fill="hold" smil:attributeName="visibility" smil:to="hidden">
+ <xsl:attribute name="smil:begin"><xsl:call-template name="演速度"/></xsl:attribute>
+ <xsl:attribute name="smil:targetElement"><xsl:value-of select="ancestor::演:序列/@演:动画对象"/></xsl:attribute>
+ </anim:set>
+ </xsl:template>
+ <xsl:template match="uof:锚点" name="图形解析">
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::uof:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:attribute name="presentation:class">graphic</xsl:attribute>
+ <xsl:attribute name="presentation:user-transformed">true</xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer">layout</xsl:attribute>
+ <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing1">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ </xsl:if>
+ <draw:image>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据">
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"/>
+ </office:binary-data>
+ </xsl:if>
+ </draw:image>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"/>
+ <xsl:with-param name="groupx" select="0"/>
+ <xsl:with-param name="groupy" select="0"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="graph">
+ <xsl:param name="id"/>
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:for-each select="$id">
+ <xsl:variable name="tuxing1">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$tuxing1='11'">
+ <xsl:call-template name="Rectangle">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='19'">
+ <xsl:call-template name="Oval">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='61'">
+ <xsl:call-template name="Line">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='64'">
+ <xsl:call-template name="Curve">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='65'">
+ <xsl:call-template name="Freeform">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='66'">
+ <xsl:call-template name="Scribble">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='3'">
+ <xsl:call-template name="演文本框"/>
+ </xsl:when>
+ <xsl:when test="$tuxing1='67'">
+ <xsl:call-template name="演缩略图"/>
+ </xsl:when>
+ <xsl:when test="$tuxing1='4'">
+ <xsl:element name="draw:g">
+ <xsl:variable name="tu">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tu"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:variable name="this-group-x">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:x坐标"/>
+ </xsl:variable>
+ <xsl:variable name="this-group-y">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/uof:y坐标"/>
+ </xsl:variable>
+ <xsl:variable name="group-x">
+ <xsl:value-of select="number($groupx + $this-group-x)"/>
+ </xsl:variable>
+ <xsl:variable name="group-y">
+ <xsl:value-of select="number($groupy + $this-group-y)"/>
+ </xsl:variable>
+ <xsl:call-template name="组合图形">
+ <xsl:with-param name="zuheliebiao" select="@图:组合列表"/>
+ <xsl:with-param name="groupx1" select="$group-x"/>
+ <xsl:with-param name="groupy1" select="$group-y"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="common">
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:variable name="tuxing">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer"><xsl:choose><xsl:when test="parent::演:母版">backgroundobjects</xsl:when><xsl:otherwise>layout</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组合位置/@图:x坐标"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组合位置/@图:y坐标"/>
+ </xsl:variable>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(($groupx + $zuheweizhi-x),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(($groupy + $zuheweizhi-y),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(图:预定义图形 /图:属性/图:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(图:预定义图形/图:属性 /图:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer">layout</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="组合图形">
+ <xsl:param name="zuheliebiao"/>
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:variable name="x">
+ <xsl:value-of select="$groupx1"/>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:value-of select="$groupy1"/>
+ </xsl:variable>
+ <xsl:variable name="first-pictures">
+ <xsl:value-of select="substring-before($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:variable name="other-pictures">
+ <xsl:value-of select="substring-after($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-pictures,',')">
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="组合图形">
+ <xsl:with-param name="zuheliebiao" select="$other-pictures"/>
+ <xsl:with-param name="groupx1" select="$x"/>
+ <xsl:with-param name="groupy1" select="$y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $other-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Curve">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:path">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点坐标/@图:路径"/></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Freeform">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polygon">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Scribble">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polyline">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="drawpoints">
+ <xsl:param name="points"/>
+ <xsl:param name="value"/>
+ <xsl:variable name="frist-piont">
+ <xsl:value-of select="substring-before($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:variable name="other-points">
+ <xsl:value-of select="substring-after($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-points,'lineto')">
+ <xsl:variable name="x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="all-points">
+ <xsl:value-of select="concat($value,$x-coor,',',$y-coor,' ')"/>
+ </xsl:variable>
+ <xsl:call-template name="drawpoints">
+ <xsl:with-param name="points" select="$other-points"/>
+ <xsl:with-param name="value" select="$all-points"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="q-x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="q-y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-x-coor">
+ <xsl:value-of select="substring-before($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-y-coor">
+ <xsl:value-of select="substring-after($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($value,$q-x-coor,',',$q-y-coor,' ',$e-x-coor,',',$e-y-coor)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Oval">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:ellipse">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Rectangle">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:rect">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Line">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:line">
+ <xsl:variable name="tuxing1" select="@图:标识符"/>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:attribute name="svg:x1"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat((@uof:x坐标 + @uof:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat((@uof:y坐标 + @uof:高度),$uofUnit)"/></xsl:attribute>
+ <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing1">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组合位置/@图:x坐标"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组合位置/@图:y坐标"/>
+ </xsl:variable>
+ <xsl:variable name="hex">
+ <xsl:value-of select="concat(number($groupx1 + $zuheweizhi-x),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="hey">
+ <xsl:value-of select="concat(number($groupy1 + $zuheweizhi-y),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:attribute name="svg:x1"><xsl:value-of select="$hex"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="$hey"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat(($hex + 图:预定义图形/图:属性/图:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat(($hey + 图:预定义图形/图:属性/图:高度),$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="演文本框">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="draw:layer"><xsl:choose><xsl:when test="parent::演:母版">backgroundobjects</xsl:when><xsl:otherwise>layout</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:类别 = '3' and (parent::演:幻灯片/@演:配色方案引用) and not(@uof:占位符 = 'graphic')">
+ <xsl:attribute name="presentation:style-name"><xsl:value-of select="parent::演:幻灯片/@演:配色方案引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="../演:动画/演:序列/@演:动画对象=$tuxing1">
+ <xsl:attribute name="draw:id"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(@uof:占位符 = 'graphic')">
+ <xsl:attribute name="presentation:style-name"><xsl:value-of select="@uof:图形引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="placeholdType">
+ <xsl:value-of select="@uof:占位符"/>
+ </xsl:variable>
+ <xsl:if test="@uof:占位符">
+ <xsl:attribute name="presentation:class"><xsl:choose><xsl:when test="@uof:占位符 = 'clipart'">graphic</xsl:when><xsl:when test="@uof:占位符 = 'media_clip'">graphic</xsl:when><xsl:when test="@uof:占位符 = 'graphics'">graphic</xsl:when><xsl:when test="@uof:占位符 = 'number'">page_number</xsl:when><xsl:when test="@uof:占位符 = 'centertitle'">title</xsl:when><xsl:when test="@uof:占位符 = 'date'">date-time</xsl:when><xsl:when test="@uof:占位符 = 'vertical_text'">vertical_outline</xsl:when><xsl:when test="@uof:占位符 = 'vertical_subtitle'">vertical_outline</xsl:when><xsl:otherwise><xsl:value-of select="@uof:占位符"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:variable name="leibie">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:variable>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="图:文本内容 or @图:其他对象">
+ <xsl:attribute name="presentation:user-transformed">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="presentation:placeholder">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$placeholdType = 'graphic' or $placeholdType = 'clipart' or $placeholdType ='media_clip'">
+ <draw:image/>
+ </xsl:when>
+ <xsl:when test="$placeholdType = 'table' or $placeholdType = 'chart' or $placeholdType ='object'">
+ <draw:object/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="演缩略图">
+ <draw:page-thumbnail>
+ <xsl:call-template name="common"/>
+ <xsl:attribute name="draw:layer">layout</xsl:attribute>
+ <xsl:attribute name="draw:page-number"><xsl:for-each select="../.."><xsl:value-of select="count(preceding-sibling::演:幻灯片) + 1"/></xsl:for-each></xsl:attribute>
+ <xsl:attribute name="presentation:class">page</xsl:attribute>
+ </draw:page-thumbnail>
+ </xsl:template>
+ <xsl:template match="演:页面版式">
+ <xsl:element name="style:presentation-page-layout">
+ <xsl:attribute name="style:name"><xsl:value-of select="@演:标识符"/></xsl:attribute>
+ <xsl:apply-templates select="演:占位符" mode="layout"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="演:占位符" mode="layout">
+ <presentation:placeholder>
+ <xsl:attribute name="presentation:object"><xsl:choose><xsl:when test="@演:类型='vertical_text'">vertical_outline</xsl:when><xsl:when test="@演:类型='date'">date-time</xsl:when><xsl:when test="@演:类型='number'">page_number</xsl:when><xsl:otherwise><xsl:value-of select="@演:类型"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(uof:锚点/@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(uof:锚点/@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(uof:锚点/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(uof:锚点/@uof:高度,$uofUnit)"/></xsl:attribute>
+ </presentation:placeholder>
+ </xsl:template>
+ <xsl:template match="字:段落">
+ <xsl:choose>
+ <xsl:when test="字:段落属性/字:自动编号信息">
+ <xsl:call-template name="编号解析"/>
+ </xsl:when>
+ <xsl:when test="字:句/字:分页符">
+ <xsl:call-template name="processPageBreaks"/>
+ </xsl:when>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0107'">
+ <xsl:call-template name="jiaozhu"/>
+ </xsl:when>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0108'">
+ <xsl:call-template name="weizhu"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="jiaozhu">
+ <xsl:element name="text:footnote">
+ <xsl:element name="text:footnote-body">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="weizhu">
+ <xsl:element name="text:endnote">
+ <xsl:element name="text:endnote-body">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="processPageBreaks">
+ <xsl:variable name="pageBreak" select="字:句/字:分页符"/>
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="$pageBreak[1]/preceding-sibling::字:句"/>
+ <xsl:with-param name="pageBreak"/>
+ <xsl:with-param name="needsPageBreak">false</xsl:with-param>
+ </xsl:call-template>
+ <xsl:for-each select="$pageBreak">
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="./following-sibling::字:句[preceding::字:句/字:分页符 = '.']"/>
+ <xsl:with-param name="pageBreak" select="."/>
+ <xsl:with-param name="needsPageBreak">true</xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="createSubParagraph">
+ <xsl:param name="list"/>
+ <xsl:param name="pageBreak"/>
+ <xsl:param name="needsPageBreak"/>
+ <xsl:if test="(count($list) &gt; 0) or ($needsPageBreak ='true') ">
+ <xsl:element name="text:p">
+ <xsl:choose>
+ <xsl:when test="$needsPageBreak = 'true'">
+ <xsl:choose>
+ <xsl:when test="ancestor::字:段落/字:段落属性">
+ <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:演示文稿/演:主体" level="any" count="字:段落属性"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">PageBreak</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="$pageBreak">
+ <xsl:apply-templates select="$pageBreak"/>
+ </xsl:if>
+ <xsl:apply-templates select="$list"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:区域开始[@字:类型='bookmark']">
+ <text:bookmark-start text:name="{@字:标识符}"/>
+ </xsl:template>
+ <xsl:template match="字:区域结束[preceding::字:区域开始[1]/@字:类型='bookmark']">
+ <text:bookmark-end text:name="{@字:标识符引用}"/>
+ </xsl:template>
+ <xsl:template match="字:段落/字:域开始">
+ <xsl:choose>
+ <xsl:when test="@字:类型='CREATEDATE'">
+ <xsl:variable name="datestr" select="../字:句/字:文本串"/>
+ <xsl:element name="text:date">
+ <xsl:attribute name="style:data-style-name">Time<xsl:number from="/uof:UOF/uof:演示文稿/演:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'CREATEDATE']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="concat(substring-before($datestr,' '),'T',substring-after($datestr,' '))"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="commonParagraph">
+ <xsl:element name="text:p">
+ <xsl:if test="@字:动画标识">
+ <xsl:attribute name="text:id"><xsl:value-of select="@字:动画标识"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="commonParagraphAttributes"/>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="commonParagraphAttributes">
+ <xsl:choose>
+ <xsl:when test="字:段落属性">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="字:段落属性/@字:式样引用"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="generate-id(ancestor::字:主体/descendant::字:段落[1]) = generate-id(.)">
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not(字:段落属性) and (descendant::字:分栏符 or ancestor::字:分节/descendant::字:节属性[字:分栏/@字:栏数 &gt; 1])">
+ <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:句">
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:段落属性"/>
+ <xsl:template match="字:句/字:句属性"/>
+ <xsl:template match="字:句属性" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:对象集" level="any" count="字:句属性" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="@字:式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="./*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:句/字:文本串">
+ <xsl:choose>
+ <xsl:when test="string(.) = ' ' ">
+ <xsl:element name="text:s"/>
+ </xsl:when>
+ <xsl:when test="contains(.,' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="replace-spaces">
+ <xsl:param name="curr-string"/>
+ <xsl:if test="contains($curr-string,' ')">
+ <xsl:value-of select="substring-before($curr-string,' ')"/>
+ <text:s text:c="2"/>
+ <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-string, ' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="$next-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next-string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:句">
+ <xsl:if test="name(following-sibling::*[1])!='字:域结束'">
+ <xsl:if test="字:换行符">
+ <xsl:element name="text:line-break"/>
+ </xsl:if>
+ <xsl:variable name="currently-node" select="./字:锚点"/>
+ <xsl:choose>
+ <xsl:when test="字:句属性//字:隐藏文字/@字:值='true'">
+ <text:hidden-text text:is-hidden="true" text:string-value="{.}"/>
+ </xsl:when>
+ <xsl:when test="字:区域开始[@字:类型='hyperlink']">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:variable name="hyperDest" select="字:区域开始/@字:标识符"/>
+ <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链源=$hyperDest"><xsl:if test="@uof:目标"><xsl:value-of select="@uof:目标"/></xsl:if><xsl:if test="@uof:书签"><xsl:variable name="bookmarkDest" select="@uof:书签"/><xsl:for-each select="/uof:UOF/uof:书签集/uof:书签"><xsl:if test="@uof:名称=$bookmarkDest"><xsl:value-of select="concat('#',uof:文本位置/@字:区域引用)"/></xsl:if></xsl:for-each></xsl:if></xsl:if></xsl:for-each></xsl:attribute>
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="(preceding-sibling::字:句) or (字:句属性)or(字:区域开始)">
+ <xsl:element name="text:span">
+ <xsl:choose>
+ <xsl:when test="字:区域开始[@字:类型='annotation']">
+ <xsl:variable name="ref_comment">
+ <xsl:value-of select="字:区域开始/@字:标识符"/>
+ </xsl:variable>
+ <xsl:apply-templates/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:公用处理规则/字:批注集/字:批注[@字:区域引用 = $ref_comment]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="字:句属性/@字:式样引用"/></xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="node()[name() = '字:位置']">
+ <xsl:variable name="height">100% </xsl:variable>
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="parent::字:句属性//字:位置">
+ <xsl:value-of select="concat( parent::字:句属性//字:位置, '%')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:text-position"><xsl:value-of select="concat(concat( $position, ' '), $height)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:字体">
+ <xsl:if test="@字:字号">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:相对字号 and self::node( )[not(parent::字:句属性)]">
+ <xsl:variable name="stylename" select="parent::node()/@字:基式样引用"/>
+ <xsl:variable name="zihao">
+ <xsl:for-each select="/uof:UOF/uof:式样集//uof:段落式样[@字:标识符=$stylename]">
+ <xsl:value-of select="字:字体/@字:字号"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="font-size" select="@字:相对字号"/>
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:中文字体引用">
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:西文字体引用">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="@字:西文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:斜体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:粗体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="fo:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:下划线">
+ <xsl:choose>
+ <xsl:when test="@字:字下划线 = 'true'">
+ <xsl:attribute name="style:text-underline">single</xsl:attribute>
+ <xsl:attribute name=" style:text-underline-color">font-color</xsl:attribute>
+ <xsl:attribute name="fo:score-spaces">false</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'thick'">
+ <xsl:attribute name="style:text-underline">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dotted</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dashed-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long'">
+ <xsl:attribute name="style:text-underline">long-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline">bold-long-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'">
+ <xsl:attribute name="style:text-underline">bold-dot-dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-heavy'">
+ <xsl:attribute name="style:text-underline">bold-wave</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-double'">
+ <xsl:attribute name="style:text-underline">double-wave</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline"><xsl:value-of select="@字:类型"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@字:颜色 and not(@字:颜色 = 'auto')">
+ <xsl:attribute name="style:text-underline-color"><xsl:value-of select="concat( '#', @字:颜色)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:阴影">
+ <xsl:attribute name="style:text-shadow">1pt 1pt</xsl:attribute>
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:删除线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single' ">
+ <xsl:attribute name="style:text-crossing-out">single-line</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字类型 = 'double'">
+ <xsl:attribute name="style:text-crossing-out">double-line</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:突出显示">
+ <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute>
+ <xsl:attribute name="fo:text-background-color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="@字:颜色[not(.='auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:浮雕">
+ <xsl:attribute name="style:font-relief">embossed</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:外框">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="@字:字号"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:字符间距[parent::字:句属性]">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( floor(number(字:字符间距 div 1440) * 2540) div 1000, 'cm')"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="uof:字体集">
+ <xsl:if test="not(uof:字体声明[@uof:名称='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="uof:字体声明">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:字体族"/></xsl:attribute>
+ <xsl:if test="@uof:字符集 = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:字体族">
+ <xsl:choose>
+ <xsl:when test="@uof:字体族 = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:font-pitch">12</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:字体声明"/>
+ </xsl:template>
+ <xsl:template match="uof:元数据">
+ <office:meta>
+ <meta:generator>UOFText 2004</meta:generator>
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ <dc:description>
+ <xsl:value-of select="uof:摘要"/>
+ </dc:description>
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ <meta:initial-creator>
+ <xsl:value-of select="uof:作者"/>
+ </meta:initial-creator>
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( uof:创建日期, 'Z')"/>
+ </meta:creation-date>
+ <dc:creator>
+ <xsl:value-of select="uof:最后作者"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="substring-before( uof:编辑时间, 'Z')"/>
+ </dc:date>
+ <meta:printed-by/>
+ <meta:print-date/>
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ </meta:keywords>
+ <dc:language/>
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ <meta:editing-duration>
+ <xsl:if test="uof:编辑时间">
+ <xsl:value-of select="concat('PT', floor(uof:编辑时间 div 60), 'H', uof:编辑时间 mod 60, 'M0S')"/>
+ </xsl:if>
+ </meta:editing-duration>
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:经理名称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:公司名称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="uof:创建应用程序"/>
+ </meta:user-defined>
+ <xsl:if test="uof:文档模板|child::*[@uof:locID='u0013']">
+ <meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:href="{child::*[@uof:locID='u0013']}"/>
+ </xsl:if>
+ <xsl:if test="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:for-each select="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:element name="meta:user-defined">
+ <xsl:attribute name="meta:name"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <meta:document-statistic meta:page-count="{child::*[@uof:locID='u0020']}" meta:paragraph-count="{child::*[@uof:locID='u0025']}" meta:word-count="{child::*[@uof:locID='u0023']}" meta:object-count="{child::*[@uof:locID='u0026']}" meta:character-count="{child::*[@uof:locID='u0021']}"/>
+ <meta:document-statistic/>
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="uof:用户自定义元数据集">
+ <xsl:for-each select="node()[@名称]">
+ <meta:user-defined meta:name="{name()}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="parse-range">
+ <xsl:param name="range-value"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="first-pit">
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:value-of select="substring-before($range-value,',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$range-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current">
+ <xsl:choose>
+ <xsl:when test="contains($first-pit,':')">
+ <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/>
+ <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/>
+ <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/>
+ <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/>
+ <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/>
+ <xsl:variable name="the-str">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$R-start"/>
+ <xsl:with-param name="r-end" select="$R-end"/>
+ <xsl:with-param name="c-start" select="$C-start"/>
+ <xsl:with-param name="c-end" select="$C-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$the-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($first-pit,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="substring-after($range-value,',')"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-rc-str">
+ <xsl:param name="r-start"/>
+ <xsl:param name="r-end"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="concat('R',$r-start)"/>
+ <xsl:with-param name="start" select="$c-start"/>
+ <xsl:with-param name="end" select="$c-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$r-start &lt; $r-end">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$r-start + 1"/>
+ <xsl:with-param name="r-end" select="$r-end"/>
+ <xsl:with-param name="c-start" select="$c-start"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$r-start = $r-end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-c-str">
+ <xsl:param name="rc-str"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/>
+ <xsl:if test="$start &lt; $end">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="$rc-str"/>
+ <xsl:with-param name="start" select="$start + 1"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$start = $end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-str">
+ <xsl:param name="param-str"/>
+ <xsl:choose>
+ <xsl:when test="contains($param-str,'(')">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($param-str,':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-range-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:param name="dpi" select="111"/>
+ <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-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="编号解析">
+ <xsl:variable name="bianhao">
+ <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号引用"/>
+ </xsl:variable>
+ <xsl:variable name="bianhaojibie">
+ <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号级别"/>
+ </xsl:variable>
+ <xsl:variable name="isxiangmuorisimage">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号">
+ <xsl:choose>
+ <xsl:when test="$bianhao=@字:标识符">
+ <xsl:choose>
+ <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:项目符号">true</xsl:when>
+ <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:图片符号引用">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$isxiangmuorisimage='true'">
+ <xsl:call-template name="无序"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="有序"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="有序">
+ <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/>
+ <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别"/>
+ <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute>
+ <xsl:if test="字:段落属性/字:自动编号信息/@字:重新编号">
+ <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="字:段落属性/字:自动编号信息/@字:重新编号='true'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$level -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="无序">
+ <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/>
+ <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别"/>
+ <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="unordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$level -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <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="convert2px">
+ <xsl:param name="value"/>
+ <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, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-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:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl
new file mode 100644
index 000000000000..532561920791
--- /dev/null
+++ b/filter/source/xslt/import/uof/uof2odf_spreadsheet.xsl
@@ -0,0 +1,9054 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" 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:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:template match="uof:UOF">
+ <!--chengxz0804 OK-->
+ <!--office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" 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="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script" 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:version="1.0" office:class="spreadsheet"-->
+ <office:document 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:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:apply-templates select="uof:元数据"/>
+ <office:settings>
+ <xsl:call-template name="工作表属性"/>
+ </office:settings>
+ <xsl:apply-templates select="uof:式样集"/>
+ <!--xsl:apply-templates select="表:公用处理规则"/-->
+ <xsl:apply-templates select="uof:电子表格"/>
+ </office:document>
+ </xsl:template>
+ <!--Redoffice comment lil from chenjh SC0013 06.02.15-->
+ <!--增加内容-->
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="/uof:UOF/uof:电子表格/表:公用处理规则/表:度量单位"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">inch</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>0.03527</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!--Redoffice comment liliang end 06.02.15-->
+ <xsl:template name="set-calculation">
+ <xsl:element name="table:calculation-settings">
+ <xsl:if test="表:公用处理规则/表:度量单位">
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="表:公用处理规则/表:度量单位"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">inch</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ </xsl:if>
+ <xsl:if test="表:公用处理规则/表:精确度以显示值为准">
+ <xsl:attribute name="table:precision-as-shown">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:公用处理规则/表:日期系统-1904/@表:值='true'">
+ <table:null-date table:date-value="1904-01-01"/>
+ </xsl:if>
+ <xsl:if test="表:公用处理规则/表:计算设置">
+ <xsl:element name="table:iteration">
+ <xsl:attribute name="table:status">enable</xsl:attribute>
+ <xsl:attribute name="table:steps"><xsl:value-of select="表:公用处理规则/表:计算设置/@表:迭代次数"/></xsl:attribute>
+ <xsl:attribute name="table:maximum-difference"><xsl:value-of select="表:公用处理规则/表:计算设置/@表:偏差值"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:字体集">
+ <xsl:if test="not(uof:字体声明[@uof:名称='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="uof:字体声明">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:字体族"/></xsl:attribute>
+ <xsl:if test="@uof:字符集 = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:字体族">
+ <xsl:choose>
+ <xsl:when test="@uof:字体族 = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:font-pitch">12</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:字体声明"/>
+ </xsl:template>
+ <xsl:template match="uof:电子表格">
+ <office:body>
+ <office:spreadsheet>
+ <xsl:call-template name="trackchange"/>
+ <xsl:call-template name="set-calculation"/>
+ <xsl:if test="表:公用处理规则/表:数据有效性集">
+ <xsl:element name="table:content-validations">
+ <xsl:call-template name="create-content-validations">
+ <xsl:with-param name="validation-set" select="表:公用处理规则/表:数据有效性集/表:数据有效性"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates select="表:主体/表:工作表"/>
+ <!--MSexcel 中的names暂时没有对应的-->
+ <xsl:element name="table:database-ranges">
+ <xsl:for-each select="表:主体/表:工作表">
+ <xsl:if test="./表:筛选">
+ <xsl:variable name="filter" select="./表:筛选"/>
+ <xsl:variable name="column-and-row" select="substring-before(substring-after($filter/表:范围/text(),'.'),':')"/>
+ <xsl:variable name="dd" select="number(substring($column-and-row,2,1))"/>
+ <xsl:variable name="zone-left-column-string">
+ <xsl:choose>
+ <xsl:when test="contains($dd,'NaN') ">
+ <xsl:value-of select="substring($column-and-row,1,2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($column-and-row,1,1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="zone-left-column-num">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="$zone-left-column-string"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="table:database-range">
+ <xsl:attribute name="table:name"><xsl:value-of select="uof:电子表格/表:主体/表:工作表/@表:名称"/></xsl:attribute>
+ <xsl:attribute name="table:target-range-address"><xsl:call-template name="translate-expression2"><xsl:with-param name="expression2" select="translate($filter/表:范围/text(),'$','')"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="$filter/@表:类型='auto'">
+ <xsl:attribute name="table:display-filter-buttons">true</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$filter/表:条件区域">
+ <xsl:element name="table:filter">
+ <xsl:attribute name="table:condition-source-range-address"><xsl:call-template name="translate-expression2"><xsl:with-param name="expression2" select="translate($filter/表:条件区域/text(),'$','')"/></xsl:call-template></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:filter">
+ <xsl:element name="table:filter-and">
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="conditon-set" select="$filter/表:条件"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </office:spreadsheet>
+ </office:body>
+ </xsl:template>
+ <xsl:template name="trackchange">
+ <xsl:for-each select="表:主体/表:工作表/表:工作表内容//字:修订开始">
+ <xsl:variable name="num">
+ <xsl:number level="any" from="表:主体/表:工作表/表:工作表内容//*" count="字:修订开始"/>
+ </xsl:variable>
+ <table:tracked-changes>
+ <table:cell-content-change>
+ <xsl:attribute name="table:id"><xsl:value-of select="concat('ct',$num)"/></xsl:attribute>
+ <table:cell-address>
+ <xsl:attribute name="table:column"><xsl:value-of select="substring-after(@字:标识符,'-')"/></xsl:attribute>
+ <xsl:attribute name="table:row"><xsl:value-of select="substring-before(@字:标识符,'-')"/></xsl:attribute>
+ <xsl:attribute name="table:table">0</xsl:attribute>
+ </table:cell-address>
+ <office:change-info>
+ <dc:creator>
+ <xsl:choose>
+ <xsl:when test="starts-with(@字:修订信息引用,'+')"/>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(@字:修订信息引用,'+')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dc:creator>
+ <!--xsl:value-of select="/uof:UOF/uof:元数据/uof:作者"/-->
+ <!--xsl:value-of select="/uof:UOF/uof:元数据/uof:创建日期"/-->
+ <dc:date>
+ <xsl:value-of select="substring-before(substring-after(@字:修订信息引用,'+'),'%')"/>
+ </dc:date>
+ </office:change-info>
+ <table:previous>
+ <table:change-track-table-cell>
+ <text:p>
+ <xsl:value-of select="substring-after(@字:修订信息引用,'%')"/>
+ </text:p>
+ </table:change-track-table-cell>
+ </table:previous>
+ </table:cell-content-change>
+ </table:tracked-changes>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="uof:式样集">
+ <xsl:element name="office:font-face-decls">
+ <style:font-face style:name="宋体" svg:font-family="宋体" style:font-family-generic="swiss"/>
+ <xsl:apply-templates select="uof:字体集"/>
+ </xsl:element>
+ <xsl:call-template name="单元格式样"/>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/uof:锚点 | /uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/表:单元格/uof:锚点" name="rel_graphic_name" use="@uof:图形引用"/>
+ <xsl:template match="图:图形">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:call-template name="graphic-fill">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:填充/图:渐变"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:call-template name="process-graphics">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="图:文本内容/@图:文字排列方向">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="@图:其他对象">
+ <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute>
+ <xsl:attribute name="draw:color-mode">standard</xsl:attribute>
+ <xsl:attribute name="draw:luminance">0%</xsl:attribute>
+ <xsl:attribute name="draw:contrast">0%</xsl:attribute>
+ <xsl:attribute name="draw:gamma">100%</xsl:attribute>
+ <xsl:attribute name="draw:red">0%</xsl:attribute>
+ <xsl:attribute name="draw:green">0%</xsl:attribute>
+ <xsl:attribute name="draw:blue">0%</xsl:attribute>
+ <xsl:attribute name="draw:image-opacity">100%</xsl:attribute>
+ <xsl:attribute name="style:mirror">none</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-graphics"/>
+ </xsl:element>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="图:文本内容/@图:文字排列方向">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-graphics">
+ <xsl:param name="draw-name"/>
+ <xsl:if test="not(key('rel_graphic_name',@图:标识符)/@uof:随动方式='movesize')">
+ <xsl:attribute name="style:protect"><xsl:choose><xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:随动方式='move'">size</xsl:when><xsl:otherwise>position size</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(图:预定义图形/图:属性/图:填充)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:attribute>
+ <xsl:if test="not(图:预定义图形/图:属性/图:填充/图:图片/@图:位置='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:前景色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:渐变/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="图:预定义图形/图:属性/图:线颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')">
+ <xsl:variable name="type" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$type='none'">none</xsl:when><xsl:when test="$type='single'">solid</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$type='dash'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$type='dot-dash'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$type='dashed-heavy'">Fine_20_Dashed</xsl:when><xsl:when test="$type='dotted' ">Fine_20_Dotted</xsl:when><xsl:when test="$type='dash-long-heavy'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$type='dash-long'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-dot'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$type='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$type='thick'">Line_20_Style_20_9</xsl:when><xsl:when test="$type='dot-dot-dash'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$type='dash-dot-dot-heavy'">Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-heavy'">Dash_20_10</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线粗细">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头">
+ <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头/图:大小">
+ <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头">
+ <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头/图:大小">
+ <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:透明度">
+ <xsl:attribute name="draw:opacity"><xsl:value-of select="concat(图:预定义图形/图:属性/图:透明度,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:if test="图:文本内容/@图:上边距">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(图:文本内容/@图:上边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(图:文本内容/@图:下边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(图:文本内容/@图:左边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(图:文本内容/@图:右边距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:文字排列方向">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-lr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='hori-r2l'">
+ <xsl:attribute name="draw:textarea-horizontal-align">right</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='hori-12r'">
+ <xsl:attribute name="draw:textarea-horizontal-align">left</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:水平对齐">
+ <xsl:attribute name="draw:textarea-horizontal-align"><xsl:value-of select="图:文本内容/@图:水平对齐"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:垂直对齐">
+ <xsl:attribute name="draw:textarea-vertical-align"><xsl:value-of select="图:文本内容/@图:垂直对齐"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:自动换行">
+ <xsl:attribute name="fo:wrap-option">no-wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:auto-grow-width"><xsl:choose><xsl:when test="图:文本内容/@图:大小适应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:auto-grow-height"><xsl:choose><xsl:when test="图:文本内容/@图:大小适应文字">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="bina_graphic">
+ <xsl:param name="refGraphic"/>
+ <xsl:element name="office:binary-data">
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]">
+ <xsl:value-of select="uof:数据"/>
+ </xsl:for-each>
+ </xsl:element>
+ <text:p/>
+ </xsl:template>
+ <xsl:template name="graphic-fill">
+ <xsl:param name="draw-name"/>
+ <xsl:param name="gradient-name"/>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:渐变方向 * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="$gradient-name/@图:种子X位置">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:种子X位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$gradient-name/@图:种子Y位置">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:种子Y位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型">
+ <draw:stroke-dash draw:name="Ultrafine_20_Dashed" draw:display-name="Ultrafine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.051cm" draw:dots2="1" draw:dots2-length="0.051cm" draw:distance="0.051cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed" draw:display-name="Fine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.508cm" draw:dots2="1" draw:dots2-length="0.508cm" draw:distance="0.508cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_2_20_Dots_20_3_20_Dashes" draw:display-name="Ultrafine 2 Dots 3 Dashes" draw:style="rect" draw:dots1="2" draw:dots1-length="0.051cm" draw:dots2="3" draw:dots2-length="0.254cm" draw:distance="0.127cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/>
+ <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
+ <draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/>
+ <draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/>
+ <draw:stroke-dash draw:name="Dash_20_10" draw:display-name="Dash 10" draw:style="rect" draw:dots1="1" draw:dots1-length="0.02cm" draw:dots2="1" draw:dots2-length="0.02cm" draw:distance="0.02cm"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="单元格式样">
+ <xsl:variable name="uofSheet" select="/uof:UOF/uof:电子表格"/>
+ <xsl:variable name="uofSheet1" select="/uof:UOF/uof:电子表格/表:主体/表:工作表"/>
+ <xsl:variable name="uofSheetCom" select="$uofSheet/表:公用处理规则"/>
+ <xsl:variable name="first-style" select="/uof:UOF/uof:式样集/uof:单元格式样"/>
+ <xsl:variable name="quyu" select="/uof:UOF/uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化/表:区域"/>
+ <xsl:variable name="condition-format-set" select="/uof:UOF/uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化"/>
+ <xsl:variable name="aa">
+ <xsl:for-each select="$first-style">
+ <xsl:if test="@表:标识符!=@表:名称 and @表:名称!='Normal'">
+ <xsl:value-of select="@表:名称"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="bb">
+ <xsl:for-each select="$first-style">
+ <xsl:if test="@表:标识符!=@表:名称 and @表:名称!='Normal'">
+ <xsl:value-of select="@表:标识符"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <office:styles>
+ <!-- if ConditionalFormatting exists,it should generate some styles for style:style -->
+ <!--xsl:if test="$uofSheetCom/表:条件格式化集">
+ <xsl:call-template name="CondFormat_office_style"/>
+ </xsl:if-->
+ <!--ro000179 chenjh-->
+ <xsl:for-each select="$first-style[@表:类型='custom' or @表:类型='default']">
+ <xsl:call-template name="单元格具体式样"/>
+ <xsl:apply-templates select="表:数字格式[@表:格式码]"/>
+ <xsl:apply-templates select="表:字体格式[字:上下标]"/>
+ </xsl:for-each>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:for-each select="$first-style[@表:类型='auto']">
+ <xsl:variable name="apply-style-name" select="@表:名称"/>
+ <xsl:variable name="style-name" select="@表:标识符"/>
+ <xsl:choose>
+ <xsl:when test="$style-name!=$apply-style-name and $apply-style-name!='Normal'">
+ <xsl:for-each select="$condition-format-set/表:条件">
+ <style:style>
+ <xsl:attribute name="style:name"><xsl:value-of select="//uof:单元格式样[@表:名称=current()/表:格式/@表:式样引用 and @表:类型='auto']/@表:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">Default</xsl:attribute>
+ <xsl:for-each select="parent::表:条件格式化/表:条件">
+ <xsl:variable name="condition-text">
+ <xsl:choose>
+ <xsl:when test="@表:类型='cell value'">
+ <xsl:choose>
+ <xsl:when test="表:操作码/text()='between' ">
+ <xsl:value-of select="concat('cell-content-is-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test=" 表:操作码/text()='not between'">
+ <xsl:value-of select="concat('cell-content-is-not-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='equal to'">
+ <xsl:value-of select="concat('cell-content()=',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='not equal to'">
+ <xsl:value-of select="concat('cell-content()!=',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='greater than'">
+ <xsl:value-of select="concat('cell-content()&gt;',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='less than'">
+ <xsl:value-of select="concat('cell-content()&lt;',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='greater than or equal to'">
+ <xsl:value-of select="concat('cell-content()&gt;=',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='less than or equal to'">
+ <xsl:value-of select="concat('cell-content()&lt;=',表:第一操作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@表:类型='formula'">
+ <xsl:value-of select="concat('is-true-formula','(',表:第一操作数/text(),')')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:variable name="address">
+ <xsl:value-of select="preceding-sibling::表:区域"/>
+ </xsl:variable>
+ <xsl:attribute name="style:condition"><xsl:value-of select="$condition-text"/></xsl:attribute>
+ <xsl:attribute name="style:apply-style-name"><xsl:value-of select="表:格式/@表:式样引用"/></xsl:attribute>
+ <xsl:attribute name="style:base-cell-address"><xsl:value-of select="substring-after($address,':')"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </style:style>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="uof:单元格式样 ">
+ <xsl:if test="@表:类型='auto' and (@表:标识符=@表:名称 or @表:名称='Normal')">
+ <xsl:call-template name="单元格具体式样"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <!--Redoffie comment liliang SC0008 06.02.14-->
+ <!--1新增内容-->
+ <xsl:if test="uof:单元格式样">
+ <xsl:for-each select="uof:单元格式样">
+ <xsl:if test="@表:类型='auto' and (@表:标识符=@表:名称 or @表:名称='Normal')">
+ <xsl:call-template name="单元格具体式样"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='png' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='ipg' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='gif'">
+ <style:style style:name="Graphics" style:family="graphics">
+ <style:properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
+ </style:style>
+ </xsl:if>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形/图:文本内容/字:段落/字:句/字:句属性" mode="style"/>
+ <!--Redoffice comment end 06.02.14-->
+ <xsl:apply-templates select="$uofSheet1/表:工作表内容"/>
+ <xsl:if test="uof:单元格式样">
+ <xsl:for-each select="uof:单元格式样[@表:类型='auto' and (@表:标识符=@表:名称 or @表:名称='Normal')]">
+ <xsl:call-template name="单元格具体式样"/>
+ <xsl:apply-templates select="表:数字格式[@表:格式码]"/>
+ <xsl:apply-templates select="表:字体格式[字:上下标]"/>
+ </xsl:for-each>
+ </xsl:if>
+ <!-- if ConditionalFormatting exists,transforing the styles -->
+ <!--xsl:if test="$uofSheetCom/表:条件格式化集">
+ <xsl:call-template name="CondFormat_automatic_style"/>
+ </xsl:if-->
+ <xsl:if test="$uofSheetCom/表:条件格式化集/表:条件格式化">
+ <xsl:variable name="style-name" select="$first-style/@表:标识符"/>
+ <xsl:variable name="left-top">
+ <xsl:call-template name="search-left-top-in-tables">
+ <xsl:with-param name="cellstylename" select="$style-name"/>
+ <xsl:with-param name="tableslist" select="$uofSheet1/表:工作表内容"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="after-translated-left-top">
+ <xsl:call-template name="translate-left-top">
+ <xsl:with-param name="left-top" select="$left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$after-translated-left-top!=''">
+ <xsl:call-template name="create-the-condition-format-map">
+ <xsl:with-param name="condition-format-set" select="$uofSheetCom/表:条件格式化集//表:条件格式化"/>
+ <xsl:with-param name="current-left-top" select="$after-translated-left-top"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <xsl:apply-templates select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列/表:单元格/*[descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40']]"/>
+ <!--xsl:apply-templates select="$uofSheet1/表:工作表属性/表:页面设置/表:页眉页脚/字:段落" /-->
+ <xsl:call-template name="create-page-master">
+ <xsl:with-param name="worksheetoptions" select="$uofSheet1/表:工作表属性"/>
+ </xsl:call-template>
+ <xsl:for-each select="uof:句式样">
+ <style:style>
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <style:text-properties>
+ <xsl:apply-templates select="./*"/>
+ </style:text-properties>
+ </style:style>
+ </xsl:for-each>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:call-template name="create-master-styles">
+ <xsl:with-param name="worksheetoptions" select="$uofSheet1/表:工作表属性"/>
+ </xsl:call-template>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template match="表:数据有效性">
+ <xsl:variable name="range-name-temp">
+ <xsl:value-of select="substring-before(表:区域,'!')"/>
+ </xsl:variable>
+ <xsl:variable name="range-name">
+ <xsl:value-of select="substring($range-name-temp,2,string-length($range-name-temp)-2)"/>
+ </xsl:variable>
+ <xsl:variable name="first-range">
+ <xsl:choose>
+ <xsl:when test="contains(表:区域, ',')">
+ <xsl:value-of select="translate(substring-after(substring-before(表:区域, ','),'!'),'$','')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(substring-after(表:区域,'!'),'$','')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="value-first">
+ <xsl:value-of select="translate(表:第一操作数,'=','')"/>
+ </xsl:variable>
+ <xsl:variable name="value-second">
+ <xsl:value-of select="translate(表:第二操作数,'=','')"/>
+ </xsl:variable>
+ <xsl:element name="table:content-validation">
+ <xsl:attribute name="table:name"><xsl:value-of select="concat('val', position())"/></xsl:attribute>
+ <!--数据有效性:第一操作数、第二操作数-->
+ <!-- don't support two type of qualifier: List, Custom -->
+ <xsl:attribute name="table:condition"><xsl:variable name="qualifier-content"><xsl:choose><xsl:when test="表:操作码 = 'between'"><xsl:choose><xsl:when test="(number($value-second))"><xsl:value-of select="concat('cell-content-is-between([',$range-name,'.',$value-first,'],',$value-second)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('cell-content-is-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,']')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:操作码 = 'not between'"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('cell-content-is-not-between([',$range-name,'.',$value-first,'],',$value-second)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('cell-content-is-not-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,']')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:操作码 = 'not equal to'"><xsl:value-of select="concat('!=', $value-first)"/></xsl:when><xsl:when test="表:操作码 = 'equal to'"><xsl:variable name="range1"><xsl:value-of select="substring-after(substring-before($value-first,':'),'(')"/></xsl:variable><xsl:variable name="range2"><xsl:value-of select="substring-before(substring-after($value-first,':'),')')"/></xsl:variable><xsl:value-of select="concat('=SUM([',$range-name,'.',$range1,':',$range-name,'.',$range2,']')"/></xsl:when><xsl:when test="表:操作码 = 'less than'"><xsl:value-of select="concat('&lt;', $value-first)"/></xsl:when><xsl:when test="表:操作码 = 'greater than'"><xsl:value-of select="concat('&gt;', $value-first)"/></xsl:when><xsl:when test="表:操作码 = 'greater than or equal to'"><xsl:value-of select="concat('&gt;=[',$range-name, '.',$value-first,']')"/></xsl:when><xsl:when test="表:操作码 = 'less than or equal to'"><xsl:value-of select="concat('&lt;=[',$range-name,'.', $value-first,']')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('([',$range-name,'.',substring-before($value-first,':'),':',$range-name,'.',substring-after($value-first,':'),'])')"/></xsl:otherwise></xsl:choose></xsl:variable><!--操作码、校验类型--><xsl:variable name="qualifier-value"><xsl:choose><xsl:when test="表:校验类型 = 'whole number'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-whole-number() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-whole-number() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'decimal'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'list'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-in-list() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-in-list',$qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'date'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-date() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-date() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'time'"><xsl:choose><xsl:when test="(表:操作码 = 'not between') or (表:操作码 = 'between')"><xsl:value-of select="concat('oooc:cell-content-is-time() and ', $qualifier-content, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-time() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'text length'"><xsl:choose><xsl:when test="表:操作码 = 'not between'"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between([', $range-name,'.',$value-first, '],', $value-second, ')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between([',$range-name,'.', $value-first, '],[',$range-name,'.', $value-second, '])')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="$value-second and $value-first"><xsl:choose><xsl:when test="number($value-second)"><xsl:value-of select="concat('oooc:cell-content-text-length-is-between([',$range-name,'.',$value-first,'],',$value-second,')')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length-is-between([',$range-name,'.',$value-first,'],[',$range-name,'.',$value-second,'])')"/></xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-text-length()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:when test="表:校验类型 = 'custom'"><xsl:choose><xsl:when test="表:操作码 = 'between'"><xsl:value-of select="concat('and cell-content-is-between(',substring-before($value-first,'('),'([',$range-name,'.',substring-after(substring-before($value-first,':'),'('),':',$range-name,'.',substring-before(substring-after($value-first,':'),')'),']),0')"/></xsl:when><xsl:when test="表:操作码 = 'not between'"><xsl:value-of select="concat('oooc:and cell-content-is-not-between(',substring-before($value-first,'('),'([',$range-name,'.',substring-after(substring-before($value-first,':'),'('),':',$range-name,'.',substring-before(substring-after($value-first,':'),')'),']),0')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('oooc:cell-content-is-custom() and ', 'cell-content()', $qualifier-content)"/></xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="表:校验类型"/></xsl:otherwise></xsl:choose></xsl:variable><xsl:value-of select="$qualifier-value"/></xsl:attribute>
+ <!--忽略空格-->
+ <xsl:attribute name="table:allow-empty-cell"><xsl:choose><xsl:when test="表:忽略空格"><xsl:value-of select="'false'"/></xsl:when><xsl:otherwise><xsl:value-of select="'true'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="table:base-cell-address"><xsl:variable name="range"><xsl:value-of select="$first-range"/><!--xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0" />
+ <xsl:with-param name="cell-column-pos" select="0" />
+ <xsl:with-param name="expression" select="$first-range" />
+ <xsl:with-param name="return-value" select="''" />
+ </xsl:call-template--></xsl:variable><xsl:call-template name="encode-as-cell-address"><xsl:with-param name="string" select="concat($range-name, '.', $range)"/></xsl:call-template></xsl:attribute>
+ <!--输入提示-->
+ <xsl:element name="table:help-message">
+ <xsl:attribute name="table:title"><xsl:value-of select="表:输入提示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:choose><xsl:when test="表:输入提示/@表:显示"><xsl:value-of select="表:输入提示/@表:显示"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="表:输入提示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ <!--错误提示-->
+ <xsl:element name="table:error-message">
+ <xsl:attribute name="table:message-type"><xsl:choose><xsl:when test="表:错误提示/@表:类型= 'information'"><xsl:value-of select="'information'"/></xsl:when><xsl:when test="表:错误提示/@表:类型= 'warning'"><xsl:value-of select="'warning'"/></xsl:when><xsl:otherwise><xsl:value-of select="'stop'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="table:title"><xsl:value-of select="表:错误提示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:choose><xsl:when test="表:错误提示/@表:显示"><xsl:value-of select="表:错误提示/@表:显示"/></xsl:when><xsl:otherwise><xsl:value-of select="'false'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="表:错误提示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="CondFormat_office_style">
+ <xsl:for-each select="../../uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化">
+ <xsl:variable name="table-pos" select="count(../../../preceding-sibling::表:公用处理规则)+1"/>
+ <xsl:variable name="conditions" select="count(../preceding-sibling::表:条件格式化集)+1"/>
+ <xsl:for-each select="表:条件">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::表:条件)+1"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:element name="style:properties">
+ <xsl:choose>
+ <xsl:when test="表:格式/@表:式样引用">
+ <xsl:variable name="stylevalue" select="表:格式/@表:式样引用"/>
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <!--xsl:element name="style:text-properties"-->
+ <!--chengxz0618-->
+ <xsl:element name="style:properties">
+ <xsl:choose>
+ <xsl:when test="表:格式/@表:式样引用">
+ <xsl:variable name="stylevalue" select="表:格式/@表:式样引用"/>
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t">
+ <xsl:choose>
+ <xsl:when test="substring($stylevalue,string-length($stylevalue),1) != ';'">
+ <xsl:value-of select="concat($stylevalue,';')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$stylevalue"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-style"><xsl:value-of select="'italic'"/></xsl:attribute>
+ <xsl:attribute name="style:text-underline-type"><xsl:value-of select="'single'"/></xsl:attribute>
+ <xsl:attribute name="style:text-underline-color"><xsl:value-of select="'font-color'"/></xsl:attribute>
+ <xsl:attribute name="fo:font-weight"><xsl:value-of select="'bold'"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="cell-pattern-color">
+ <xsl:param name="pattern"/>
+ <xsl:param name="color-value"/>
+ <xsl:param name="pattern-color-value"/>
+ <xsl:variable name="rev-pattern" select="1 - $pattern"/>
+ <xsl:variable name="color-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="color-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-R-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,2,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-G-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,4,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-B-value">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="substring($pattern-color-value,6,2)"/>
+ <xsl:with-param name="index" select="1"/>
+ <xsl:with-param name="str-length" select="2"/>
+ <xsl:with-param name="last-value" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="R-value">
+ <xsl:variable name="combined-R-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-R-value * $rev-pattern + $pattern-R-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-R-value) = 1">
+ <xsl:value-of select="concat('0',$combined-R-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-R-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="G-value">
+ <xsl:variable name="combined-G-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-G-value * $rev-pattern + $pattern-G-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-G-value) = 1">
+ <xsl:value-of select="concat('0',$combined-G-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-G-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="B-value">
+ <xsl:variable name="combined-B-value">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="floor($color-B-value * $rev-pattern + $pattern-B-value * $pattern)"/>
+ <xsl:with-param name="last-value" select="'H'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length($combined-B-value) = 1">
+ <xsl:value-of select="concat('0',$combined-B-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$combined-B-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('#',$R-value,$G-value,$B-value)"/>
+ </xsl:template>
+ <xsl:template name="hex2decimal">
+ <xsl:param name="hex-number"/>
+ <xsl:param name="index"/>
+ <xsl:param name="str-length"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="dec-char">
+ <xsl:call-template name="hexNumber2dec">
+ <xsl:with-param name="hex-value" select="substring($hex-number, $index ,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="$last-value * 16 + $dec-char"/>
+ <xsl:if test="$index &lt; $str-length">
+ <xsl:call-template name="hex2decimal">
+ <xsl:with-param name="hex-number" select="$hex-number"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="str-length" select="$str-length"/>
+ <xsl:with-param name="last-value" select="$current-value"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $str-length">
+ <xsl:value-of select="$current-value"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="hexNumber2dec">
+ <xsl:param name="hex-value"/>
+ <xsl:choose>
+ <xsl:when test="$hex-value = 'A' or ($hex-value = 'a')">
+ <xsl:value-of select="10"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'B' or ($hex-value = 'b')">
+ <xsl:value-of select="11"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'C' or ($hex-value = 'c')">
+ <xsl:value-of select="12"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'D' or ($hex-value = 'd')">
+ <xsl:value-of select="13"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'E' or ($hex-value = 'e')">
+ <xsl:value-of select="14"/>
+ </xsl:when>
+ <xsl:when test="$hex-value = 'F' or ($hex-value = 'f')">
+ <xsl:value-of select="15"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$hex-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="decimal2hex">
+ <xsl:param name="dec-number"/>
+ <xsl:param name="last-value"/>
+ <xsl:variable name="current-value">
+ <xsl:call-template name="decNumber2hex">
+ <xsl:with-param name="dec-value">
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:value-of select="floor($dec-number div 16)"/>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="$dec-number"/>
+ </xsl:if>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$dec-number &gt; 15">
+ <xsl:call-template name="decimal2hex">
+ <xsl:with-param name="dec-number" select="$dec-number mod 16"/>
+ <xsl:with-param name="last-value" select="concat($last-value,$current-value)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$dec-number &lt; 16">
+ <xsl:value-of select="substring-after(concat($last-value,$current-value),'H')"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="decNumber2hex">
+ <xsl:param name="dec-value"/>
+ <xsl:choose>
+ <xsl:when test="$dec-value = 10">
+ <xsl:value-of select="'A'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 11">
+ <xsl:value-of select="'B'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 12">
+ <xsl:value-of select="'C'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 13">
+ <xsl:value-of select="'D'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 14">
+ <xsl:value-of select="'E'"/>
+ </xsl:when>
+ <xsl:when test="$dec-value = 15">
+ <xsl:value-of select="'F'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dec-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-table-cell">
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="$style-value-t"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'background')">
+ <xsl:choose>
+ <xsl:when test="contains($style-value,'mso-pattern')">
+ <xsl:variable name="color-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-value">
+ <xsl:call-template name="translate-color-style">
+ <xsl:with-param name="source-str" select="normalize-space(substring-after($style-value,'mso-pattern'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="mso-color" select="substring-after($mso-value,'#')"/>
+ <xsl:variable name="pattern-color-value" select="substring($mso-color,1,6)"/>
+ <xsl:variable name="pattern" select="concat('0.',normalize-space(substring-before(substring-after($mso-color,'gray-'),';')))"/>
+ <xsl:variable name="pattern-color">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="$pattern"/>
+ <xsl:with-param name="color-value" select="$color-value"/>
+ <xsl:with-param name="pattern-color-value" select="concat('#',$pattern-color-value)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="normalize-space($pattern-color)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:background-color"><xsl:call-template name="translate-color-style"><xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:call-template></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'border')">
+ <xsl:attribute name="fo:border"><xsl:value-of select="'0.002cm solid #000000'"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-table-cell">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="recursion-condformat-style-text">
+ <xsl:param name="style-value-t"/>
+ <xsl:variable name="style-value" select="normalize-space($style-value-t)"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($style-value,'color')">
+ <xsl:attribute name="fo:color"><xsl:call-template name="translate-color-style"><xsl:with-param name="source-str" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:call-template></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-style')">
+ <xsl:attribute name="fo:font-style"><xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'font-weight')">
+ <xsl:variable name="font-weight" select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/>
+ <xsl:attribute name="fo:font-weight"><xsl:choose><xsl:when test="($font-weight &gt; 300) and ($font-weight &lt; 500)"><xsl:value-of select="'normal'"/></xsl:when><xsl:when test="($font-weight &gt; 500) or ($font-weight = 500)"><xsl:value-of select="'bold'"/></xsl:when><xsl:otherwise><xsl:value-of select="'0'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-value,'text-underline-style')">
+ <xsl:attribute name="style:text-underline-type"><xsl:value-of select="normalize-space(substring-before(substring-after($style-value,':'),';'))"/></xsl:attribute>
+ <xsl:attribute name="style:text-underline-color"><xsl:value-of select="'#000000'"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="contains($style-value,':')">
+ <xsl:call-template name="recursion-condformat-style-text">
+ <xsl:with-param name="style-value-t" select="substring-after($style-value,';')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="translate-color-style">
+ <xsl:param name="source-str"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'#')">
+ <xsl:value-of select="$source-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="starts-with($source-str,'black')">
+ <xsl:value-of select="'#000000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'maroon')">
+ <xsl:value-of select="'#800000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'red')">
+ <xsl:value-of select="'#FF0000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'fuchsia')">
+ <xsl:value-of select="'#FF00FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'olive')">
+ <xsl:value-of select="'#808000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'yellow')">
+ <xsl:value-of select="'#FFFF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'green')">
+ <xsl:value-of select="'#008000'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'lime')">
+ <xsl:value-of select="'#00FF00'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'teal')">
+ <xsl:value-of select="'#008080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'aqua')">
+ <xsl:value-of select="'#00FFFF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'navy')">
+ <xsl:value-of select="'#000080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'blue')">
+ <xsl:value-of select="'#0000FF'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'purple')">
+ <xsl:value-of select="'#800080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'gray')">
+ <xsl:value-of select="'#808080'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'silver')">
+ <xsl:value-of select="'#C0C0C0'"/>
+ </xsl:when>
+ <xsl:when test="starts-with($source-str,'white')">
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'#FFFFFF'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="CondFormat_automatic_style">
+ <xsl:for-each select="../uof:电子表格/表:公用处理规则/表:条件格式化集/表:条件格式化">
+ <xsl:variable name="table-pos" select="count(../../../preceding-sibling::表:公用处理规则)+1"/>
+ <xsl:variable name="conditions" select="count(../preceding-sibling::表:条件格式化集)+1"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('ce',$table-pos,'-',$conditions)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:for-each select="uof:单元格式样/表:条件">
+ <xsl:variable name="condition-number" select="count(preceding-sibling::表:条件)+1"/>
+ <xsl:variable name="base-address">
+ <xsl:choose>
+ <xsl:when test="contains(../表:区域,',')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before(../表:区域,','),':')">
+ <xsl:value-of select="substring-before(substring-after(../表:区域,':'),',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(../表:区域,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../表:区域"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="base-cell-address">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="substring-before(substring-after($base-address,'R'),'C')"/>
+ <xsl:with-param name="row-number" select="substring-after($base-address,'C')"/>
+ <xsl:with-param name="column-pos-style" select="absolute"/>
+ <xsl:with-param name="row-pos-style" select="absolute"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-value">
+ <xsl:call-template name="translate-condition">
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:attribute name="style:condition"><xsl:value-of select="$condition-value"/></xsl:attribute>
+ <xsl:attribute name="style:apply-style-name"><xsl:value-of select="concat('Excel_CondFormat_',$table-pos,'_',$conditions,'_',$condition-number)"/></xsl:attribute>
+ <xsl:attribute name="style:base-cell-address"><xsl:value-of select="concat(../../@Name,'.',$base-cell-address)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="translate-condition">
+ <xsl:variable name="address-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="表:第一操作数"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="表:操作码">
+ <xsl:variable name="qualifier" select="表:操作码"/>
+ <xsl:variable name="first-value" select="表:第一操作数"/>
+ <xsl:choose>
+ <xsl:when test="$qualifier = 'Equal'">
+ <xsl:choose>
+ <xsl:when test="starts-with($first-value,'&quot;')">
+ <xsl:value-of select="concat('cell-content()=',$address-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('cell-content()=[',$address-value,']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Less'">
+ <xsl:value-of select="concat('cell-content()&lt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Greater'">
+ <xsl:value-of select="concat('cell-content()&gt;[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'LessOrEqual'">
+ <xsl:value-of select="concat('cell-content()&lt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'GreaterOrEqual'">
+ <xsl:value-of select="concat('cell-content()&gt;=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotEqual'">
+ <xsl:value-of select="concat('cell-content()!=[',$address-value,']')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'Between'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="表:第二操作数"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ <xsl:when test="$qualifier = 'NotBetween'">
+ <xsl:variable name="second-value">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="0"/>
+ <xsl:with-param name="cell-column-pos" select="0"/>
+ <xsl:with-param name="expression" select="表:第二操作数"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('cell-content-is-not-between([',$address-value,'],[',$second-value,'])')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('is-true-formula(',$address-value,')')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-expression">
+ <xsl:param name="cell-row-pos"/>
+ <xsl:param name="cell-column-pos"/>
+ <xsl:param name="expression"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="temp-range">
+ <xsl:choose>
+ <xsl:when test="$expression != ''">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="$expression"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="range-type">
+ <xsl:choose>
+ <xsl:when test="substring($temp-range, 1, 1) = '1'">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="substring($temp-range, 1, 1) = '2'">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-range">
+ <xsl:value-of select="substring($temp-range, 2)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$range-type = 1">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '#$')">
+ <xsl:variable name="temp-token">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, '\')">
+ <xsl:value-of select="concat(']', substring-after($current-range, '#$'), &quot;&apos;&quot;)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, '#$')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($expression, $temp-token)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($expression, $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="return-value">
+ <xsl:choose>
+ <xsl:when test="$current-range = '='">
+ <xsl:text>oooc:=</xsl:text>
+ </xsl:when>
+ <xsl:when test="substring($current-range, string-length($current-range)) = '('">
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range, '[.')"/>
+ </xsl:when>
+ <xsl:when test="$current-range = ','">
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), '];[.')"/>
+ </xsl:when>
+ <xsl:when test="$current-range = ')'">
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), '])')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="handle-type">
+ <xsl:choose>
+ <xsl:when test="starts-with($current-range, 'R')">
+ <xsl:choose>
+ <xsl:when test="contains($current-range, 'C')">
+ <xsl:variable name="part-type-r">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-before( substring-after($current-range, 'R'), 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="part-type-c">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($part-type-r = 1) and ($part-type-c = 1)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'R')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="2"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($current-range, 'C')">
+ <xsl:variable name="part-type">
+ <xsl:call-template name="handle-type-number">
+ <xsl:with-param name="t-part" select="substring-after($current-range, 'C')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$part-type = 1">
+ <xsl:value-of select="3"/>
+ </xsl:when>
+ <xsl:when test="$part-type = 2">
+ <xsl:value-of select="4"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="4"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$handle-type = 1">
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-R='C' or $after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos+substring-before( substring-after($current-range,'R['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-R='C'">
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($current-range,'R'),'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='C'">relative</xsl:when>
+ <xsl:otherwise>absolute</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="column-digit-length">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring-after(substring-after($current-range,'R'),'C')"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + substring-before(substring-after(substring-after($current-range,'R'),'C['),']')"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="substring(substring-after(substring-after($current-range,'R'),'C'),1,$column-digit-length)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos-style">
+ <xsl:choose>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">absolute</xsl:when>
+ <xsl:otherwise>relative</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="$column-pos-style"/>
+ <xsl:with-param name="row-pos-style" select="$row-pos-style"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before(substring-after($expression, '('),'R'),',!', ';.'))"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 2">
+ <xsl:variable name="after-R">
+ <xsl:value-of select="substring(substring-after($current-range,'R'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-R='[' or $after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:variable name="row-number">
+ <xsl:choose>
+ <xsl:when test="$after-R = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'R['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'R')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-pos">
+ <xsl:choose>
+ <xsl:when test="$after-R='['">
+ <xsl:value-of select="$cell-row-pos + $row-number"/>
+ </xsl:when>
+ <xsl:when test="$after-R='0' or $after-R='1' or $after-R='2' or $after-R='3' or $after-R='4' or $after-R='5' or $after-R='6' or $after-R='7' or $after-R='8' or $after-R='9'">
+ <xsl:value-of select="$row-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-row-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="1"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="256"/>
+ <xsl:with-param name="row-number" select="$row-pos"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'R'),',!', ';.'),'R')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'R')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$handle-type = 3">
+ <xsl:variable name="after-C">
+ <xsl:value-of select="substring(substring-after($current-range,'C'),1,1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$after-C='[' or $after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:variable name="column-number">
+ <xsl:choose>
+ <xsl:when test="$after-C = '['">
+ <xsl:value-of select="substring-before(substring-after($current-range, 'C['), ']')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($current-range, 'C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-pos">
+ <xsl:choose>
+ <xsl:when test="$after-C='['">
+ <xsl:value-of select="$cell-column-pos + $column-number"/>
+ </xsl:when>
+ <xsl:when test="$after-C='0' or $after-C='1' or $after-C='2' or $after-C='3' or $after-C='4' or $after-C='5' or $after-C='6' or $after-C='7' or $after-C='8' or $after-C='9'">
+ <xsl:value-of select="$column-number"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$cell-column-pos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="trans-unit1">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="1"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="trans-unit2">
+ <xsl:call-template name="translate-unit">
+ <xsl:with-param name="column-number" select="$column-pos"/>
+ <xsl:with-param name="row-number" select="32000"/>
+ <xsl:with-param name="column-pos-style" select="'relative'"/>
+ <xsl:with-param name="row-pos-style" select="'relative'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), $trans-unit1, ':', $trans-unit2)"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="name-unit" select="concat(substring-before($expression, $current-range), translate( substring-before($current-range,'C'),',!', ';.'),'C')"/>
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($current-range,'C')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, $name-unit)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="next-pit" select="substring-after($expression, $current-range)"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-pit, '+') or contains($next-pit, '-') or contains($next-pit, '*') or contains($next-pit, '/') or contains($next-pit, ')') or contains($next-pit, '^') or contains($next-pit, ':') or contains($next-pit, '&quot;') or contains($next-pit, ';') or contains($next-pit, ',') or contains($next-pit, '[')">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$cell-row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$cell-column-pos"/>
+ <xsl:with-param name="expression" select="substring-after($expression, $current-range)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, $current-range), $current-range)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate( concat($return-value, substring-before($expression, $current-range), $current-range),',!', ';.')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="parse-range-name">
+ <xsl:param name="expression"/>
+ <xsl:param name="return-value"/>
+ <xsl:variable name="first-one" select="substring($expression,1,1)"/>
+ <xsl:choose>
+ <xsl:when test="$first-one = '='">
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($return-value)) &gt; 0">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1=</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='(' or $first-one='!' or $first-one='&amp;'">
+ <xsl:value-of select="concat('1', $return-value, $first-one)"/>
+ </xsl:when>
+ <xsl:when test="$first-one='['">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring-after($expression, ']'), 'C')">
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring-after($expression, ']')"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(substring-before($expression, ']'), '.') and contains(substring-after($expression, ']'), '!')">
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, substring-before(substring-after($expression, '['), ']'), &quot;&apos;&quot;, '#$', substring-before(substring-after($expression, ']'), '!'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value, substring-before($expression, ']'), ']')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='&quot;'">
+ <xsl:value-of select="concat('1', $first-one, substring-before(substring-after($expression, '&quot;'), '&quot;'), '&quot;')"/>
+ </xsl:when>
+ <xsl:when test="$first-one=&quot;&apos;&quot;">
+ <xsl:variable name="str-in" select="substring-before(substring-after($expression, &quot;&apos;&quot;), &quot;&apos;&quot;)"/>
+ <xsl:choose>
+ <xsl:when test="contains($str-in, '\') and contains($str-in, '[') and contains($str-in, ']')">
+ <xsl:variable name="first-pos" select="substring-before($str-in, '[')"/>
+ <xsl:variable name="second-pos" select="substring-before(substring-after($str-in, '['), ']')"/>
+ <xsl:variable name="third-pos" select="substring-after($str-in, ']')"/>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $first-pos, $second-pos, &quot;&apos;&quot;, '#$', $third-pos)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('1', &quot;&apos;&quot;, $str-in, &quot;&apos;&quot;)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-one='+' or $first-one='-' or $first-one='*' or $first-one='/' or $first-one=')' or $first-one='^' or $first-one=':' or $first-one='&quot;' or $first-one=';' or $first-one=',' or $first-one='&gt;' or $first-one='&lt;'">
+ <xsl:choose>
+ <xsl:when test="$return-value = ''">
+ <xsl:value-of select="concat('1', $first-one)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$expression = ''">
+ <xsl:value-of select="concat('2', $return-value)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="parse-range-name">
+ <xsl:with-param name="expression" select="substring($expression, 2, string-length($expression)-1)"/>
+ <xsl:with-param name="return-value" select="concat($return-value, substring($expression, 1, 1))"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="handle-type-number">
+ <xsl:param name="t-part"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($t-part, '[')">
+ <xsl:variable name="tt-str" select="substring-before( substring-after( $t-part, '['), ']')"/>
+ <xsl:choose>
+ <xsl:when test="($tt-str &lt; 0) or ($tt-str &gt; 0) or ($tt-str = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="($t-part &lt; 0) or ($t-part &gt; 0) or ($t-part = 0)">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="$t-part = ''">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-unit">
+ <xsl:param name="column-number"/>
+ <xsl:param name="row-number"/>
+ <xsl:param name="column-pos-style"/>
+ <xsl:param name="row-pos-style"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$column-pos-style = 'absolute'">
+ <xsl:value-of select="concat( '$', $column-character1, $column-character2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat( $column-character1, $column-character2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$row-pos-style ='absolute'">
+ <xsl:value-of select="concat( '$', $row-number)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-number"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="number-to-character">
+ <xsl:param name="number"/>
+ <xsl:choose>
+ <xsl:when test="$number = 0"/>
+ <xsl:when test="$number = 1">A</xsl:when>
+ <xsl:when test="$number = 2">B</xsl:when>
+ <xsl:when test="$number = 3">C</xsl:when>
+ <xsl:when test="$number = 4">D</xsl:when>
+ <xsl:when test="$number = 5">E</xsl:when>
+ <xsl:when test="$number = 6">F</xsl:when>
+ <xsl:when test="$number = 7">G</xsl:when>
+ <xsl:when test="$number = 8">H</xsl:when>
+ <xsl:when test="$number = 9">I</xsl:when>
+ <xsl:when test="$number = 10">J</xsl:when>
+ <xsl:when test="$number = 11">K</xsl:when>
+ <xsl:when test="$number = 12">L</xsl:when>
+ <xsl:when test="$number = 13">M</xsl:when>
+ <xsl:when test="$number = 14">N</xsl:when>
+ <xsl:when test="$number = 15">O</xsl:when>
+ <xsl:when test="$number = 16">P</xsl:when>
+ <xsl:when test="$number = 17">Q</xsl:when>
+ <xsl:when test="$number = 18">R</xsl:when>
+ <xsl:when test="$number = 19">S</xsl:when>
+ <xsl:when test="$number = 20">T</xsl:when>
+ <xsl:when test="$number = 21">U</xsl:when>
+ <xsl:when test="$number = 22">V</xsl:when>
+ <xsl:when test="$number = 23">W</xsl:when>
+ <xsl:when test="$number = 24">X</xsl:when>
+ <xsl:when test="$number = 25">Y</xsl:when>
+ <xsl:when test="$number = 26">Z</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-digit-length">
+ <xsl:param name="complexive-string"/>
+ <xsl:variable name="first-char">
+ <xsl:value-of select="substring( $complexive-string, 1, 1)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-char = '1' or $first-char = '2' or $first-char = '3' or $first-char = '4' or $first-char = '5' or $first-char = '6' or $first-char = '7' or $first-char = '8' or $first-char = '9' or $first-char = '0' ">
+ <xsl:variable name="temp">
+ <xsl:call-template name="get-digit-length">
+ <xsl:with-param name="complexive-string" select="substring( $complexive-string, 2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$temp+1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:句属性" mode="style">
+ <!--chengxz 0725-->
+ <xsl:if test="not(@字:式样引用)">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句属性" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="@字:式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="./*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="style-style-content">
+ <xsl:variable name="style-name" select="@表:标识符"/>
+ <xsl:variable name="apply-style-name" select="@表:名称"/>
+ <xsl:attribute name="style:family"><xsl:choose><xsl:when test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]">table-column</xsl:when><xsl:otherwise>table-cell</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]/@表:列宽">
+ <xsl:element name="style:table-column-properties">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]/@表:列宽,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]/@表:跨度">
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:列[@表:式样引用=$style-name]">
+ <xsl:if test="preceding-sibling::表:列[1]/@表:跨度 and ancestor::表:工作表/表:分页符集/表:分页符/@表:列号">
+ <xsl:variable name="kuadu">
+ <xsl:value-of select="preceding-sibling::表:列[1]/@表:跨度"/>
+ </xsl:variable>
+ <xsl:if test="not($kuadu='1')">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$kuadu='1' and not(preceding::表:列[2])">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="style:table-cell-properties">
+ <xsl:if test="表:对齐格式">
+ <xsl:if test="表:对齐格式/表:垂直对齐方式">
+ <xsl:variable name="vertical-align">
+ <xsl:choose>
+ <xsl:when test="表:对齐格式/表:垂直对齐方式 = 'top'">top</xsl:when>
+ <xsl:when test="表:对齐格式/表:垂直对齐方式 = 'center'">center</xsl:when>
+ <xsl:when test="表:对齐格式/表:垂直对齐方式 = 'bottom'">bottom</xsl:when>
+ <xsl:otherwise>middle</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-align"><xsl:value-of select="$vertical-align"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对齐格式/表:自动换行/@表:值 = 'true'">
+ <xsl:attribute name="fo:wrap-option">wrap</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对齐格式/表:缩进">
+ <xsl:attribute name="fo:padding-left"><xsl:variable name="indent" select="表:对齐格式/表:缩进 * 10"/><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat($indent,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对齐格式/表:文字旋转角度">
+ <xsl:attribute name="style:rotation-angle"><xsl:choose><xsl:when test="表:对齐格式/表:文字旋转角度 &lt; 0"><xsl:value-of select="360 - 表:对齐格式/表:文字旋转角度"/></xsl:when><xsl:otherwise><xsl:value-of select="表:对齐格式/表:文字旋转角度"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:rotation-align">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:对齐格式/表:文字方向 = 'vertical'">
+ <xsl:attribute name="style:direction">ttb</xsl:attribute>
+ <xsl:if test="not(表:对齐格式/字:水平对齐方式)">
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <!--xsl:if test="表:边框">
+ <xsl:apply-templates select="表:边框" />
+ </xsl:if-->
+ <!--chenjh add 边框 again-->
+ <xsl:if test="表:边框/uof:上/@uof:宽度 !=''">
+ <xsl:variable name="top-line-width" select="concat(表:边框/uof:上/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="top-line-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:上/@uof:类型='single'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:上/@uof:类型='double'">double</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="top-line-color" select="表:边框/uof:上/@uof:颜色"/>
+ <xsl:variable name="border-top" select="concat($top-line-width,' ',$top-line-tyle,' ',$top-line-color)"/>
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="$border-top"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:下/@uof:宽度 !=''">
+ <xsl:variable name="bottom-line-width" select="concat(表:边框/uof:下/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="bottom-line-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:下/@uof:类型='single'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:下/@uof:类型='double'">double</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="bottom-line-color" select="表:边框/uof:下/@uof:颜色"/>
+ <xsl:variable name="border-bottom" select="concat($bottom-line-width,' ',$bottom-line-tyle,' ',$bottom-line-color)"/>
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="$border-bottom"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:左/@uof:宽度 !=''">
+ <xsl:variable name="left-line-width" select="concat(表:边框/uof:左/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="left-line-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:左/@uof:类型='single'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:左/@uof:类型='double'">double</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="left-line-color" select="表:边框/uof:左/@uof:颜色"/>
+ <xsl:variable name="border-left" select="concat($left-line-width,' ',$left-line-tyle,' ',$left-line-color)"/>
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="$border-left"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:右/@uof:宽度 !=''">
+ <xsl:variable name="right-line-width" select="concat(表:边框/uof:右/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="right-line-tyle">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="right-line-color" select="表:边框/uof:右/@uof:颜色"/>
+ <xsl:variable name="border-right" select="concat($right-line-width,' ',$right-line-tyle,' ',$right-line-color)"/>
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="$border-right"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:对角线1/@uof:宽度 !=''">
+ <xsl:variable name="diagonal-lr-width" select="concat(表:边框/uof:对角线1/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="diagonal-lr-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'double'">double</xsl:when>
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="diagonal-lr-color" select="表:边框/uof:对角线1/@uof:颜色"/>
+ <xsl:variable name="border-diagonal" select="concat($diagonal-lr-width,' ',$diagonal-lr-tyle,' ',$diagonal-lr-color)"/>
+ <xsl:attribute name="style:diagonal-bl-tr"><xsl:value-of select="$border-diagonal"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/uof:对角线2/@uof:宽度 !=''">
+ <xsl:variable name="diagonal-rl-width" select="concat(表:边框/uof:对角线2/@uof:宽度,$uofUnit)"/>
+ <xsl:variable name="diagonal-rl-tyle">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="表:边框/uof:对角线1/@uof:类型 = 'double'">double</xsl:when>
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="diagonal-rl-color" select="表:边框/uof:对角线2/@uof:颜色"/>
+ <xsl:variable name="border-diagonal" select="concat($diagonal-rl-width,' ',$diagonal-rl-tyle,' ',$diagonal-rl-color)"/>
+ <xsl:attribute name="style:diagonal-tl-br"><xsl:value-of select="$border-diagonal"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:边框/*/@uof:阴影">
+ <xsl:choose>
+ <xsl:when test="表:边框/uof:下/@uof:阴影 and 表:边框/uof:右/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 0.18cm 0.18cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:边框/uof:下/@uof:阴影 and 表:边框/uof:左/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm 0.18cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:边框/uof:上/@uof:阴影 and 表:边框/uof:右/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 0.18cm -0.18cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:边框/uof:上/@uof:阴影 and 表:边框/uof:左/@uof:阴影">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm -0.18cm</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <!--边框 end -->
+ <xsl:if test="表:填充">
+ <xsl:choose>
+ <xsl:when test="表:填充/图:颜色">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="表:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="表:填充/图:图案/@图:前景色">
+ <xsl:variable name="pattern-value">
+ <xsl:call-template name="cell-pattern-color">
+ <xsl:with-param name="pattern" select="concat('0.',substring-after(表:填充/图:图案/图:背景色,'y'))"/>
+ <xsl:with-param name="color-value" select="表:填充/图:颜色"/>
+ <xsl:with-param name="pattern-color-value" select="表:填充/图:图案/图:背景色"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="$pattern-value"/></xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="表:字体格式/字:隐藏文字">
+ <xsl:choose>
+ <xsl:when test="表:字体格式/字:隐藏文字 = 'true'">
+ <xsl:attribute name="style:cell-protect">protected formula-hidden</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:cell-protect">none</xsl:attribute>
+ <xsl:attribute name="style:text-align-source">fix</xsl:attribute>
+ </xsl:element>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="表:对齐格式/表:水平对齐方式">
+ <xsl:variable name="text-align">
+ <xsl:choose>
+ <xsl:when test="表:对齐格式/表:水平对齐方式 = 'left'">start</xsl:when>
+ <xsl:when test="表:对齐格式/表:水平对齐方式 = 'center'">center</xsl:when>
+ <xsl:when test="表:对齐格式/表:水平对齐方式 = 'right'">end</xsl:when>
+ <xsl:when test="表:对齐格式/表:水平对齐方式 = 'justify'">justify</xsl:when>
+ <xsl:otherwise>start</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="表:字体格式/字:字体">
+ <xsl:choose>
+ <xsl:when test="(表:字体格式/字:字体/@字:中文字体引用)or (表:字体格式/字:字体/@字:西文字体引用)">
+ <xsl:variable name="fontnameZ" select="表:字体格式/字:字体/@字:中文字体引用"/>
+ <xsl:variable name="fontnameX" select="表:字体格式/字:字体/@字:西文字体引用"/>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:字体集/uof:字体声明">
+ <xsl:if test="(./@uof:标识符 = $fontnameZ)or(./@uof:标识符 = $fontnameX)">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="./@uof:名称"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="./@uof:名称"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-complex"><xsl:value-of select="./@uof:名称"/></xsl:attribute>
+ <xsl:attribute name="style:font-charset"><xsl:value-of select="./@uof:字体族"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Arial</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="表:字体格式/字:粗体/@字:值">
+ <xsl:attribute name="fo:font-weight"><xsl:choose><xsl:when test="表:字体格式/字:粗体/@字:值=1 or 表:字体格式/字:粗体/@字:值='true'">bold</xsl:when><xsl:when test="表:字体格式/字:粗体/@字:值=0 or 表:字体格式/字:粗体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian"><xsl:choose><xsl:when test="表:字体格式/字:粗体/@字:值=1 or 表:字体格式/字:粗体/@字:值='true'">bold</xsl:when><xsl:when test="表:字体格式/字:粗体/@字:值=0 or 表:字体格式/字:粗体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex"><xsl:choose><xsl:when test="表:字体格式/字:粗体/@字:值=1 or 表:字体格式/字:粗体/@字:值='true'">bold</xsl:when><xsl:when test="表:字体格式/字:粗体/@字:值=0 or 表:字体格式/字:粗体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:字体格式/字:斜体/@字:值">
+ <xsl:attribute name="fo:font-style"><xsl:choose><xsl:when test="表:字体格式/字:斜体/@字:值=1 or 表:字体格式/字:斜体/@字:值='true'">italic</xsl:when><xsl:when test="表:字体格式/字:斜体/@字:值=0 or 表:字体格式/字:斜体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-style-asian"><xsl:choose><xsl:when test="表:字体格式/字:斜体/@字:值=1 or 表:字体格式/字:斜体/@字:值='true'">italic</xsl:when><xsl:when test="表:字体格式/字:斜体/@字:值=0 or 表:字体格式/字:斜体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:font-style-complex"><xsl:choose><xsl:when test="表:字体格式/字:斜体/@字:值=1 or 表:字体格式/字:斜体/@字:值='true'">italic</xsl:when><xsl:when test="表:字体格式/字:斜体/@字:值=0 or 表:字体格式/字:斜体/@字:值='false'">normal</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="表:字体格式/字:字体/@字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="表:字体格式/字:字体/@字:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-window-font-color">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="表:字体格式/字:字体/@字:字号">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="concat( 表:字体格式/字:字体/@字:字号, 'pt')"/></xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="concat( 表:字体格式/字:字体/@字:字号, 'pt')"/></xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="concat( 表:字体格式/字:字体/@字:字号, 'pt')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:font-size">12pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">12pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">12pt</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="表:字体格式/字:浮雕">
+ <xsl:variable name="aa">
+ <xsl:value-of select="表:字体格式/字:浮雕/@字:类型"/>
+ </xsl:variable>
+ <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="$aa='emboss'">embossed</xsl:when><xsl:when test="$aa='engrave'">engraved</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:字体格式/字:阴影/@字:值 = '1' or 表:字体格式/字:阴影/@字:值 = 'true'">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:字体格式/字:删除线">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:字体格式/字:删除线/@字:类型='double'">
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格式/字:删除线/@字:类型='single'">
+ <xsl:attribute name="style:text-underline-mode">continuous</xsl:attribute>
+ <xsl:attribute name="style:text-line-through-mode">continuous</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格式/字:删除线/@字:类型='bold'">
+ <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格式/字:删除线/@字:类型='带/'">
+ <xsl:attribute name="style:text-line-through-text">/</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:字体格式/字:删除线/@字:类型='带X'">
+ <xsl:attribute name="style:text-line-through-text">X</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="表:字体格式/字:下划线">
+ <xsl:apply-templates select="表:字体格式/字:下划线"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="表:字体格式/字:着重号">
+ <xsl:apply-templates select="表:字体格式/字:着重号"/>
+ </xsl:if>
+ <xsl:if test="表:字体格式/字:空心/@字:值='true'">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="单元格具体式样">
+ <xsl:choose>
+ <xsl:when test="@表:类型 = 'Default'">
+ <xsl:element name="style:default-style">
+ <xsl:call-template name="style-style-content"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@表:标识符"/></xsl:attribute>
+ <xsl:if test="表:数字格式/@表:格式码 = 'general'">
+ <xsl:attribute name="style:parent-style-name">Default</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:parent-style-name">Default</xsl:attribute>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select="concat( @表:标识符, 'F')"/></xsl:attribute>
+ <!--chengxz这里要改 -->
+ <!--xsl:attribute name="style:data-style-name"><xsl:value-of select="'N2'"/></xsl:attribute-->
+ <xsl:call-template name="style-style-content"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="表:边框">
+ <!--chengxz 0622-->
+ <xsl:if test="not(uof:下)">
+ <xsl:attribute name="fo:border-bottom">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(uof:上)">
+ <xsl:attribute name="fo:border-top">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(uof:左)">
+ <xsl:attribute name="fo:border-left">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(uof:右)">
+ <xsl:attribute name="fo:border-right">none</xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="uof:对角线1"/>
+ <xsl:apply-templates select="uof:对角线2"/>
+ <xsl:apply-templates select="uof:上"/>
+ <xsl:apply-templates select="uof:下"/>
+ <xsl:apply-templates select="uof:左"/>
+ <xsl:apply-templates select="uof:右"/>
+ </xsl:template>
+ <xsl:template match="uof:上">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(@uof:宽度 div 30,$uofUnit, ' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-top">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:下">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(@uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ',@uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-bottom">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:左">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(@uof:宽度 div 30,$uofUnit, ' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-left">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:右">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:border-line-width-right">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:对角线1">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:diagonal-bl-tr"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:diagonal-bl-tr-width">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="uof:对角线2">
+ <xsl:variable name="bordtype">
+ <xsl:choose>
+ <xsl:when test="@uof:类型 = 'none'">none</xsl:when>
+ <xsl:when test="@uof:类型 = 'continuous'">solid</xsl:when>
+ <xsl:when test="@uof:类型 = 'double'">double</xsl:when>
+ <!-- Dash, Dot, DashDot, DashDotDot, SlantDashDot are not supported yet -->
+ <xsl:otherwise>solid</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:diagonal-tl-br"><xsl:value-of select="concat( @uof:宽度 div 30, $uofUnit,' ',$bordtype, ' ', @uof:颜色)"/></xsl:attribute>
+ <xsl:if test="@uof:类型 = 'double'">
+ <xsl:attribute name="style:diagonal-tl-br-width">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="表:字体格式">
+ <xsl:choose>
+ <xsl:when test="字:上下标/@字:上下标 = 'sup'">
+ <style:style style:name="{concat(../@表:标识符,'T0')}" style:family="text">
+ <style:text-properties style:text-position="33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="字:上下标/@字:上下标 = 'sub'">
+ <style:style style:name="{concat(../@表:标识符,'T0')}" style:family="text">
+ <style:text-properties style:text-position="-33% 58%"/>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="tablecolumngroup">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="prestart"/>
+ <xsl:param name="preend"/>
+ <xsl:param name="nextstart"/>
+ <xsl:param name="nextend"/>
+ <table:table-column-group>
+ <table:table-column>
+ <xsl:attribute name="table:style-name">co1</xsl:attribute>
+ <xsl:attribute name="table:table-column-repeated"><xsl:value-of select="@表:终止 - @表:起始 + 1"/></xsl:attribute>
+ </table:table-column>
+ <xsl:if test="$nextstart &gt;= $start and $nextend &lt;= $end">
+ <xsl:for-each select="following-sibling::表:列[1]">
+ <xsl:call-template name="tablecolumngroup"/>
+ </xsl:for-each>
+ </xsl:if>
+ </table:table-column-group>
+ </xsl:template>
+ <xsl:template match="表:工作表">
+ <xsl:variable name="rowpath" select="表:工作表内容/表:行"/>
+ <xsl:variable name="colpath" select="表:工作表内容/表:列"/>
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:name"><xsl:value-of select="@表:名称"/></xsl:attribute>
+ <xsl:if test="表:工作表内容">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat( 'ta', count(preceding-sibling::表:工作表)+1)"/></xsl:attribute>
+ <xsl:if test="(@表:隐藏 = '1')or(@表:隐藏 = 'true')">
+ <xsl:attribute name="table:protected">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:工作表内容/uof:锚点 or 表:工作表内容/表:图表">
+ <table:shapes>
+ <xsl:apply-templates select="表:工作表内容/uof:锚点"/>
+ <xsl:apply-templates select="表:工作表内容/表:图表">
+ <xsl:with-param name="table-name" select="@表:名称"/>
+ </xsl:apply-templates>
+ </table:shapes>
+ </xsl:if>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::表:工作表)+1"/>
+ </xsl:variable>
+ <xsl:if test="表:工作表内容/表:分组集/表:列">
+ <xsl:for-each select="表:工作表内容/表:分组集/表:列">
+ <xsl:variable name="start" select="@表:起始"/>
+ <xsl:variable name="end" select="@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:列/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:列/@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:列/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:列/@表:终止"/>
+ <xsl:call-template name="tablecolumngroup">
+ <xsl:with-param name="start" select="$start"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="表:工作表内容/表:列">
+ <table:table-column>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute>
+ <xsl:if test="@表:跨度 and not(@表:跨度='1')">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="@表:跨度"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:隐藏">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ </table:table-column>
+ </xsl:for-each>
+ <xsl:variable name="condition-pos-str1">
+ <xsl:if test="../../表:公用处理规则/表:条件格式化集/表:条件格式化">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(../../表:公用处理规则/表:条件格式化集/表:条件格式化)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str2">
+ <xsl:if test="../../表:公用处理规则/表:数据有效性集/表:数据有效性">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="''"/>
+ <xsl:with-param name="total" select="count(../../表:公用处理规则/表:数据有效性集/表:数据有效性)"/>
+ <xsl:with-param name="index" select="1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="condition-pos-str" select="concat($condition-pos-str1, $condition-pos-str2)"/>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行">
+ <xsl:call-template name="create-rows">
+ <xsl:with-param name="lastrowpos" select="0"/>
+ <xsl:with-param name="row-count" select="count(表:工作表内容/表:行)"/>
+ <xsl:with-param name="currentRow" select="1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="tableHasStyle">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容[@表:式样引用]">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符[@表:行号]">
+ <xsl:for-each select="./表:分页符集/表:分页符[@表:行号]">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./@表:行号"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@表:行号 - preceding::表:分页符[@表:行号 and (position()=count(.))]/@表:行号 - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-row">
+ <xsl:if test="($rowpath/@表:隐藏 = '1') or ($rowpath/@表:隐藏 = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$table-pos)"/></xsl:attribute>
+ <xsl:attribute name="table:number-rows-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$tableHasStyle = 1">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-row">
+ <xsl:if test="($colpath/@表:隐藏 = '1') or ($colpath/@表:隐藏 = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$table-pos)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$tableHasStyle = 1">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="表:工作表内容/@表:式样引用">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="表:工作表内容/@表:式样引用"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:text>ro1</xsl:text></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="table:table-cell"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="../../表:公用处理规则/表:条件格式化集/表:条件格式化">
+ <xsl:variable name="condition-row-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'R'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-col-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="break-row-max">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="1"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="count-value" select="count(./表:分页符集/表:分页符[@表:行号])"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$condition-row-max &lt; $break-row-max">
+ <xsl:value-of select="$break-row-max"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$condition-row-max"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="1"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-value"/>
+ <xsl:with-param name="total-col" select="$condition-col-max"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="./表:工作表内容/@表:式样引用">
+ <table:table-row table:style-name="ro1" table:number-rows-repeated="32000">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="表:图表">
+ <table:shapes>
+ <xsl:apply-templates select="表:图表">
+ <xsl:with-param name="table-name" select="@表:名称"/>
+ </xsl:apply-templates>
+ </table:shapes>
+ </xsl:if>
+ </xsl:template>
+ <!--xsl:template name="create-columns-without-input"></xsl:template>
+ <xsl:template name="create-columns"></xsl:template>
+ <xsl:template name="condition-row-column-string"></xsl:template>
+<xsl:template name="validation-row-column-string"></xsl:template>
+<xsl:template name="create-rows"></xsl:template>
+<xsl:template name="condition-row-col-pos-max"></xsl:template>
+<xsl:template name="get-row-beyond-last"></xsl:template-->
+ <!--xsl:template name="break-row-beyond-max"></xsl:template-->
+ <!-- chengxz有问题-->
+ <xsl:template name="create-columns-without-input">
+ <xsl:param name="table-pos"/>
+ <xsl:variable name="rowpath" select="表:工作表内容/表:行"/>
+ <xsl:variable name="colpath" select="表:工作表内容/表:列"/>
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符[@表:列号]">
+ <xsl:for-each select="./表:分页符集/表:分页符[@表:列号]">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="position() = 1">
+ <xsl:value-of select="./@表:列号"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./@表:列号 - preceding::表:分页符[@表:列号 and (position()=count(.))]/@表:列号 - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:if test="ancestor::表:工作表/表:工作表内容/@表:式样引用">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="ancestor::表:工作表/表:工作表内容/@表:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="($colpath/@表:隐藏 = '1') or ($colpath/@表:隐藏 = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co',$table-pos)"/></xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <xsl:if test="ancestor::表:工作表/表:工作表内容/@表:式样引用">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="ancestor::表:工作表/表:工作表内容/@表:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="($colpath/@表:隐藏 = '1') or ($colpath/@表:隐藏 = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$table-pos)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:choose>
+ <xsl:when test="表:工作表内容/@表:式样引用">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="表:工作表内容/@表:式样引用"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:text>co1</xsl:text></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="表:工作表内容/@表:最大列 and 表:工作表内容/@表:最大列 > 0">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="表:工作表内容/@表:最大列"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:default-cell-style-name"><xsl:text>Default</xsl:text></xsl:attribute>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-columns">
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentColumn" select="1"/>
+ <xsl:param name="finishedColumns" select="0"/>
+ <xsl:param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$finishedColumns &lt; $columnCount">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@表:列号 - $finishedColumns &gt; 1">
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table-column">
+ <xsl:if test="($currentColumnNode/@表:隐藏 = '1') or ($currentColumnNode/@表:隐藏 = 'true')">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$currentColumnNode/@表:跨度">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$currentColumnNode/@表:跨度 + 1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob', $worksheetNo, '-', $currentColumn)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co', $worksheetNo, '-', $currentColumn)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn + 1"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="currentColumnNode" select="表:工作表属性/表:列[$currentColumn + 1]"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-default-column">
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="currentColumnNode" select="$currentColumnNode"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ <xsl:call-template name="create-columns">
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentColumn" select="$currentColumn"/>
+ <xsl:with-param name="finishedColumns" select="$finishedColumns + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$currentColumn = $columnCount">
+ <xsl:if test="表:分页符集/表:分页符/@表:列号 &gt; $finishedColumns">
+ <xsl:call-template name="get-column-beyond-last">
+ <xsl:with-param name="index-value" select="$finishedColumns"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-column-beyond-last">
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:for-each select="表:分页符集/表:分页符[@表:列号]">
+ <xsl:variable name="each-column-value" select="@表:列号"/>
+ <xsl:choose>
+ <xsl:when test="$each-column-value + 1 &gt; $index-value">
+ <xsl:variable name="number-repeated">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::表:分页符[@表:列号][position()=count(.)]/@表:列号 + 1 = $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::表:分页符[@表:列号 and (position()=count(.))]/@表:列号 - 1"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::表:分页符[@表:列号 and (position()=count(.))]/@表:列号 + 1 &gt; $index-value">
+ <xsl:value-of select="$each-column-value - preceding-sibling::表:分页符[@表:列号][position()=count(.)]/@表:列号 - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$each-column-value - $index-value + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$number-repeated &gt; 0">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="'co1'"/></xsl:attribute>
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$number-repeated"/></xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="table:table-column">
+ <xsl:if test="../../表:工作表内容[@表:式样引用]">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="./表:工作表内容/@表:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$each-column-value + 1 = $index-value">
+ <xsl:element name="table:table-column">
+ <xsl:if test="/../../表:工作表内容[@表:式样引用]">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:value-of select="./../../表:工作表内容/@表:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="condition-row-column-string">
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="../../表:公用处理规则/表:条件格式化集/表:条件格式化[position() = $index]/表:范围"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(c',$table-pos,'-',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="condition-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="validation-row-column-string">
+ <xsl:param name="last"/>
+ <xsl:param name="total"/>
+ <xsl:param name="index"/>
+ <xsl:variable name="table-pos" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="../../表:公用处理规则/表:数据有效性集/表:数据有效性[position() = $index]/表:范围"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="current-value" select="concat('(v',$index,':', $current,');')"/>
+ <xsl:if test="$index &lt; $total">
+ <xsl:call-template name="validation-row-column-string">
+ <xsl:with-param name="last" select="concat($last, $current-value)"/>
+ <xsl:with-param name="total" select="$total"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$index = $total">
+ <xsl:value-of select="concat($last, $current-value)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-rows">
+ <xsl:param name="lastrowpos"/>
+ <xsl:param name="row-count"/>
+ <xsl:param name="currentRow"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:choose>
+ <xsl:when test="$currentRow &lt; ($row-count + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 - $lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 - $lastrowpos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号">
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:分组集/表:行">
+ <xsl:for-each select="./表:工作表内容/表:分组集/表:行[1]">
+ <xsl:call-template name="table:table-row-group"/>
+ </xsl:for-each>
+ <xsl:for-each select="./表:工作表内容/表:行[not(@表:行号)]">
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$lastrowpos"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="row-value" select="$currentRow"/>
+ <xsl:with-param name="times" select="1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="./表:工作表内容/表:分组集 and ( ./表:工作表内容/表:分组集/表:行/@表:起始 &gt;= ($currentRow - 1) and ($currentRow - 1) &lt;= ./表:工作表内容/表:分组集/表:行/@表:终止 )">
+ <xsl:element name="table:table-row-group">
+ <xsl:variable name="TempStart">
+ <xsl:value-of select="./表:工作表内容/表:分组集/表:行/@表:起始"/>
+ </xsl:variable>
+ <xsl:variable name="TempEnd">
+ <xsl:value-of select="./表:工作表内容/表:分组集/表:行/@表:终止"/>
+ </xsl:variable>
+ <xsl:for-each select="./表:工作表内容/表:行">
+ <xsl:if test="$TempStart &gt;= ($currentRow - 1) and ($currentRow - 1) &lt;= $TempEnd">
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$lastrowpos"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="row-value" select="$currentRow"/>
+ <xsl:with-param name="times" select="1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$lastrowpos"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="row-value" select="$currentRow"/>
+ <xsl:with-param name="times" select="1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ <xsl:if test="$currentRow &lt; $row-count">
+ <xsl:call-template name="create-rows">
+ <xsl:with-param name="lastrowpos">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="$lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="row-count" select="$row-count"/>
+ <xsl:with-param name="currentRow" select="$currentRow + 1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$currentRow = $row-count">
+ <xsl:variable name="last-pos">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:行号">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号 + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:工作表内容/表:行[position() = $currentRow]/@表:行号"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="$lastrowpos + ./表:工作表内容/表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="./表:分页符集/表:分页符/@表:行号 &gt; ($last-pos - 1) or ../../表:公用处理规则/表:条件格式化集/表:条件格式化">
+ <xsl:variable name="condition-row-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'R'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="condition-col-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="break-row-max">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="1"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="count-value" select="count(./表:分页符集/表:分页符[@表:行号])"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$condition-row-max &lt; $break-row-max">
+ <xsl:value-of select="$break-row-max"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$condition-row-max"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="$last-pos + 1"/>
+ <xsl:with-param name="worksheetNo" select="count(preceding-sibling::表:工作表)+1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-value"/>
+ <xsl:with-param name="total-col" select="$condition-col-max"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="./表:工作表内容/表:列[@表:式样引用] or ./表:工作表内容[@表:式样引用]">
+ <table:table-row table:style-name="ro1" table:number-rows-repeated="31990">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro1">
+ <table:table-cell table:number-columns-repeated="256"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <!-- add row-group 2.6-->
+ <xsl:template name="table:table-row-group">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:variable name="start1" select="@表:起始"/>
+ <xsl:variable name="end1" select="@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/>
+ <xsl:variable name="numrow" select="$end1 - $start1"/>
+ <xsl:variable name="position" select="position()"/>
+ <xsl:choose>
+ <xsl:when test="$nextstart &gt;= $start1 and $nextend &lt;= $end1">
+ <table:table-row-group>
+ <xsl:call-template name="creategroup"/>
+ </table:table-row-group>
+ </xsl:when>
+ <xsl:when test="$nextstart &gt;= $end1">
+ <xsl:choose>
+ <xsl:when test="$nextend &lt;=$preend">
+ <xsl:call-template name="row">
+ <xsl:with-param name="start1" select="$start1"/>
+ <xsl:with-param name="end1" select="$end1"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="levelgroup"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="row">
+ <xsl:with-param name="start1" select="$start1"/>
+ <xsl:with-param name="end1" select="$end1"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="levelrowgroup">
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:variable name="start1" select="@表:起始"/>
+ <xsl:variable name="end1" select="@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/>
+ <xsl:variable name="numrow" select="$end1 - $start1"/>
+ <xsl:variable name="position" select="position()"/>
+ <xsl:call-template name="row">
+ <xsl:with-param name="start1" select="$start1"/>
+ <xsl:with-param name="end1" select="$end1"/>
+ <xsl:with-param name="nextstart" select="$nextstart"/>
+ <xsl:with-param name="nextend" select="$nextend"/>
+ <xsl:with-param name="prestart" select="$prestart"/>
+ <xsl:with-param name="preend" select="$preend"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="creategroup">
+ <xsl:for-each select="following-sibling::表:行">
+ <xsl:variable name="start1" select="@表:起始"/>
+ <xsl:variable name="end1" select="@表:终止"/>
+ <xsl:variable name="nextstart" select="following-sibling::表:行/@表:起始"/>
+ <xsl:variable name="nextend" select="following-sibling::表:行/@表:终止"/>
+ <xsl:variable name="prestart" select="preceding-sibling::表:行/@表:起始"/>
+ <xsl:variable name="preend" select="preceding-sibling::表:行/@表:终止"/>
+ <xsl:if test="$start1 &gt;= $prestart and $end1 &lt;= $preend">
+ <xsl:call-template name="table:table-row-group"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="levelgroup">
+ <xsl:for-each select="parent::表:分组集/表:行">
+ <xsl:call-template name="levelrowgroup"/>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="row">
+ <xsl:param name="start1"/>
+ <xsl:param name="end1"/>
+ <xsl:param name="nextstart"/>
+ <xsl:param name="nextend"/>
+ <xsl:param name="prestart"/>
+ <xsl:param name="preend"/>
+ <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]">
+ <xsl:variable name="rownum" select="@表:行号"/>
+ <xsl:variable name="aa" select="$start1 - $prestart"/>
+ <xsl:if test="$rownum &gt;= $prestart and $rownum &lt;= ($prestart + $aa - 1) and $start1 &lt;= $preend">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]">
+ <xsl:variable name="rownum" select="@表:行号"/>
+ <xsl:variable name="ss" select="$start1 - $preend"/>
+ <xsl:if test="$rownum &gt;= ($preend +1) and $rownum &lt;= ($preend + $ss - 1) and $start1 &gt;= $preend">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:for-each>
+ <table:table-row-group>
+ <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]">
+ <xsl:variable name="rownum" select="@表:行号"/>
+ <xsl:if test="$rownum &lt;= $end1">
+ <xsl:if test="$rownum &gt;= $start1">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </table:table-row-group>
+ <xsl:for-each select="ancestor::表:工作表内容/表:行[@表:行号]">
+ <xsl:variable name="rownum" select="@表:行号"/>
+ <xsl:variable name="bb" select="$preend - $end1"/>
+ <xsl:if test="$rownum &gt;= ($end1 + 1) and $rownum &lt;= ($end1 + $bb) and $start1 &lt; $preend">
+ <table:table-row>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="@表:式样引用"/></xsl:attribute>
+ <xsl:call-template name="celldata"/>
+ </table:table-row>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="celldata">
+ <xsl:for-each select="./表:单元格">
+ <table:table-cell>
+ <xsl:choose>
+ <xsl:when test="表:数据/@表:数据类型 = 'number'">
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="表:数据/@表:数据数值"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:when><xsl:otherwise><xsl:value-of select="表:数据/字:句/字:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'date'">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="table:date-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'time'">
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="table:time-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="table:boolean-value"><xsl:choose><xsl:when test="表:数据/字:句/字:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'text'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ <xsl:attribute name="table:string-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="表:数据/字:句/字:文本串">
+ <text:p>
+ <xsl:value-of select="表:数据/字:句/字:文本串"/>
+ </text:p>
+ </xsl:if>
+ </table:table-cell>
+ </xsl:for-each>
+ </xsl:template>
+ <!-- add row-group 2.8 -->
+ <xsl:template name="create-row">
+ <xsl:param name="index-value"/>
+ <xsl:param name="span-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="row-value"/>
+ <xsl:param name="times"/>
+ <xsl:param name="current-index"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符/@表:行号 = ($index-value + $times - 1)">
+ <xsl:choose>
+ <xsl:when test="($index-value + $times &lt; $current-index) and ($current-index != 0)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob', $worksheetNo, '-', $row-value)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="($index-value + $times &lt; $current-index) and ($current-index != 0)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro', $worksheetNo, '-', $row-value)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--chengxiuzhi0617-->
+ <xsl:if test="./表:工作表内容/表:行[position() = $row-value]/@表:隐藏 = 'true'">
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容/表:行[position() = $row-value]/@表:跨度">
+ <xsl:if test="$index-value + $times &gt; ($current-index - 1)">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$index-value + $times = $current-index">
+ <xsl:attribute name="table:visibility">collapse</xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(./表:工作表内容/表:行[position() = $row-value]/*)">
+ <table:table-cell>
+ <xsl:for-each select="./表:单元格/表:数据">
+ <xsl:choose>
+ <xsl:when test="@表:数据类型 = 'number'">
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="@表:数据数值"><xsl:value-of select="@表:数据数值"/></xsl:when><xsl:otherwise><xsl:value-of select="字:句/字:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:数据类型 = 'date'">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="table:date-value"><xsl:value-of select="@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:数据类型 = 'time'">
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="table:time-value"><xsl:value-of select="@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:数据类型 = 'boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="table:boolean-value"><xsl:choose><xsl:when test="字:句/字:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:数据类型 = 'text'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ <xsl:attribute name="table:string-value"><xsl:value-of select="@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="字:句/字:文本串">
+ <text:p>
+ <xsl:value-of select="字:句/字:文本串"/>
+ </text:p>
+ </xsl:if>
+ </xsl:for-each>
+ </table:table-cell>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$index-value + $times &lt; $current-index">
+ <xsl:variable name="current" select="concat('R',($index-value + $times),'C')"/>
+ <xsl:variable name="col-pos-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$index-value + $times"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end" select="$col-pos-max"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$index-value + $times = $current-index">
+ <xsl:apply-templates select="表:工作表内容/表:行[position() = $row-value]" mode="selected">
+ <xsl:with-param name="row-pos" select="$index-value + $times"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$times &lt; $span-value">
+ <xsl:call-template name="create-row">
+ <xsl:with-param name="index-value" select="$index-value"/>
+ <xsl:with-param name="span-value" select="$span-value"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="row-value" select="$row-value"/>
+ <xsl:with-param name="times" select="$times + 1"/>
+ <xsl:with-param name="current-index" select="$current-index"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-row-col-pos-max">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="div-value"/>
+ <xsl:variable name="pre-value">
+ <xsl:choose>
+ <xsl:when test="$div-value = 'R'">
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),'C')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring-after($condition-pos-str,$div-value),',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$div-value)">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="substring-after($condition-pos-str,$div-value)"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="div-value" select="$div-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="break-row-beyond-max">
+ <xsl:param name="pos"/>
+ <xsl:param name="last-value"/>
+ <xsl:param name="count-value"/>
+ <xsl:variable name="pre-value" select="./表:分页符集/表:分页符[@表:列号 and (position() = $pos)]/@表:列号"/>
+ <xsl:variable name="end-value">
+ <xsl:choose>
+ <xsl:when test="$last-value &lt; $pre-value">
+ <xsl:value-of select="$pre-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$last-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$pos &lt; $count-value">
+ <xsl:call-template name="break-row-beyond-max">
+ <xsl:with-param name="pos" select="$pos + 1"/>
+ <xsl:with-param name="last-value" select="$end-value"/>
+ <xsl:with-param name="count-value" select="$count-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$end-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-row-beyond-last">
+ <xsl:param name="index-value"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="end-pos"/>
+ <xsl:param name="total-col"/>
+ <xsl:variable name="current" select="concat('R',$index-value)"/>
+ <xsl:element name="table:table-row">
+ <xsl:choose>
+ <xsl:when test="./表:分页符集/表:分页符/@行号 = ($index-value - 1)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('rob',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('ro',$worksheetNo)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$index-value"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end" select="$total-col"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:if test="$index-value &lt; ($end-pos + 1)">
+ <xsl:call-template name="get-row-beyond-last">
+ <xsl:with-param name="index-value" select="$index-value + 1"/>
+ <xsl:with-param name="worksheetNo" select="$worksheetNo"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="end-pos" select="$end-pos"/>
+ <xsl:with-param name="total-col" select="$total-col"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-cell-span-in">
+ <xsl:param name="row-pos"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:variable name="current" select="concat('R',$row-pos,'C',$c-start,',')"/>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="../表:单元格[position() = position() - 1]/@表:式样引用">
+ <xsl:value-of select="../表:单元格[position() = position() - 1]/@表:式样引用 "/>
+ </xsl:when>
+ <xsl:when test="../@表:式样引用">
+ <xsl:value-of select="../@表:式样引用"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'Default'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$c-start &lt; $c-end">
+ <xsl:call-template name="get-cell-condition-in">
+ <xsl:with-param name="style-name" select="$style-name"/>
+ </xsl:call-template>
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$c-start + 1"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$c-start = $c-end">
+ <xsl:call-template name="get-cell-condition-in">
+ <xsl:with-param name="style-name" select="$style-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-cell-condition-in">
+ <xsl:param name="style-name"/>
+ <xsl:element name="table:table-cell">
+ <xsl:if test="not( contains($style-name, 'Default'))">
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="starts-with($style-name, 'ce')">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!--chengxiuzhi0617 单元格-->
+ </xsl:element>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:分页符集/表:分页符[@表:列号]" name="ColBreak" use="Column"/>
+ <xsl:template name="create-default-column">
+ <xsl:param name="currentColumn"/>
+ <xsl:param name="currentColumnNode"/>
+ <xsl:param name="worksheetNo"/>
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:default-cell-style-name"><xsl:call-template name="get-default-cell-style"><xsl:with-param name="currentColumnNode" select="$currentColumnNode"/></xsl:call-template></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="key('ColBreak', $currentColumn)">
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('cob',$worksheetNo)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('co',$worksheetNo)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--chengxiuzhi0617用key就错-->
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="get-default-cell-style">
+ <xsl:param name="currentColumnNode"/>
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode">
+ <xsl:choose>
+ <xsl:when test="$currentColumnNode/@表:式样引用">
+ <xsl:value-of select="$currentColumnNode/@表:式样引用"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:工作表内容[@表:式样引用]">
+ <xsl:value-of select="./表:工作表内容/@表:式样引用"/>
+ </xsl:when>
+ <xsl:otherwise>Default</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="表:行" mode="selected">
+ <xsl:param name="row-pos"/>
+ <xsl:param name="condition-pos-str"/>
+ <xsl:choose>
+ <xsl:when test="表:单元格">
+ <xsl:apply-templates select="表:单元格[1]" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="col-pos-before" select="0"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="current" select="concat('R',$row-pos,'C')"/>
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str,$current)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="1"/>
+ <xsl:with-param name="c-end">
+ <xsl:call-template name="condition-row-col-pos-max">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="last-value" select="0"/>
+ <xsl:with-param name="div-value" select="'C'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos" select="1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="表:单元格" mode="selected">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-before"/>
+ <xsl:param name="row-pos"/>
+ <xsl:param name="col-repeated" select="1"/>
+ <xsl:variable name="col-pos">
+ <xsl:choose>
+ <xsl:when test="@表:列号">
+ <xsl:choose>
+ <xsl:when test="@表:合并列数">
+ <xsl:value-of select="@表:合并列数 + @表:列号"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@表:列号"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@表:合并列数">
+ <xsl:value-of select="1 + @表:合并列数 + $col-pos-before"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="1 + $col-pos-before"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="next-cell" select="following-sibling::表:单元格[1]"/>
+ <xsl:variable name="maodian" select="boolean($next-cell/uof:锚点)"/>
+ <xsl:variable name="cell-is-repeatable" select="not(current()/*) and not($next-cell/*) and not($next-cell/text()) and (@表:式样引用 = $next-cell/@表:式样引用) and not($next-cell/@表:列号)"/>
+ <xsl:if test="$col-repeated = 1">
+ <xsl:if test="@表:列号 != ($col-pos-before + 1)">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos-before + 1"/>
+ <xsl:with-param name="c-end" select="@表:列号 - 1"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:element name="table:table-cell">
+ <xsl:call-template name="create-table-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ <xsl:if test="$cell-is-repeatable">
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos + 1"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated + 1"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:call-template name="create-table-cell-content">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos" select="$col-pos"/>
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:if test="@表:合并列数">
+ <xsl:element name="table:covered-table-cell">
+ <xsl:if test="@表:合并列数 &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="@表:合并列数"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not($cell-is-repeatable and $col-repeated = 1)">
+ <xsl:choose>
+ <xsl:when test="not($cell-is-repeatable) and $col-repeated &gt; 1">
+ <xsl:attribute name="table:number-columns-repeated"><xsl:value-of select="$col-repeated"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not($next-cell)">
+ <xsl:if test="../../../../../表:公用处理规则/表:条件格式化集/表:条件格式化">
+ <xsl:call-template name="get-cell-span-in">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="c-start" select="$col-pos"/>
+ <xsl:with-param name="c-end" select="$col-pos-max"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="not($cell-is-repeatable)">
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos"/>
+ <xsl:with-param name="col-repeated" select="$col-repeated + 1"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$next-cell">
+ <xsl:apply-templates select="$next-cell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment liliang sc0012 06.02.15-->
+ <!--新增内容-->
+ <xsl:template match="uof:锚点">
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='ipg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::uof:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:element name="draw:image">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符= $tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据">
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"/>
+ </office:binary-data>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:文本内容[@图:文本框='true']">
+ <draw:text-box text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="@uof:x坐标">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:y坐标">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="/uof:UOF/uof:对象集/图:图形/@图:层次"/></xsl:attribute>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:段落"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]"/>
+ <xsl:with-param name="groupx" select="0"/>
+ <xsl:with-param name="groupy" select="0"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="graph">
+ <xsl:param name="id"/>
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:for-each select="$id">
+ <xsl:variable name="tuxing1">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$tuxing1='11'">
+ <xsl:call-template name="Rectangle">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='19'">
+ <xsl:call-template name="Oval">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='61'">
+ <xsl:call-template name="Line">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='64'">
+ <xsl:call-template name="Curve">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='65'">
+ <xsl:call-template name="Freeform">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='66'">
+ <xsl:call-template name="Scribble">
+ <xsl:with-param name="groupx1" select="$groupx"/>
+ <xsl:with-param name="groupy1" select="$groupy"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$tuxing1='4'">
+ <xsl:element name="draw:g">
+ <xsl:variable name="tu">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tu"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:variable name="this-group-x">
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:x坐标">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:x坐标"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(0)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="this-group-y">
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:y坐标">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/@uof:y坐标"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(0)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="group-x">
+ <xsl:value-of select="number($groupx + $this-group-x)"/>
+ </xsl:variable>
+ <xsl:variable name="group-y">
+ <xsl:value-of select="number($groupy + $this-group-y)"/>
+ </xsl:variable>
+ <xsl:call-template name="组合图形">
+ <xsl:with-param name="zuheliebiao" select="@图:组合列表"/>
+ <xsl:with-param name="groupx1" select="$group-x"/>
+ <xsl:with-param name="groupy1" select="$group-y"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="common">
+ <xsl:param name="groupx"/>
+ <xsl:param name="groupy"/>
+ <xsl:variable name="tuxing">
+ <xsl:value-of select="@图:标识符"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)/@uof:x坐标">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:if test="@uof:x坐标">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:y坐标">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="tuxing1" select="@uof:图形引用"/>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@uof:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组合位置/@图:x坐标"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组合位置/@图:y坐标"/>
+ </xsl:variable>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(($groupx + $zuheweizhi-x),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(($groupy + $zuheweizhi-y),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(图:预定义图形/图:属性 /图:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="组合图形">
+ <xsl:param name="zuheliebiao"/>
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:variable name="x">
+ <xsl:value-of select="$groupx1"/>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:value-of select="$groupy1"/>
+ </xsl:variable>
+ <xsl:variable name="first-pictures">
+ <xsl:value-of select="substring-before($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:variable name="other-pictures">
+ <xsl:value-of select="substring-after($zuheliebiao,',')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-pictures,',')">
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="组合图形">
+ <xsl:with-param name="zuheliebiao" select="$other-pictures"/>
+ <xsl:with-param name="groupx1" select="$x"/>
+ <xsl:with-param name="groupy1" select="$y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $first-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ <xsl:call-template name="graph">
+ <xsl:with-param name="id" select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $other-pictures]"/>
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Curve">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:path">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点坐标/@图:路径"/></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Freeform">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polygon">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Scribble">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:polyline">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="图:预定义图形/图:关键点坐标/@图:路径"/><xsl:with-param name="value"/></xsl:call-template></xsl:attribute>
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="drawpoints">
+ <xsl:param name="points"/>
+ <xsl:param name="value"/>
+ <xsl:variable name="frist-piont">
+ <xsl:value-of select="substring-before($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:variable name="other-points">
+ <xsl:value-of select="substring-after($points,'lineto')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($other-points,'lineto')">
+ <xsl:variable name="x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="all-points">
+ <xsl:value-of select="concat($value,$x-coor,',',$y-coor,' ')"/>
+ </xsl:variable>
+ <xsl:call-template name="drawpoints">
+ <xsl:with-param name="points" select="$other-points"/>
+ <xsl:with-param name="value" select="$all-points"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="q-x-coor">
+ <xsl:value-of select="substring-before($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="q-y-coor">
+ <xsl:value-of select="substring-after($frist-piont,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-x-coor">
+ <xsl:value-of select="substring-before($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:variable name="e-y-coor">
+ <xsl:value-of select="substring-after($other-points,' ') * 1000"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($value,$q-x-coor,',',$q-y-coor,' ',$e-x-coor,',',$e-y-coor)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Oval">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:ellipse">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Rectangle">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:rect">
+ <xsl:call-template name="common">
+ <xsl:with-param name="groupx" select="$groupx1"/>
+ <xsl:with-param name="groupy" select="$groupy1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Line">
+ <xsl:param name="groupx1"/>
+ <xsl:param name="groupy1"/>
+ <xsl:element name="draw:line">
+ <xsl:variable name="tuxing1" select="@图:标识符"/>
+ <xsl:choose>
+ <xsl:when test="key('rel_graphic_name',@图:标识符)">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)">
+ <xsl:attribute name="svg:x1"><xsl:value-of select="concat(@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="concat(@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat((number(@uof:x坐标) + number(@uof:宽度)),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat((number(@uof:y坐标) + number(@uof:高度)),$uofUnit)"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zuheweizhi-x">
+ <xsl:value-of select="图:组合位置/@图:x坐标"/>
+ </xsl:variable>
+ <xsl:variable name="zuheweizhi-y">
+ <xsl:value-of select="图:组合位置/@图:y坐标"/>
+ </xsl:variable>
+ <xsl:variable name="hex">
+ <xsl:value-of select="concat(number($groupx1 + $zuheweizhi-x),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:variable name="hey">
+ <xsl:value-of select="concat(number($groupy1 + $zuheweizhi-y),$uofUnit)"/>
+ </xsl:variable>
+ <xsl:attribute name="svg:x1"><xsl:value-of select="$hex"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="$hey"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat(($hex + 图:预定义图形/图:属性/图:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat(($hey + 图:预定义图形/图:属性/图:高度),$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="rotate-angle">
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.02.15-->
+ <xsl:template match="表:单元格" mode="skip">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos-before"/>
+ <xsl:param name="row-pos"/>
+ <xsl:variable name="next-cell" select="following-sibling::表:单元格[1]"/>
+ <xsl:variable name="cell-is-repeatable" select="not($next-cell/*) and not($next-cell/text()) and (@表:式样引用 = $next-cell/@表:式样引用) and not($next-cell/@表:列号)"/>
+ <xsl:choose>
+ <xsl:when test="$cell-is-repeatable">
+ <xsl:apply-templates select="$next-cell" mode="skip">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos-before + 1"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$next-cell">
+ <xsl:apply-templates select="$next-cell" mode="selected">
+ <xsl:with-param name="row-pos" select="$row-pos"/>
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="col-pos-max" select="$col-pos-max"/>
+ <xsl:with-param name="col-pos-before" select="$col-pos-before +1"/>
+ </xsl:apply-templates>
+ <!--chengxz0925 no otherwise ,some content cells missed -->
+ </xsl:if>
+ <!--chengxz 060418 add if sentence-->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--xsl:template name="create-table-cell-attributes"></xsl:template>
+<xsl:template name="create-table-cell-content"></xsl:template>
+<xsl:template name="create-data-content"></xsl:template>
+<xsl:template name="get-condition-dependent-cell-attributes"></xsl:template-->
+ <xsl:template name="create-table-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+ <xsl:choose>
+ <xsl:when test="$condition-pos-str">
+ <xsl:call-template name="get-condition-dependent-cell-attributes">
+ <xsl:with-param name="condition-pos-str" select="$condition-pos-str"/>
+ <xsl:with-param name="current-pos-str" select="concat('R',$row-pos,'C',$col-pos,',')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:choose><xsl:when test="@表:式样引用"><xsl:value-of select="@表:式样引用"/></xsl:when><xsl:when test="../@表:式样引用 and ../@表:式样引用 != ''"><xsl:value-of select="../@表:式样引用"/></xsl:when><xsl:otherwise><xsl:value-of select="'Default'"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <!--chengxiuzhi-->
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@表:合并列数 or @表:合并行数">
+ <xsl:choose>
+ <xsl:when test="@表:合并列数">
+ <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="@表:合并列数 + 1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-columns-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@表:合并行数">
+ <xsl:attribute name="table:number-rows-spanned"><xsl:value-of select="@表:合并行数+1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:number-rows-spanned">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="表:数据">
+ <xsl:if test="表:数据/表:公式">
+ <xsl:variable name="calc-formula">
+ <xsl:call-template name="translate-expression">
+ <xsl:with-param name="cell-row-pos" select="$row-pos"/>
+ <xsl:with-param name="cell-column-pos" select="$col-pos"/>
+ <xsl:with-param name="expression" select="表:数据/表:公式"/>
+ <xsl:with-param name="return-value" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="table:formula"><xsl:value-of select="$calc-formula"/></xsl:attribute>
+ </xsl:if>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-17 Based on Original-->
+ <xsl:variable name="table-stylename" select="@表:式样引用"/>
+ <xsl:variable name="data-format">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:单元格式样">
+ <xsl:if test="$table-stylename = ./@ 表:标识符">
+ <xsl:value-of select="表:数字格式/@表:分类名称"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="data-formatcode">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:单元格式样">
+ <xsl:if test="$table-stylename= ./@表:标识符">
+ <xsl:value-of select="表:数字格式/@表:格式码"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="表:数据/@表:数据类型 = 'number'">
+ <xsl:choose>
+ <xsl:when test="$data-format = 'percentage' or contains( $data-formatcode, '%')">
+ <xsl:attribute name="office:value-type">percentage</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($data-format, 'currency')">
+ <xsl:attribute name="office:value-type">currency</xsl:attribute>
+ <xsl:attribute name="office:currency">CNY</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="office:value-type">float</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="表:数据/@表:数据数值"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:when><xsl:otherwise><xsl:value-of select="表:数据/字:句/字:文本串"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'date'">
+ <xsl:attribute name="office:value-type">date</xsl:attribute>
+ <xsl:attribute name="office:date-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'time'">
+ <xsl:attribute name="office:value-type">time</xsl:attribute>
+ <xsl:attribute name="office:time-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'boolean'">
+ <xsl:attribute name="office:value-type">boolean</xsl:attribute>
+ <xsl:attribute name="office:boolean-value"><xsl:choose><xsl:when test="表:数据/字:句/字:文本串 = '1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="表:数据/@表:数据类型 = 'text'">
+ <xsl:attribute name="office:value-type">string</xsl:attribute>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="表:数据/@表:数据数值"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <!-- zhangying ok and /uof:UOF/uof:电子表格/表:公共处理规则/表:数据有效性集-->
+ <xsl:if test="表:数据">
+ <xsl:variable name="validation-name">
+ <xsl:call-template name="zyvalidationtest">
+ <xsl:with-param name="column-num" select="$col-pos"/>
+ <xsl:with-param name="row-num" select="$row-pos"/>
+ <xsl:with-param name="table-name" select="ancestor::表:工作表/@表:名称"/>
+ <xsl:with-param name="validation-set" select="/uof:UOF/uof:电子表格/表:公用处理规则/表:数据有效性集/表:数据有效性"/>
+ <xsl:with-param name="validation-num" select="'1'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$validation-name!=''">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$validation-name"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <!-- zhangying mod end -->
+ </xsl:template>
+ <!-- zhangying o -->
+ <xsl:template name="zyvalidationtest">
+ <xsl:param name="row-num"/>
+ <xsl:param name="column-num"/>
+ <xsl:param name="table-name"/>
+ <xsl:param name="validation-set"/>
+ <xsl:param name="validation-num"/>
+ <xsl:if test="$validation-set">
+ <xsl:variable name="zone" select="$validation-set/表:区域/text()"/>
+ <xsl:variable name="success">
+ <xsl:choose>
+ <xsl:when test="$table-name=substring-after(substring-before($zone,'.'),'$')">
+ <xsl:variable name="validation-row-left-top" select="substring-before(substring-after(substring-after(substring-after($zone,'$'),'$'),'$'),':')"/>
+ <xsl:variable name="validation-row-right-bottom" select="substring-after(substring-after(substring-after($zone,':$'),'$'),'$')"/>
+ <xsl:choose>
+ <xsl:when test="($row-num &gt;= $validation-row-left-top and $row-num &lt;= $validation-row-right-bottom) or $validation-row-left-top=$validation-row-right-bottom">
+ <xsl:variable name="validation-column-left-top">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="substring-before(substring-after(substring-after($zone,'$'),'$'),'$')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="validation-column-right-bottom">
+ <xsl:call-template name="translate-column-char-to-number">
+ <xsl:with-param name="string" select="substring-before(substring-after(substring-after($zone,':$'),'$'),'$')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="($column-num &gt;= $validation-column-left-top) and ($column-num &lt;= $validation-column-right-bottom)">yes</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$success='yes'">
+ <xsl:value-of select="concat('val',$validation-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="zyvalidationtest">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="column-num" select="$column-num"/>
+ <xsl:with-param name="validation-set" select="$validation-set[position()!=1]"/>
+ <xsl:with-param name="validation-num" select="$validation-num + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--zhangying mod end -->
+ <xsl:template name="create-table-cell-content">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="col-pos-max"/>
+ <xsl:param name="col-pos"/>
+ <xsl:param name="row-pos"/>
+ <!--Redoffice comment liliang SC0011 06.02.15 -->
+ <!--新增内容-->
+ <xsl:apply-templates select="uof:锚点"/>
+ <!--Redoffice comment liliang end 06.02.15 -->
+ <xsl:apply-templates select="表:批注" mode="body"/>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26 charts-->
+ <xsl:apply-templates select="表:图表"/>
+ <xsl:if test="表:数据/字:句">
+ <text:p>
+ <xsl:call-template name="create-data-content">
+ <xsl:with-param name="style-id" select="../../@表:式样引用"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if>
+ <!--chengxz0701多个句不能读入-->
+ </xsl:template>
+ <xsl:template name="create-data-content">
+ <xsl:param name="style-id" select="@表:式样引用"/>
+ <xsl:variable name="html-children" select="表:式样引用/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/>
+ <xsl:choose>
+ <xsl:when test="$html-children and $html-children != ''">
+ <xsl:for-each select="$html-children">
+ <text:span text:style-name="{concat($style-id, 'T', count(preceding::表:数据/字:句/字:文本串[child::html:*]), '_', position())}">
+ <xsl:copy-of select="text()"/>
+ </text:span>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@表:超链接引用">
+ <text:a xlink:href="{@表:超链接引用}">
+ <xsl:value-of select="表:数据/字:句/字:文本串"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="表:数据/字:句">
+ <xsl:choose>
+ <xsl:when test="name(descendant::*[1])='字:句属性'">
+ <text:span>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="descendant::*[1]/@字:式样引用"/></xsl:attribute>
+ <xsl:value-of select="./字:文本串"/>
+ </text:span>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./字:文本串"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="create-comment-data-content">
+ <xsl:param name="style-id" select="@表:式样引用"/>
+ <xsl:variable name="html-children" select="表:式样引用/descendant-or-self::*[namespace-uri()='http://www.w3.org/TR/REC-html40'][string-length(text()) != 0]"/>
+ <xsl:choose>
+ <xsl:when test="$html-children and $html-children != ''">
+ <xsl:for-each select="$html-children">
+ <text:span text:style-name="{concat($style-id, 'T', count(preceding::图:文本内容/字:段落/字:句/字:文本串[child::html:*]), '_', position())}">
+ <xsl:copy-of select="text()"/>
+ </text:span>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:when test="@表:超链接引用">
+ <text:a xlink:href="{@表:超链接引用}">
+ <xsl:value-of select="图:文本内容/字:段落/字:句/字:文本串"/>
+ </text:a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="图:文本内容/字:段落/字:句/字:文本串"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-condition-dependent-cell-attributes">
+ <xsl:param name="condition-pos-str"/>
+ <xsl:param name="current-pos-str"/>
+ <xsl:variable name="temp-str">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before($condition-pos-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains($condition-pos-str, $current-pos-str) and starts-with($temp-str, 'c')">
+ <xsl:value-of select="concat('ce', substring-after($temp-str, 'c'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@表:式样引用">
+ <xsl:value-of select="@表:式样引用"/>
+ </xsl:when>
+ <xsl:when test="../@表:式样引用">
+ <xsl:value-of select="../@表:式样引用"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'Default'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="not( contains($style-name, 'Default'))">
+ <xsl:choose>
+ <xsl:when test="starts-with($style-name, 'val')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-name"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="contains($style-name, 'Default')">
+ <xsl:variable name="style-nametemp">
+ <xsl:choose>
+ <xsl:when test="@表:式样引用">
+ <xsl:value-of select="@表:式样引用"/>
+ </xsl:when>
+ <xsl:when test="../@表:式样引用">
+ <xsl:value-of select="../@表:式样引用"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'Default'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="$style-nametemp"/></xsl:attribute>
+ <!--xsl:attribute name="style:data-style-name"><xsl:value-of select="N104" /></xsl:attribute-->
+ </xsl:if>
+ <!--chengxz-->
+ <xsl:if test="contains($condition-pos-str, $current-pos-str)">
+ <xsl:choose>
+ <xsl:when test="starts-with($temp-str, 'v')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="concat('val', substring-after($temp-str, 'v'))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="after-str" select="substring-after($condition-pos-str, $current-pos-str)"/>
+ <xsl:if test="contains( $after-str, $current-pos-str)">
+ <xsl:variable name="temp-str-2">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-before( $after-str,$current-pos-str)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="starts-with( $temp-str-2, 'v')">
+ <xsl:attribute name="table:content-validation-name"><xsl:value-of select="concat('val', substring-after($temp-str-2, 'v'))"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="表:工作表内容">
+ <xsl:variable name="default-column-width">
+ <xsl:choose>
+ <xsl:when test="@表:缺省列宽">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@表:缺省列宽,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>2.096cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="table-pos">
+ <xsl:value-of select="count(../preceding-sibling::表:工作表)+1"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="表:列">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns" select="0"/>
+ <xsl:with-param name="columnCount" select="count(./表:列)"/>
+ <xsl:with-param name="currentCount" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="../表:分页符集/表:分页符[@表:列号]">
+ <style:style style:name="{concat('cob',$table-pos)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <xsl:variable name="default-row-height">
+ <xsl:choose>
+ <xsl:when test="@表:缺省行高">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="concat(@表:缺省行高,'pt')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>0.503cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <style:style style:family="table-row" style:name="{concat('ro', $table-pos)}">
+ <style:table-row-properties style:row-height="{$default-row-height}" style:use-optimal-row-height="false"/>
+ </style:style>
+ <xsl:if test="表:行">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="lastrowpos" select="0"/>
+ <xsl:with-param name="row-count" select="count(./表:行)"/>
+ <xsl:with-param name="currentRow" select="1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-06-11 charts-->
+ <xsl:for-each select="//表:图表">
+ <xsl:variable name="chart-current">
+ <xsl:number level="any" count="表:图表" format="1"/>
+ </xsl:variable>
+ <style:style style:family="graphics" style:name="{concat('chart', $chart-current)}">
+ <style:graphic-properties>
+ <xsl:choose>
+ <xsl:when test="@表:随动方式='none'">
+ <xsl:attribute name="draw:move-protect">true</xsl:attribute>
+ <xsl:attribute name="draw:size-protect">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:随动方式='move'">
+ <xsl:attribute name="draw:size-protect">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:for-each>
+ <!--RedOffice comment (Zengjh) end charts-->
+ <xsl:if test="../表:分页符集/表:分页符[@行号]">
+ <style:style style:name="{concat('rob',$table-pos)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute>
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat( 'ta', $table-pos)"/></xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <xsl:attribute name="style:master-page-name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'TAB_',../@表:名称)"/></xsl:call-template></xsl:attribute>
+ <xsl:element name="style:properties">
+ <xsl:choose>
+ <xsl:when test="../@表:隐藏 = 'true'">
+ <xsl:attribute name="table:display">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:display">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="get-column-style-name">
+ <xsl:param name="finishedColumns"/>
+ <xsl:param name="columnCount"/>
+ <xsl:param name="currentCount"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-column-width"/>
+ <xsl:if test="$currentCount &lt; ($columnCount + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:跨度">
+ <xsl:value-of select="./表:跨度[position() = $currentCount]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列号">
+ <xsl:value-of select="./表:列[position() = $currentCount]/@表:列号 - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="column-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../表:分页符集/表:分页符/表:列 = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../表:分页符集/表:分页符[(@表:列号 &gt; $finishedColumns) and (@表:列号 &lt; ($finishedColumns + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$column-break = 1">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat('cob', $table-pos, '-',$currentCount)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列宽">
+ <xsl:attribute name="style:column-width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:列[position() = $currentCount]/@表:列宽,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列宽 &gt; 0">
+ <xsl:attribute name="style:use-optimal-column-width">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-column-width">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <style:style style:name="{concat('co', $table-pos, '-',$currentCount)}" style:family="table-column">
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列宽">
+ <xsl:attribute name="style:column-width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:列[position() = $currentCount]/@表:列宽,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="$default-column-width"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ <xsl:if test="$currentCount &lt; $columnCount">
+ <xsl:call-template name="get-column-style-name">
+ <xsl:with-param name="finishedColumns">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:列号">
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:跨度">
+ <xsl:value-of select="./表:列[position() = $currentCount]/@表:列宽 + ./表:列[position() = $currentCount]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:列[position() = $currentCount]/@表:列号"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:列[position() = $currentCount]/@表:跨度">
+ <xsl:value-of select="$finishedColumns + ./表:列[position() = $currentCount]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$finishedColumns + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="columnCount" select="$columnCount"/>
+ <xsl:with-param name="currentCount" select="$currentCount + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-column-width" select="$default-column-width"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="get-row-style-name">
+ <xsl:param name="lastrowpos"/>
+ <xsl:param name="row-count"/>
+ <xsl:param name="currentRow"/>
+ <xsl:param name="table-pos"/>
+ <xsl:param name="default-row-height"/>
+ <xsl:if test="$currentRow &lt; ($row-count + 1)">
+ <xsl:variable name="span-value">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行号">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号 - $lastrowpos+ ./表:行[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current-index">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行号">
+ <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号 - 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="row-break">
+ <xsl:choose>
+ <xsl:when test="$span-value = 0">
+ <xsl:if test="../表:分页符集/表:分页符/@表:行号 = $current-index">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="../表:分页符集/表:分页符[(@表:行号 &gt; $lastrowpos) and (@表:行号 &lt; ($lastrowpos + $span-value))]">
+ <xsl:value-of select="1"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$row-break = 1">
+ <style:style style:name="{concat('rob', $table-pos, '-',$currentRow)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高">
+ <xsl:attribute name="style:row-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:行[position() = $currentRow]/@表:行高,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高 &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ </xsl:if>
+ <style:style style:name="{concat('ro', $table-pos, '-',$currentRow)}" style:family="table-row">
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高">
+ <xsl:attribute name="style:row-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(./表:行[position() = $currentRow]/@表:行高,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:row-height"><xsl:value-of select="$default-row-height"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行高 &gt; 0">
+ <xsl:attribute name="style:use-optimal-row-height">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:use-optimal-row-height">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:element>
+ </style:style>
+ <xsl:if test="$currentRow &lt; $row-count">
+ <xsl:call-template name="get-row-style-name">
+ <xsl:with-param name="lastrowpos">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:行号">
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号 + ./表:行[position() = $currentRow]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="./表:行[position() = $currentRow]/@表:行号"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="./表:行[position() = $currentRow]/@表:跨度">
+ <xsl:value-of select="$lastrowpos + ./表:行[position() = $currentRow]/@表:跨度 + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$lastrowpos + 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="row-count" select="$row-count"/>
+ <xsl:with-param name="currentRow" select="$currentRow + 1"/>
+ <xsl:with-param name="table-pos" select="$table-pos"/>
+ <xsl:with-param name="default-row-height" select="$default-row-height"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="encode-as-nc-name">
+ <xsl:param name="string"/>
+ <xsl:value-of select="translate($string, '. %()/\+', '')"/>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/表:单元格" name="cells" use="@表:式样引用"/>
+ <xsl:template match="表:数字格式">
+ <xsl:variable name="unit-count" select="string-length(@表:格式码) - string-length(translate(@表:格式码,';','')) + 1"/>
+ <xsl:variable name="style-id" select="../@表:标识符"/>
+ <xsl:variable name="number-format-name">
+ <xsl:choose>
+ <xsl:when test="@表:分类名称='fraction' or @表:分类名称='scientific'">number</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@表:分类名称"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="process-number-format">
+ <xsl:with-param name="number-format-name" select="$number-format-name"/>
+ <xsl:with-param name="number-format-unit" select="@表:格式码"/>
+ <xsl:with-param name="style-id" select="concat($style-id,'F')"/>
+ <xsl:with-param name="format-type" select="key('cells', $style-id)/表:数据/@表:数据类型"/>
+ <xsl:with-param name="total-unit" select="$unit-count"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="process-number-format">
+ <xsl:param name="number-format-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="style-id"/>
+ <xsl:param name="format-type"/>
+ <xsl:param name="total-unit"/>
+ <xsl:param name="current-unit"/>
+ <xsl:choose>
+ <xsl:when test="$current-unit &lt; ($total-unit -1)">
+ <xsl:variable name="style-name">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before($number-format-unit,';'),'[$')">currency</xsl:when>
+ <xsl:when test="contains(substring-before($number-format-unit,';'),'%')">percentage</xsl:when>
+ <xsl:otherwise>number</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{concat('number:',$style-name,'-style')}">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat( $style-id, 'P',$current-unit)"/></xsl:attribute>
+ <xsl:attribute name="style:volatile">true</xsl:attribute>
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring-before($number-format-unit,';')"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:call-template name="process-number-format">
+ <xsl:with-param name="number-format-name" select="$number-format-name"/>
+ <xsl:with-param name="number-format-unit" select="substring-after($number-format-unit,';')"/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="$current-unit +1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="{concat('number:',$number-format-name,'-style')}">
+ <xsl:attribute name="style:name"><xsl:value-of select="$style-id"/></xsl:attribute>
+ <xsl:call-template name="element-attribute">
+ <xsl:with-param name="number-format-unit" select="string($number-format-unit)"/>
+ </xsl:call-template>
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="string($number-format-unit)"/>
+ </xsl:call-template>
+ <xsl:call-template name="style-map">
+ <xsl:with-param name="number-format-name" select="@表:分类名称"/>
+ <xsl:with-param name="number-format-unit" select="@表:格式码"/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="0"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="style-map">
+ <xsl:param name="number-format-name"/>
+ <xsl:param name="number-format-unit"/>
+ <xsl:param name="style-id"/>
+ <xsl:param name="format-type"/>
+ <xsl:param name="total-unit"/>
+ <xsl:param name="current-unit"/>
+ <xsl:if test="$current-unit &lt; ($total-unit -1)">
+ <xsl:variable name="stylecondition" select="substring-after(substring-before($number-format-unit,']'),'[')"/>
+ <style:map style:condition="{$stylecondition}" style:apply-style-name="{concat( $style-id, 'P',$current-unit)}"/>
+ <xsl:call-template name="style-map">
+ <xsl:with-param name="number-format-name" select="$number-format-name"/>
+ <xsl:with-param name="number-format-unit" select="substring-after($number-format-unit,';')"/>
+ <xsl:with-param name="style-id" select="$style-id"/>
+ <xsl:with-param name="format-type" select="$format-type"/>
+ <xsl:with-param name="total-unit" select="$total-unit"/>
+ <xsl:with-param name="current-unit" select="$current-unit +1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="general-number">
+ <xsl:param name="number-format-unit"/>
+ <xsl:call-template name="number-format-color">
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ </xsl:call-template>
+ <xsl:call-template name="number-format-currency">
+ <xsl:with-param name="number-format-unit" select="$number-format-unit"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'&quot;')">
+ <number:text>
+ <xsl:value-of select="substring-before(substring-after($number-format-unit,'&quot;'),'&quot;')"/>
+ </number:text>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'@')">
+ <number:text-content/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'-') or starts-with($number-format-unit,'$') or starts-with($number-format-unit,'¥')">
+ <number:text>
+ <xsl:value-of select="substring($number-format-unit,1,1)"/>
+ </number:text>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YYYY')">
+ <number:year number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YY')">
+ <number:year number:style="rolong"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMMM')">
+ <number:month number:style="long" number:textual="true"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMM')">
+ <number:month number:style="rolong" number:textual="true"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'DD')">
+ <number:day number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'D')">
+ <number:day number:style="rolong"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[HH]')">
+ <number:hours number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'HH')">
+ <number:hours number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'H')">
+ <number:hours/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS.00')">
+ <number:seconds number:style="long" number:decimal-places="2"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS')">
+ <number:seconds number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'S')">
+ <number:seconds/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'AM/PM')">
+ <number:am-pm/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNNN')">
+ <number:day-of-week number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNN')">
+ <number:day-of-week/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'QQ')">
+ <number:quarter number:style="long"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'Q')">
+ <number:quarter/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'WW')">
+ <number:week-of-year/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MM')">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring($number-format-unit,3),'S') or (starts-with(substring($number-format-unit,3),'&quot;') and starts-with(substring-after(substring-after($number-format-unit,'&quot;'),'&quot;'),'S'))">
+ <number:minutes number:style="long"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:month number:style="long"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'M')">
+ <xsl:choose>
+ <xsl:when test="starts-with(substring($number-format-unit,2),'S') or (starts-with(substring($number-format-unit,2),'&quot;') and starts-with(substring-after(substring-after($number-format-unit,'&quot;'),'&quot;'),'S'))">
+ <number:minutes/>
+ </xsl:when>
+ <xsl:otherwise>
+ <number:month/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'#') or starts-with($number-format-unit,'0')">
+ <xsl:variable name="digits-part">
+ <xsl:choose>
+ <xsl:when test="contains($number-format-unit,'&quot;')">
+ <xsl:value-of select="substring-before($number-format-unit,'&quot;')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$number-format-unit"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="decimal-integer-exponent-fraction">
+ <xsl:with-param name="digits-part" select="$digits-part"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="unit-length">
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[value()')">
+ <xsl:value-of select="string-length(substring-before($number-format-unit,']')) +2"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[NatNum')">
+ <xsl:value-of select="string-length(substring-before($number-format-unit,']')) +2"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$-804]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'&quot;')">
+ <xsl:value-of select="string-length(substring-before(substring-after($number-format-unit,'&quot;'),'&quot;')) +3"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'@')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'-') or starts-with($number-format-unit,'$') or starts-with($number-format-unit,'¥')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YYYY')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'YY')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMMM')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MMM')">4</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'MM')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'M')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'DD')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'D')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[HH]')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'HH')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'H')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS.00')">6</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'SS')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'S')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'AM/PM')">6</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNNN')">5</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'NNN')">4</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'QQ')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'Q')">2</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'WW')">3</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'#') or starts-with($number-format-unit,'0')">
+ <xsl:choose>
+ <xsl:when test="contains($number-format-unit,'&quot;')">
+ <xsl:value-of select="string-length(substring-before($number-format-unit,'&quot;')) +1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($number-format-unit) +1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$unit-length &gt;1 and $unit-length &lt;=string-length($number-format-unit)">
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="decimal-integer-exponent-fraction">
+ <xsl:param name="digits-part"/>
+ <xsl:variable name="decimal-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'.')">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),' '))"/>
+ </xsl:when>
+ <xsl:when test="contains(substring-after($digits-part,'.'),',')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),','))"/>
+ </xsl:when>
+ <xsl:when test="contains($digits-part,'E')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),'E'))"/>
+ </xsl:when>
+ <xsl:when test="contains($digits-part,'e')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,'.'),'e'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length(substring-after($digits-part,'.'))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="decimal-replacement">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'.')">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ') and contains(substring-before(substring-after($digits-part,'.'),' '),'#')">true</xsl:when>
+ <xsl:when test="contains($digits-part,'E') and contains(substring-before(substring-after($digits-part,'.'),'E'),'#')">true</xsl:when>
+ <xsl:when test="contains($digits-part,'e') and contains(substring-before(substring-after($digits-part,'.'),'e'),'#')">true</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains(substring-after($digits-part,'.'),'#')">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="integer-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'.')">
+ <xsl:value-of select="string-length(substring-before($digits-part,'.')) - string-length(translate(substring-before($digits-part,'.'),'0',''))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="string-length($digits-part) - string-length(translate($digits-part,'0',''))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="factor-digits">
+ <xsl:call-template name="display-factor-digits">
+ <xsl:with-param name="digits-part" select="$digits-part"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="grouping">
+ <xsl:choose>
+ <xsl:when test="(string-length($digits-part) - string-length(translate($digits-part,',',''))) &gt;$factor-digits">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="exponent-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,'E')">
+ <xsl:value-of select="string-length(substring-after($digits-part,'E')) -1"/>
+ </xsl:when>
+ <xsl:when test="contains($digits-part,'e')">
+ <xsl:value-of select="string-length(substring-after($digits-part,'e')) -1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="numerator-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ')">
+ <xsl:value-of select="string-length(substring-before(substring-after($digits-part,' '),'/'))"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="denominator-digits">
+ <xsl:choose>
+ <xsl:when test="contains($digits-part,' ')">
+ <xsl:value-of select="string-length(substring-after(substring-after($digits-part,' '),'/'))"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-type">
+ <xsl:choose>
+ <xsl:when test="$exponent-digits &gt;0">number:scientific-number</xsl:when>
+ <xsl:when test="($numerator-digits &gt;0) or ($denominator-digits &gt;0)">number:fraction</xsl:when>
+ <xsl:otherwise>number:number</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$number-type}">
+ <xsl:if test="$decimal-digits &gt;=0">
+ <xsl:attribute name="number:decimal-places"><xsl:value-of select="$decimal-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$decimal-replacement='true'">
+ <xsl:attribute name="number:decimal-replacement"/>
+ </xsl:if>
+ <xsl:if test="$integer-digits &gt;=0">
+ <xsl:attribute name="number:min-integer-digits"><xsl:value-of select="$integer-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$grouping='true'">
+ <xsl:attribute name="number:grouping"><xsl:value-of select="$grouping"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$factor-digits &gt;0">
+ <xsl:attribute name="number:display-factor"><xsl:choose><xsl:when test="$factor-digits=1">1000</xsl:when><xsl:when test="$factor-digits=2">1000000</xsl:when><xsl:when test="$factor-digits=3">1000000000</xsl:when><xsl:when test="$factor-digits=4">1000000000000</xsl:when><xsl:when test="$factor-digits=5">1000000000000000</xsl:when><xsl:when test="$factor-digits=6">1000000000000000000</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$exponent-digits &gt;0">
+ <xsl:attribute name="number:min-exponent-digits"><xsl:value-of select="$exponent-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$numerator-digits &gt;0">
+ <xsl:attribute name="number:min-numerator-digits"><xsl:value-of select="$numerator-digits"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$denominator-digits &gt;0">
+ <xsl:attribute name="number:min-denominator-digits"><xsl:value-of select="$denominator-digits"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="number-format-color">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[Black]')">
+ <style:text-properties fo:color="#000000"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Blue]')">
+ <style:text-properties fo:color="#0000ff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Cyan]')">
+ <style:text-properties fo:color="#00ffff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Green]')">
+ <style:text-properties fo:color="#00ff00"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Magenta]')">
+ <style:text-properties fo:color="#ff00ff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Red]')">
+ <style:text-properties fo:color="#ff0000"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[White]')">
+ <style:text-properties fo:color="#ffffff"/>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Yellow]')">
+ <style:text-properties fo:color="#ffff00"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="unit-length">
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[Black]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Blue]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Cyan]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Green]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Magenta]')">10</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Red]')">6</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[White]')">8</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[Yellow]')">9</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$unit-length &gt;1 and $unit-length &lt;=string-length($number-format-unit)">
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="number-format-currency">
+ <xsl:param name="number-format-unit"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[$¥-804]')">
+ <number:currency-symbol number:language="zh" number:country="CN">¥</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-409]')">
+ <number:currency-symbol number:language="en" number:country="US">$</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-2C0A]')">
+ <number:currency-symbol number:language="es" number:country="AR">$</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-C0C]')">
+ <number:currency-symbol number:language="fr" number:country="CA">$</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$CNY]')">
+ <number:currency-symbol>CNY</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$AFA]')">
+ <number:currency-symbol>AFA</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CNY')">
+ <number:currency-symbol>CNY</number:currency-symbol>
+ </xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CCC')">
+ <number:currency-symbol>CCC</number:currency-symbol>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="unit-length">
+ <xsl:choose>
+ <xsl:when test="starts-with($number-format-unit,'[$¥-804]')">9</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-409]')">9</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-2C0A]')">10</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$$-C0C]')">9</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$CNY]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'[$AFA]')">7</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CNY')">4</xsl:when>
+ <xsl:when test="starts-with($number-format-unit,'CCC')">4</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$unit-length &gt;1 and $unit-length &lt;=string-length($number-format-unit)">
+ <xsl:call-template name="general-number">
+ <xsl:with-param name="number-format-unit" select="substring($number-format-unit,$unit-length)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="display-factor-digits">
+ <xsl:param name="digits-part"/>
+ <xsl:param name="count"/>
+ <xsl:choose>
+ <xsl:when test="not(substring($digits-part,string-length($digits-part),1) =',')">
+ <xsl:value-of select="$count"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="display-factor-digits">
+ <xsl:with-param name="digits-part" select="substring($digits-part,1,string-length($digits-part) -1)"/>
+ <xsl:with-param name="count" select="$count +1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="element-attribute">
+ <xsl:param name="number-format-unit"/>
+ <xsl:if test="contains($number-format-unit,'[HH]')">
+ <xsl:attribute name="number:truncate-on-overflow">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum1]')">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum2]')">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum3]')">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum4]')">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum5]')">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum6]')">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">long</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum7]')">
+ <xsl:attribute name="number:transliteration-format">一</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">medium</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum8]')">
+ <xsl:attribute name="number:transliteration-format">壹</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">medium</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="starts-with($number-format-unit,'[NatNum0]')">
+ <xsl:attribute name="number:transliteration-format">1</xsl:attribute>
+ <xsl:attribute name="number:transliteration-style">short</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($number-format-unit,'[$-804]')">
+ <xsl:attribute name="number:transliteration-language">zh</xsl:attribute>
+ <xsl:attribute name="number:transliteration-country">CN</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:key name="pz" match="/uof:UOF/uof:对象集/图:图形" use="@图:标识符"/>
+ <xsl:template match="表:批注" mode="body">
+ <xsl:element name="office:annotation">
+ <xsl:if test="@表:是否显示 = 'true'">
+ <xsl:attribute name="office:display">true</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="uof:锚点/@uof:图形引用"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(uof:锚点/@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(uof:锚点/@uof:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(uof:锚点/@uof:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(uof:锚点/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="w">
+ <xsl:value-of select="./uof:锚点/@uof:图形引用"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="key('pz',$w)/图:文本内容/字:句/字:文本串">
+ <text:p>
+ <xsl:for-each select="key('pz',$w)/图:文本内容/字:句">
+ <text:span>
+ <xsl:if test="字:句属性/@字:式样引用">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="字:句属性/@字:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="字:文本串"/>
+ </text:span>
+ </xsl:for-each>
+ </text:p>
+ </xsl:when>
+ </xsl:choose>
+ <!--xsl:if test="图:文本内容/字:段落/字:句/字:文本串">
+ <text:p>
+ <xsl:call-template name="create-comment-data-content">
+ <xsl:with-param name="style-id" select="../@表:式样引用"/>
+ </xsl:call-template>
+ </text:p>
+ </xsl:if-->
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="auto-filter-condition">
+ <xsl:param name="conditon-set"/>
+ <xsl:param name="zone-left-column-num"/>
+ <xsl:if test="$conditon-set">
+ <xsl:variable name="first-condition" select="$conditon-set[1]"/>
+ <xsl:element name="table:filter-condition">
+ <xsl:attribute name="table:field-number"><xsl:value-of select="$first-condition/@表:列号 - $zone-left-column-num"/></xsl:attribute>
+ <xsl:attribute name="office:value"><xsl:choose><xsl:when test="$first-condition/表:普通"><xsl:value-of select="$first-condition/表:普通/@表:值"/></xsl:when><xsl:when test="$first-condition/表:自定义"><xsl:value-of select="$first-condition/表:自定义/表:操作条件/表:值"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:variable name="operator">
+ <xsl:choose>
+ <xsl:when test="$first-condition/表:普通">
+ <xsl:variable name="general" select="$first-condition/表:普通/@表:类型"/>
+ <xsl:choose>
+ <xsl:when test="$general ='topitem'">top values</xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-condition/表:自定义">
+ <xsl:variable name="operator-text" select="$first-condition/表:自定义/表:操作条件/表:操作码/text()"/>
+ <xsl:choose>
+ <xsl:when test="$operator-text ='less than'">&lt;</xsl:when>
+ <xsl:when test="$operator-text ='greater than'">&gt;</xsl:when>
+ <xsl:when test="$operator-text ='equal to'">
+ <xsl:value-of select="'='"/>
+ </xsl:when>
+ <xsl:when test="$operator-text ='greater than or equal to'">
+ <xsl:value-of select="'&gt;='"/>
+ </xsl:when>
+ <xsl:when test="$operator-text ='less than or equal to'">
+ <xsl:value-of select="'&lt;='"/>
+ </xsl:when>
+ <xsl:when test="$operator-text ='not equal to'">
+ <xsl:value-of select="'!='"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="table:operator"><xsl:value-of select="$operator"/></xsl:attribute>
+ </xsl:element>
+ <xsl:call-template name="auto-filter-condition">
+ <xsl:with-param name="conditon-set" select="$conditon-set[position()!=1]"/>
+ <xsl:with-param name="zone-left-column-num" select="$zone-left-column-num"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="translate-column-char-to-number">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="string-length($string)=1">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="$string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="tens-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,1,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="units-place">
+ <xsl:call-template name="char-to-number">
+ <xsl:with-param name="char" select="substring($string,2,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$tens-place * 26 + $units-place"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="char-to-number">
+ <xsl:param name="char"/>
+ <xsl:choose>
+ <xsl:when test="$char='A'">1</xsl:when>
+ <xsl:when test="$char='B'">2</xsl:when>
+ <xsl:when test="$char='C'">3</xsl:when>
+ <xsl:when test="$char='D'">4</xsl:when>
+ <xsl:when test="$char='E'">5</xsl:when>
+ <xsl:when test="$char='F'">6</xsl:when>
+ <xsl:when test="$char='G'">7</xsl:when>
+ <xsl:when test="$char='H'">8</xsl:when>
+ <xsl:when test="$char='I'">9</xsl:when>
+ <xsl:when test="$char='J'">10</xsl:when>
+ <xsl:when test="$char='K'">11</xsl:when>
+ <xsl:when test="$char='L'">12</xsl:when>
+ <xsl:when test="$char='M'">13</xsl:when>
+ <xsl:when test="$char='N'">14</xsl:when>
+ <xsl:when test="$char='O'">15</xsl:when>
+ <xsl:when test="$char='P'">16</xsl:when>
+ <xsl:when test="$char='Q'">17</xsl:when>
+ <xsl:when test="$char='R'">18</xsl:when>
+ <xsl:when test="$char='S'">19</xsl:when>
+ <xsl:when test="$char='T'">20</xsl:when>
+ <xsl:when test="$char='U'">21</xsl:when>
+ <xsl:when test="$char='V'">22</xsl:when>
+ <xsl:when test="$char='W'">23</xsl:when>
+ <xsl:when test="$char='X'">24</xsl:when>
+ <xsl:when test="$char='Y'">25</xsl:when>
+ <xsl:when test="$char='Z'">26</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-expression2">
+ <xsl:param name="expression2"/>
+ <xsl:choose>
+ <xsl:when test="contains($expression2,':')">
+ <xsl:variable name="column-one">
+ <xsl:value-of select="substring(substring-before($expression2,':'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-one">
+ <xsl:value-of select="substring(substring-before($expression2,':'),2)"/>
+ </xsl:variable>
+ <xsl:variable name="column-two">
+ <xsl:value-of select="substring(substring-after($expression2,':'),1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-two">
+ <xsl:value-of select="substring(substring-after($expression2,':'),2)"/>
+ </xsl:variable>
+ <xsl:variable name="column-value1">
+ <xsl:call-template name="character-to-column">
+ <xsl:with-param name="column-value" select="$column-one"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-value2">
+ <xsl:call-template name="character-to-column">
+ <xsl:with-param name="column-value" select="$column-two"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('R',$row-one,'C',$column-value1,':','R',$row-two,'C',$column-value2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="column-one">
+ <xsl:value-of select="substring($expression2,1,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-one">
+ <xsl:value-of select="substring($expression2,2)"/>
+ </xsl:variable>
+ <xsl:variable name="column-value1">
+ <xsl:call-template name="character-to-column">
+ <xsl:with-param name="column-value" select="$column-one"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat('R',$row-one,'C',$column-value1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="character-to-column">
+ <xsl:param name="column-value"/>
+ <xsl:choose>
+ <xsl:when test="$column-value= 'A'">1</xsl:when>
+ <xsl:when test="$column-value= 'B'">2</xsl:when>
+ <xsl:when test="$column-value= 'C'">3</xsl:when>
+ <xsl:when test="$column-value= 'D'">4</xsl:when>
+ <xsl:when test="$column-value= 'E'">5</xsl:when>
+ <xsl:when test="$column-value= 'F'">6</xsl:when>
+ <xsl:when test="$column-value= 'G'">7</xsl:when>
+ <xsl:when test="$column-value= 'H'">8</xsl:when>
+ <xsl:when test="$column-value= 'I'">9</xsl:when>
+ <xsl:when test="$column-value= 'J'">10</xsl:when>
+ <xsl:when test="$column-value= 'K'">11</xsl:when>
+ <xsl:when test="$column-value= 'L'">12</xsl:when>
+ <xsl:when test="$column-value= 'M'">13</xsl:when>
+ <xsl:when test="$column-value= 'N'">14</xsl:when>
+ <xsl:when test="$column-value= 'O'">15</xsl:when>
+ <xsl:when test="$column-value= 'P'">16</xsl:when>
+ <xsl:when test="$column-value= 'Q'">17</xsl:when>
+ <xsl:when test="$column-value= 'R'">18</xsl:when>
+ <xsl:when test="$column-value= 'S'">19</xsl:when>
+ <xsl:when test="$column-value= 'T'">20</xsl:when>
+ <xsl:when test="$column-value= 'U'">21</xsl:when>
+ <xsl:when test="$column-value= 'V'">22</xsl:when>
+ <xsl:when test="$column-value= 'W'">23</xsl:when>
+ <xsl:when test="$column-value= 'X'">24</xsl:when>
+ <xsl:when test="$column-value= 'Y'">25</xsl:when>
+ <xsl:when test="$column-value= 'Z'">26</xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <!--chenjh end 20050611-->
+ <xsl:template name="工作表属性">
+ <!--office:settings-->
+ <xsl:variable name="sheetprop" select="/uof:UOF/uof:电子表格/表:主体/表:工作表"/>
+ <config:config-item-set config:name="ooo:view-settings">
+ <xsl:variable name="ratio" select="15"/>
+ <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/表:单元格/表:数据/字:句/字:修订开始">
+ <config:config-item-set config:name="TrackedChangesViewSettings">
+ <config:config-item config:name="ShowChanges" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ShowAcceptedChanges" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowRejectedChanges" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetime" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetimeMode" config:type="short">0</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetimeFirstDatetime" config:type="datetime">2007-01-17T10:56:46.21</config:config-item>
+ <config:config-item config:name="ShowChangesByDatetimeSecondDatetime" config:type="datetime">2007-01-17T10:56:46.21</config:config-item>
+ <config:config-item config:name="ShowChangesByAuthor" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByAuthorName" config:type="string"/>
+ <config:config-item config:name="ShowChangesByComment" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByCommentText" config:type="string"/>
+ <config:config-item config:name="ShowChangesByRanges" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowChangesByRangesList" config:type="string"/>
+ </config:config-item-set>
+ </xsl:if>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">View1</config:config-item>
+ <config:config-item-map-named config:name="Tables">
+ <xsl:for-each select="$sheetprop/表:工作表属性/表:视图">
+ <xsl:element name="config:config-item-map-entry">
+ <xsl:attribute name="config:name"><xsl:value-of select="ancestor::表:工作表/@表:名称"/></xsl:attribute>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">HorizontalSplitMode</xsl:attribute>
+ <xsl:attribute name="config:type">short</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列号!=0">2</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列号=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度!=0">1</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度=0">0</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">VerticalSplitMode</xsl:attribute>
+ <xsl:attribute name="config:type">short</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:行号!=0">2</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:行号=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度!=0">1</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度=0">0</xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">HorizontalSplitPosition</xsl:attribute>
+ <xsl:attribute name="config:type">int</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列号=0">0</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:列号!=0">
+ <xsl:value-of select="表:冻结/@表:列号"/>
+ </xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:宽度!=0">
+ <xsl:value-of select="表:拆分/@表:宽度"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">VerticalSplitPosition</xsl:attribute>
+ <xsl:attribute name="config:type">int</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:冻结 and 表:冻结/@表:行号=0">0</xsl:when>
+ <xsl:when test="表:冻结 and 表:冻结/@表:行号!=0">
+ <xsl:value-of select="表:冻结/@表:行号"/>
+ </xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度=0">0</xsl:when>
+ <xsl:when test="表:拆分 and 表:拆分/@表:高度!=0">
+ <xsl:value-of select="表:拆分/@表:高度"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:variable name="position-top">
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:最上行">
+ <xsl:value-of select="//表:工作表属性/表:视图/表:最上行"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="position-left">
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:最左列">
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:最左列"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <config:config-item config:name="PositionRight" config:type="int">
+ <xsl:value-of select="$position-left"/>
+ </config:config-item>
+ <config:config-item config:name="PositionBottom" config:type="int">
+ <xsl:value-of select="$position-top"/>
+ </config:config-item>
+ </xsl:element>
+ </xsl:for-each>
+ </config:config-item-map-named>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:当前视图">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">ShowPageBreakPreview</xsl:attribute>
+ <xsl:attribute name="config:type">boolean</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:当前视图/@表:类型='normal'">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:网格">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">ShowGrid</xsl:attribute>
+ <xsl:attribute name="config:type">boolean</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$sheetprop/表:工作表属性/表:视图/表:网格/@表:值=1 or $sheetprop/表:工作表属性/表:视图/表:网格/@表:值='true'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:网格颜色">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">GridColor</xsl:attribute>
+ <xsl:attribute name="config:type">long</xsl:attribute>
+ <xsl:call-template name="transform-hex-to-decimal">
+ <xsl:with-param name="number" select="//表:视图/表:网格颜色/text()"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:选中">
+ <xsl:element name="config:config-item">
+ <xsl:attribute name="config:name">ActiveTable</xsl:attribute>
+ <xsl:attribute name="config:type">string</xsl:attribute>
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图[表:选中]/ancestor::表:工作表/@表:名称"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:缩放">
+ <config:config-item config:name="ZoomValue" config:type="int">
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:缩放/text()"/>
+ </config:config-item>
+ </xsl:if>
+ <xsl:if test="$sheetprop/表:工作表属性/表:视图/表:分页缩放">
+ <config:config-item config:name="PageViewZoomValue" config:type="int">
+ <xsl:value-of select="$sheetprop/表:工作表属性/表:视图/表:分页缩放/text()"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ </xsl:template>
+ <xsl:template name="create-page-master">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'pm_', ../@表:名称)"/></xsl:call-template></xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:if test="表:页面设置/表:纸张/@uof:宽度">
+ <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(表:页面设置/表:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页面设置/表:纸张/@uof:高度">
+ <xsl:attribute name="fo:page-height"><xsl:value-of select="concat(表:页面设置/表:纸张/@uof:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页面设置/表:纸张方向">
+ <xsl:attribute name="style:print-orientation"><xsl:value-of select="表:页面设置/表:纸张方向"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页面设置/表:缩放">
+ <xsl:attribute name="style:scale-to"><xsl:value-of select="concat(表:页面设置/表:缩放,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:电子表格/表:主体/表:工作表/@表:背景">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="/uof:UOF/uof:电子表格/表:主体/表:工作表/@表:背景"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:first-page-number">continue</xsl:attribute>
+ <xsl:if test="表:页面设置/表:页边距">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:下,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:左,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(表:页面设置/表:页边距/@uof:右,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页面设置/表:打印/@表:先列后行='true'">
+ <xsl:attribute name="style:print-page-order">ltr</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页面设置/表:垂直对齐/@表:对齐方式">
+ <xsl:attribute name="style:table-centering">vertical</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:页面设置/表:水平对齐/@表:对齐方式">
+ <xsl:attribute name="style:table-centering">horizontal</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:header-style">
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:页面设置/表:页眉页脚/@uof:边距">
+ <xsl:attribute name="fo:margin-bottom"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(表:页面设置/表:页眉页脚/@uof:边距,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-bottom">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="style:footer-style">
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:min-height">0.75cm</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="表:页面设置/表:页眉页脚/@uof:边距">
+ <xsl:attribute name="fo:margin-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(表:页面设置/表:页眉页脚/@uof:边距,'pt')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-top">0.25cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template match="字:文本串">
+ <xsl:value-of select="text()"/>
+ </xsl:template>
+ <xsl:template match="字:换行符">
+ <xsl:element name="text:line-break"/>
+ </xsl:template>
+ <xsl:template match="字:制表符">
+ <xsl:element name="text:tab-stop"/>
+ </xsl:template>
+ <xsl:template match="字:区域开始">
+ <xsl:if test="@字:类型='hyperlink'">
+ <xsl:variable name="superlink" select="//uof:超级链接[@uof:标识符=current()/@字:标识符]"/>
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="$superlink/@uof:目标"/></xsl:attribute>
+ <xsl:value-of select="$superlink/@uof:提示"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:空格符">
+ <xsl:element name="text:s">
+ <xsl:if test="@字:个数">
+ <xsl:attribute name="text:c"><xsl:value-of select="@字:个数"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-page-header-footer-text-p">
+ <xsl:param name="paragragh-set"/>
+ <xsl:choose>
+ <xsl:when test="$paragragh-set">
+ <xsl:element name="text:p">
+ <xsl:for-each select="$paragragh-set[1]/字:句">
+ <xsl:choose>
+ <xsl:when test="not(字:句属性)">
+ <xsl:apply-templates select="字:文本串 | 字:空格符 | 字:换行符"/>
+ </xsl:when>
+ <xsl:when test="字:句属性">
+ <xsl:element name="text:span">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="//uof:句式样[@字:标识符=current()/字:句属性/@字:式样引用]/@字:名称"/></xsl:attribute>
+ <xsl:apply-templates select="字:空格符 | 字:文本串 | 字:换行符 | 字:制表符"/>
+ </xsl:element>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="$paragragh-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <!--Redoffice comment lilliang SC0016 06.02.16 -->
+ <!--新增内容-->
+ <xsl:template match="字:段落">
+ <xsl:element name="text:p">
+ <xsl:choose>
+ <xsl:when test="字:段落属性">
+ <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="generate-id(ancestor::字:主体/descendant::字:段落[1]) = generate-id(.)">
+ <!-- create the leading paragraph style name in one section for master page style application, glu -->
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not(字:段落属性) and (descendant::字:分栏符 or ancestor::字:分节/descendant::字:节属性[字:分栏/@字:栏数 &gt; 1])">
+ <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:句">
+ <xsl:apply-templates select="字:句/字:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <!--Redoffice comment liliang end 06.02.16-->
+ <xsl:template name="create-master-styles">
+ <xsl:param name="worksheetoptions"/>
+ <xsl:for-each select="$worksheetoptions">
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'TAB_', ../@表:名称)"/></xsl:call-template></xsl:attribute>
+ <!--xsl:attribute name="style:page-layout-name"-->
+ <xsl:attribute name="style:page-layout-name"><xsl:call-template name="encode-as-nc-name"><xsl:with-param name="string" select="concat( 'pm_', ../@表:名称)"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="style:display-name"><xsl:value-of select="concat( 'PageStyle_', ../@表:名称)"/></xsl:attribute>
+ <style:header>
+ <xsl:for-each select="表:页面设置/表:页眉页脚">
+ <xsl:variable name="temp" select="@表:位置"/>
+ <xsl:choose>
+ <xsl:when test="contains($temp,'header')">
+ <xsl:if test="字:段落">
+ <xsl:choose>
+ <xsl:when test="@表:位置='headerleft'">
+ <xsl:element name="style:region-left">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="字:段落"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:位置='headercenter'">
+ <xsl:element name="style:region-center">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="字:段落"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:位置='headerright'">
+ <xsl:element name="style:region-right">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="字:段落"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:header>
+ <style:footer>
+ <xsl:for-each select="表:页面设置/表:页眉页脚">
+ <xsl:variable name="temp" select="@表:位置"/>
+ <xsl:choose>
+ <xsl:when test="contains($temp,'footer')">
+ <xsl:if test="字:段落">
+ <xsl:choose>
+ <xsl:when test="@表:位置='footerleft'">
+ <xsl:element name="style:region-left">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="字:段落"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:位置='footercenter'">
+ <xsl:element name="style:region-center">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="字:段落"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@表:位置='footerright'">
+ <xsl:element name="style:region-right">
+ <xsl:call-template name="create-page-header-footer-text-p">
+ <xsl:with-param name="paragragh-set" select="字:段落"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:footer>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <!--xsl:template name="create-page-master">
+ </xsl:template>
+ <xsl:template match="表:页面设置">
+ </xsl:template>
+
+ <xsl:template name="create-master-styles">
+ </xsl:template>
+ <xsl:template name="表:工作表属性">
+ </xsl:template-->
+ <!--00000000000-->
+ <xsl:template match="uof:元数据">
+ <office:meta>
+ <xsl:if test="uof:创建应用程序">
+ <meta:generator>
+ <xsl:value-of select="uof:创建应用程序"/>
+ </meta:generator>
+ </xsl:if>
+ <xsl:if test="uof:标题">
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ </xsl:if>
+ <xsl:if test="uof:摘要">
+ <dc:description>
+ <xsl:value-of select="uof:摘要"/>
+ </dc:description>
+ </xsl:if>
+ <xsl:if test="uof:主题">
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ </xsl:if>
+ <xsl:if test="uof:作者">
+ <meta:initial-creator>
+ <xsl:value-of select="uof:作者"/>
+ </meta:initial-creator>
+ </xsl:if>
+ <xsl:if test="uof:创建日期">
+ <meta:creation-date>
+ <xsl:value-of select="uof:创建日期"/>
+ </meta:creation-date>
+ </xsl:if>
+ <xsl:if test="uof:最后作者">
+ <dc:creator>
+ <xsl:value-of select="uof:最后作者"/>
+ </dc:creator>
+ </xsl:if>
+ <xsl:if test="uof:编辑时间">
+ <meta:editing-duration>
+ <xsl:value-of select="uof:编辑时间"/>
+ </meta:editing-duration>
+ </xsl:if>
+ <dc:language/>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ <xsl:if test="uof:编辑次数">
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ </xsl:if>
+ <xsl:if test="uof:分类">
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:经理名称">
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:经理名称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:公司名称">
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:公司名称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:apply-templates select="uof:用户自定义元数据集"/>
+ </office:meta>
+ </xsl:template>
+ <xsl:template match="uof:用户自定义元数据集">
+ <xsl:for-each select="uof:用户自定义元数据">
+ <meta:user-defined meta:name="{@uof:名称}">
+ <xsl:value-of select="."/>
+ </meta:user-defined>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="parse-range">
+ <xsl:param name="range-value"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="first-pit">
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:value-of select="substring-before($range-value,',')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$range-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="current">
+ <xsl:choose>
+ <xsl:when test="contains($first-pit,':')">
+ <xsl:variable name="R-start" select="substring-before(substring-after($first-pit,'R'),'C')"/>
+ <xsl:variable name="C-start" select="substring-before(substring-after($first-pit,'C'),':')"/>
+ <xsl:variable name="second-pit" select="substring-after($first-pit,':')"/>
+ <xsl:variable name="R-end" select="substring-before(substring-after($second-pit,'R'),'C')"/>
+ <xsl:variable name="C-end" select="substring-after($second-pit,'C')"/>
+ <xsl:variable name="the-str">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$R-start"/>
+ <xsl:with-param name="r-end" select="$R-end"/>
+ <xsl:with-param name="c-start" select="$C-start"/>
+ <xsl:with-param name="c-end" select="$C-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$the-str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($first-pit,',')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($range-value,',')">
+ <xsl:call-template name="parse-range">
+ <xsl:with-param name="range-value" select="substring-after($range-value,',')"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="condition-rc-str">
+ <!-- dealing the range of row\column -->
+ <xsl:param name="r-start"/>
+ <xsl:param name="r-end"/>
+ <xsl:param name="c-start"/>
+ <xsl:param name="c-end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="concat('R',$r-start)"/>
+ <xsl:with-param name="start" select="$c-start"/>
+ <xsl:with-param name="end" select="$c-end"/>
+ <xsl:with-param name="last" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$r-start &lt; $r-end">
+ <xsl:call-template name="condition-rc-str">
+ <xsl:with-param name="r-start" select="$r-start + 1"/>
+ <xsl:with-param name="r-end" select="$r-end"/>
+ <xsl:with-param name="c-start" select="$c-start"/>
+ <xsl:with-param name="c-end" select="$c-end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$r-start = $r-end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-c-str">
+ <!-- return value for the template condition-rc-str -->
+ <xsl:param name="rc-str"/>
+ <xsl:param name="start"/>
+ <xsl:param name="end"/>
+ <xsl:param name="last"/>
+ <xsl:variable name="current" select="concat($rc-str,'C',$start,',')"/>
+ <xsl:if test="$start &lt; $end">
+ <xsl:call-template name="condition-c-str">
+ <xsl:with-param name="rc-str" select="$rc-str"/>
+ <xsl:with-param name="start" select="$start + 1"/>
+ <xsl:with-param name="end" select="$end"/>
+ <xsl:with-param name="last" select="concat($last,$current)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$start = $end">
+ <xsl:value-of select="concat($last,$current)"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="condition-str">
+ <xsl:param name="param-str"/>
+ <xsl:choose>
+ <xsl:when test="contains($param-str,'(')">
+ <xsl:call-template name="condition-str">
+ <xsl:with-param name="param-str" select="substring-after($param-str,'(')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($param-str,':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-range-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <xsl:template name="encode-as-cell-address">
+ <xsl:param name="string"/>
+ <xsl:value-of select="$string"/>
+ </xsl:template>
+ <!--chengxiuzhi 111111111111111111111111111111111111111111111111111111111111111-->
+ <!-- measure_conversion.xsl Begin-->
+ <xsl:param name="dpi" select="111"/>
+ <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-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="substring-before($value, 'mm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="substring-before($value, 'cm')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to inch (cp. section comment) -->
+ <xsl:template name="convert2in">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="substring-before($value, 'in')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <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="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="substring-before($value, 'dpt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pica (cp. section comment) -->
+ <xsl:template name="convert2pica">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="substring-before($value, 'pica')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2pt">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="substring-before($value, 'pt')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- changing measure to pt (cp. section comment) -->
+ <xsl:template name="convert2twip">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'cm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="substring-before($value, 'twip')"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <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="convert2px">
+ <xsl:param name="value"/>
+ <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, 'pt')">
+ <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-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:when test="contains($value, 'pica')">
+ <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- chenjh zhangying-->
+ <xsl:template name="create-content-validations">
+ <xsl:param name="validation-set"/>
+ <xsl:if test="$validation-set">
+ <xsl:variable name="first-validation" select="$validation-set[1]"/>
+ <xsl:variable name="condition-text">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:校验类型/text()='whole number'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:操作码/text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()!=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&gt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&lt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&gt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-whole-number() and cell-content()&lt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='decimal'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:操作码/text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()!=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&gt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&lt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&gt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-decimal-number() and cell-content()&lt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='date'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:操作码/text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()!=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&gt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&lt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&gt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-date() and cell-content()&lt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='time'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:操作码/text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()!=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&gt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&lt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&gt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-is-time() and cell-content()&lt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <!-- add 20060317 -->
+ <xsl:when test="$first-validation/表:校验类型/text()='cell range'">
+ <xsl:value-of select="concat('oooc:cell-content-is-in-list',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:校验类型/text()='list'">
+ <xsl:value-of select="concat('oooc:cell-content-is-in-list',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <!-- add 20060317 end -->
+ <xsl:when test="$first-validation/表:校验类型/text()='text length'">
+ <xsl:choose>
+ <xsl:when test="$first-validation/表:操作码/text()='between' ">
+ <xsl:value-of select="concat('oooc:cell-content-text-length-is-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not between'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length-is-not-between','(',$first-validation/表:第一操作数/text(),',',$first-validation/表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='not equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()!=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&gt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&lt;',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='greater than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&gt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="$first-validation/表:操作码/text()='less than or equal to'">
+ <xsl:value-of select="concat('oooc:cell-content-text-length()&lt;=',$first-validation/表:第一操作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="table:content-validation">
+ <xsl:attribute name="table:name"><xsl:value-of select="concat('val',count($first-validation/preceding-sibling::表:数据有效性)+1)"/></xsl:attribute>
+ <xsl:attribute name="table:condition"><xsl:value-of select="$condition-text"/></xsl:attribute>
+ <xsl:attribute name="table:allow-empty-cell"><xsl:value-of select="$first-validation/表:忽略空格/@表:值"/></xsl:attribute>
+ <xsl:attribute name="table:base-cell-address"><xsl:value-of select="translate(substring-after($first-validation/表:区域/text(),':'),'$','')"/></xsl:attribute>
+ <xsl:if test="$first-validation/表:输入提示">
+ <xsl:element name="table:help-message">
+ <xsl:attribute name="table:title"><xsl:value-of select="$first-validation/表:输入提示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:value-of select="$first-validation/表:输入提示/@表:显示"/></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="$first-validation/表:输入提示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$first-validation/表:错误提示">
+ <xsl:element name="table:error-message">
+ <xsl:attribute name="table:title"><xsl:value-of select="$first-validation/表:错误提示/@表:标题"/></xsl:attribute>
+ <xsl:attribute name="table:display"><xsl:value-of select="$first-validation/表:错误提示/@表:显示"/></xsl:attribute>
+ <xsl:attribute name="table:message-type"><xsl:value-of select="$first-validation/表:错误提示/@表:类型"/></xsl:attribute>
+ <xsl:element name="text:p">
+ <xsl:value-of select="$first-validation/表:错误提示/@表:内容"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ <xsl:call-template name="create-content-validations">
+ <xsl:with-param name="validation-set" select="$validation-set[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!--RedOffice Comment from Zengjh:UOF0020 2006-04-26 charts-->
+ <xsl:template match="表:图表">
+ <xsl:param name="table-name"/>
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="'0'"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@表:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@表:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(@表:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(@表:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="chart-current">
+ <xsl:number level="any" count="表:图表" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="concat('chart', $chart-current)"/></xsl:attribute>
+ <xsl:variable name="series-value-start">
+ <xsl:for-each select="表:数据源/表:系列[position()='1']">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="series-value-end">
+ <xsl:for-each select="表:数据源/表:系列[position()=last()]">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="series-generate-type">
+ <xsl:choose>
+ <xsl:when test="表:数据源/@表序号产生">
+ <xsl:value-of select="表:数据源/@表序号产生"/>
+ </xsl:when>
+ <xsl:when test="substring(substring-after($series-value-start,'!'),2,1)=substring(substring-after($series-value-start,':'),2,1)">row</xsl:when>
+ <xsl:otherwise>col</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="draw:object">
+ <xsl:attribute name="draw:notify-on-update-of-ranges"><xsl:value-of select="表:数据源/@表:数据区域"/></xsl:attribute>
+ <office:document 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="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:version="1.0" office:mimetype="application/vnd.oasis.opendocument.chart">
+ <xsl:call-template name="表:元数据">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="@表:类型"/>
+ <xsl:with-param name="table-subtype" select="@表:子类型"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:式样集">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="@表:类型"/>
+ <xsl:with-param name="table-subtype" select="@表:子类型"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:主体">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="@表:类型"/>
+ <xsl:with-param name="table-subtype" select="@表:子类型"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </office:document>
+ </xsl:element>
+ <xsl:element name="draw:image">
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象/uof:数据"/>
+ </office:binary-data>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="表:元数据">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="/uof:UOF/uof:元数据">
+ <office:meta>
+ <meta:generator>OpenOffice.org 1.1.3 (Win32)</meta:generator>
+ <xsl:if test="uof:标题">
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ </xsl:if>
+ <xsl:if test="uof:摘要">
+ <dc:description>
+ <xsl:value-of select="uof:摘要"/>
+ </dc:description>
+ </xsl:if>
+ <xsl:if test="uof:主题">
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ </xsl:if>
+ <xsl:if test="uof:作者">
+ <meta:initial-creator>
+ <xsl:value-of select="uof:作者"/>
+ </meta:initial-creator>
+ </xsl:if>
+ <xsl:if test="uof:创建日期">
+ <meta:creation-date>
+ <xsl:value-of select="uof:创建日期"/>
+ </meta:creation-date>
+ </xsl:if>
+ <xsl:if test="uof:最后作者">
+ <dc:creator>
+ <xsl:value-of select="uof:最后作者"/>
+ </dc:creator>
+ </xsl:if>
+ <xsl:if test="uof:编辑时间">
+ <meta:editing-duration>
+ <xsl:value-of select="uof:编辑时间"/>
+ </meta:editing-duration>
+ </xsl:if>
+ <dc:language/>
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ </meta:keywords>
+ <xsl:if test="uof:编辑次数">
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ </xsl:if>
+ <xsl:if test="uof:分类">
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:经理名称">
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:经理名称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:公司名称">
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:公司名称"/>
+ </meta:user-defined>
+ </xsl:if>
+ <xsl:if test="uof:创建应用程序">
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="uof:创建应用程序"/>
+ </meta:user-defined>
+ </xsl:if>
+ </office:meta>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:式样集">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <office:styles>
+ <draw:stroke-dash draw:name="Ultrafine_20_Dashed" draw:display-name="Ultrafine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.051cm" draw:dots2="1" draw:dots2-length="0.051cm" draw:distance="0.051cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed" draw:display-name="Fine Dashed" draw:style="rect" draw:dots1="1" draw:dots1-length="0.508cm" draw:dots2="1" draw:dots2-length="0.508cm" draw:distance="0.508cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_2_20_Dots_20_3_20_Dashes" draw:display-name="Ultrafine 2 Dots 3 Dashes" draw:style="rect" draw:dots1="2" draw:dots1-length="0.051cm" draw:dots2="3" draw:dots2-length="0.254cm" draw:distance="0.127cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Fine_20_Dashed_20__28_var_29_" draw:display-name="Fine Dashed (var)" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="197%"/>
+ <draw:stroke-dash draw:name="Fine_20_Dotted" draw:display-name="Fine Dotted" draw:style="rect" draw:dots1="1" draw:distance="0.457cm"/>
+ <draw:stroke-dash draw:name="Line_20_with_20_Fine_20_Dots" draw:display-name="Line with Fine Dots" draw:style="rect" draw:dots1="1" draw:dots1-length="2.007cm" draw:dots2="10" draw:distance="0.152cm"/>
+ <draw:stroke-dash draw:name="Line_20_Style_20_9" draw:display-name="Line Style 9" draw:style="rect" draw:dots1="1" draw:dots1-length="197%" draw:distance="120%"/>
+ <draw:stroke-dash draw:name="_33__20_Dashes_20_3_20_Dots_20__28_var_29_" draw:display-name="3 Dashes 3 Dots (var)" draw:style="rect" draw:dots1="3" draw:dots1-length="197%" draw:dots2="3" draw:distance="100%"/>
+ <draw:stroke-dash draw:name="_32__20_Dots_20_1_20_Dash" draw:display-name="2 Dots 1 Dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.203cm" draw:distance="0.203cm"/>
+ <draw:stroke-dash draw:name="Ultrafine_20_Dotted_20__28_var_29_" draw:display-name="Ultrafine Dotted (var)" draw:style="rect" draw:dots1="1" draw:distance="50%"/>
+ <draw:stroke-dash draw:name="Dash_20_10" draw:display-name="Dash 10" draw:style="rect" draw:dots1="1" draw:dots1-length="0.02cm" draw:dots2="1" draw:dots2-length="0.02cm" draw:distance="0.02cm"/>
+ <xsl:for-each select="//图:图片">
+ <xsl:variable name="chart-image-name" select="@图:名称"/>
+ <draw:fill-image>
+ <xsl:attribute name="draw:name"><xsl:value-of select="@图:名称"/></xsl:attribute>
+ <office:binary-data>
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$chart-image-name]">
+ <xsl:value-of select="uof:数据"/>
+ </xsl:for-each>
+ </office:binary-data>
+ </draw:fill-image>
+ </xsl:for-each>
+ <xsl:for-each select="//图:图案">
+ <xsl:variable name="chart-hatch-name" select="@图:图形引用"/>
+ <draw:hatch>
+ <xsl:if test="@图:图形引用">
+ <xsl:attribute name="draw:name"><xsl:value-of select="$chart-hatch-name"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:类型">
+ <xsl:attribute name="draw:style"><xsl:value-of select="@图:类型"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:前景色">
+ <xsl:attribute name="draw:color"><xsl:value-of select="@图:前景色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:距离">
+ <xsl:attribute name="draw:distance"><xsl:value-of select="@图:距离"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:旋转度">
+ <xsl:attribute name="draw:rotation"><xsl:value-of select="@图:旋转度"/></xsl:attribute>
+ </xsl:if>
+ </draw:hatch>
+ </xsl:for-each>
+ <xsl:for-each select="//图:渐变">
+ <draw:gradient>
+ <xsl:if test="@图:图形引用">
+ <xsl:attribute name="draw:name"><xsl:value-of select="@图:图形引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:起始色">
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="@图:起始色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:终止色">
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="@图:终止色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:种子类型">
+ <xsl:attribute name="draw:style"><xsl:value-of select="@图:种子类型"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:起始浓度">
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="@图:起始浓度"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:终止浓度">
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="@图:终止浓度"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:渐变方向">
+ <xsl:attribute name="draw:angle"><xsl:value-of select="@图:渐变方向"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:边界">
+ <xsl:attribute name="draw:border"><xsl:value-of select="@图:边界"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:种子X位置">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="@图:种子X位置"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@图:种子Y位置">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="@图:种子Y位置"/></xsl:attribute>
+ </xsl:if>
+ </draw:gradient>
+ </xsl:for-each>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:图表区'">
+ <xsl:call-template name="表:图表区式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:绘图区'">
+ <xsl:call-template name="表:绘图区式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:图表背景墙式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:分类轴'">
+ <xsl:call-template name="表:分类轴式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数值轴'">
+ <xsl:call-template name="表:数值轴式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:图例'">
+ <xsl:call-template name="表:图例式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数据表'">
+ <xsl:call-template name="表:数据表式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数据系列集'">
+ <xsl:call-template name="表:数据系列集式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数据点集'">
+ <xsl:call-template name="表:数据点集式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:网格线集'">
+ <xsl:call-template name="表:网格线集式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数据源'">
+ <xsl:call-template name="表:数据源式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name(.)='表:标题集'">
+ <xsl:call-template name="表:标题集式样">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </office:automatic-styles>
+ </xsl:template>
+ <xsl:template name="表:主体">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <office:body>
+ <office:chart>
+ <chart:chart>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(@表:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(@表:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="chart:class"><xsl:choose><xsl:when test="$table-type='column'">chart:bar</xsl:when><xsl:when test="$table-type='line'">chart:line</xsl:when><xsl:when test="$table-type='pie'"><xsl:choose><xsl:when test="$table-subtype='pie_ring'">chart:ring</xsl:when><xsl:otherwise>chart:circle</xsl:otherwise></xsl:choose></xsl:when><xsl:otherwise><xsl:value-of select="$table-type"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="chart:style-name">chart-area</xsl:attribute>
+ <xsl:for-each select="表:标题集/表:标题[@表:位置='chart']">
+ <chart:title chart:style-name="chart-title">
+ <text:p>
+ <xsl:value-of select="@表:名称"/>
+ </text:p>
+ </chart:title>
+ </xsl:for-each>
+ <xsl:call-template name="表:图例区域">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:绘图区域">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <xsl:call-template name="表:本地表">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </chart:chart>
+ </office:chart>
+ </office:body>
+ </xsl:template>
+ <xsl:template name="表:图例区域">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <chart:legend>
+ <xsl:attribute name="chart:legend-position"><xsl:choose><xsl:when test="表:图例/@表:位置"><xsl:value-of select="表:图例/@表:位置"/></xsl:when><xsl:otherwise>right</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(表:图例/@表:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(表:图例/@表:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="chart:style-name">legend</xsl:attribute>
+ </chart:legend>
+ </xsl:template>
+ <xsl:template name="表:绘图区域">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <chart:plot-area>
+ <xsl:variable name="start-range">
+ <xsl:value-of select="concat('.$',substring(substring-after($series-value-start,'!'),1,1),'$',substring-before(substring(substring-after($series-value-start,'!'),2),':'))"/>
+ </xsl:variable>
+ <xsl:variable name="end-range">
+ <xsl:value-of select="concat(':.$',substring(substring-after($series-value-end,':'),1,1),'$',substring(substring-after($series-value-end,':'),2))"/>
+ </xsl:variable>
+ <xsl:attribute name="chart:style-name">plot-area</xsl:attribute>
+ <xsl:attribute name="table:cell-range-address"><xsl:value-of select="concat($table-name,$start-range,$end-range)"/></xsl:attribute>
+ <!--xsl:value-of select="表:数据源/@表:数据区域"/-->
+ <xsl:attribute name="chart:table-number-list">0</xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(表:绘图区/@表:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(表:绘图区/@表:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(表:绘图区/@表:x坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(表:绘图区/@表:y坐标,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="表:分类轴">
+ <chart:axis chart:dimension="x" chart:name="primary-x" chart:style-name="category-axis">
+ <xsl:for-each select="表:标题集/表:标题[@表:位置='category axis']">
+ <chart:title chart:style-name="category-axis-title">
+ <text:p>
+ <xsl:value-of select="@表:名称"/>
+ </text:p>
+ </chart:title>
+ </xsl:for-each>
+ <chart:categories/>
+ <xsl:if test="表:网格线集/表:网格线[@表:位置='category axis']">
+ <chart:grid chart:style-name="category-axis-grid" chart:class="major"/>
+ </xsl:if>
+ </chart:axis>
+ </xsl:if>
+ <xsl:if test="表:数值轴">
+ <chart:axis chart:dimension="y" chart:name="primary-y" chart:style-name="value-axis">
+ <xsl:for-each select="表:标题集/表:标题[@表:位置='value axis']">
+ <chart:title chart:style-name="value-axis-title">
+ <text:p>
+ <xsl:value-of select="@表:名称"/>
+ </text:p>
+ </chart:title>
+ </xsl:for-each>
+ <chart:grid chart:style-name="value-axis-grid" chart:class="major"/>
+ </chart:axis>
+ </xsl:if>
+ <xsl:call-template name="表:数据组">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ <chart:wall>
+ <xsl:attribute name="chart:style-name">chart-wall</xsl:attribute>
+ </chart:wall>
+ <chart:floor>
+ <xsl:attribute name="chart:style-name">chart-floor</xsl:attribute>
+ </chart:floor>
+ </chart:plot-area>
+ </xsl:template>
+ <xsl:template name="表:本地表">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <table:table table:name="local-table">
+ <table:table-header-columns>
+ <xsl:call-template name="表:本地表_表头列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="sum" select="1"/>
+ </xsl:call-template>
+ </table:table-header-columns>
+ <table:table-columns>
+ <xsl:variable name="column-sum">
+ <xsl:value-of select="count(表:数据源/表:系列)"/>
+ </xsl:variable>
+ <xsl:call-template name="表:本地表_列">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="column-sum" select="$column-sum"/>
+ </xsl:call-template>
+ </table:table-columns>
+ <table:table-header-rows>
+ <xsl:call-template name="表:本地表_表头行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="1"/>
+ <xsl:with-param name="fixed-row-sum" select="'1'"/>
+ </xsl:call-template>
+ </table:table-header-rows>
+ <table:table-rows>
+ <xsl:variable name="row-start">
+ <xsl:value-of select="substring-before(substring(substring-after($series-value-start,'!'),2),':')"/>
+ </xsl:variable>
+ <xsl:variable name="row-end">
+ <xsl:value-of select="substring(substring-after($series-value-end,':'),2)"/>
+ </xsl:variable>
+ <xsl:variable name="fixed-row-sum">
+ <xsl:value-of select="$row-end -$row-start +1"/>
+ </xsl:variable>
+ <xsl:call-template name="表:本地表_行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="'1'"/>
+ <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/>
+ </xsl:call-template>
+ </table:table-rows>
+ </table:table>
+ </xsl:template>
+ <xsl:template name="表:本地表_表头列">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="sum"/>
+ <xsl:choose>
+ <xsl:when test="$sum=0"/>
+ <xsl:otherwise>
+ <table:table-column/>
+ <xsl:call-template name="表:本地表_表头列">
+ <xsl:with-param name="sum" select="$sum -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_列">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="column-sum"/>
+ <xsl:choose>
+ <xsl:when test="$column-sum=0"/>
+ <xsl:otherwise>
+ <table:table-column/>
+ <xsl:call-template name="表:本地表_列">
+ <xsl:with-param name="column-sum" select="$column-sum -1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_表头行">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="fixed-row-sum"/>
+ <xsl:choose>
+ <xsl:when test="$row-current >$fixed-row-sum"/>
+ <xsl:otherwise>
+ <table:table-row>
+ <xsl:variable name="series-value-current">
+ <xsl:for-each select="表:数据源/表:系列[position()=$row-current]">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-end">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,':'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-end,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cell-sum">
+ <xsl:value-of select="$cell-end -$cell-start +2"/>
+ </xsl:variable>
+ <xsl:variable name="fixed-cell-sum" select="$cell-sum"/>
+ <xsl:call-template name="表:本地表_表头行_单元格">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </table:table-row>
+ <xsl:call-template name="表:本地表_表头行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="$row-current +1"/>
+ <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_表头行_单元格">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="series-value-current"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="cell-sum"/>
+ <xsl:param name="fixed-cell-sum"/>
+ <xsl:choose>
+ <xsl:when test="$cell-sum=0"/>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$fixed-cell-sum=$cell-sum">
+ <table:table-cell>
+ <text:p/>
+ </table:table-cell>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell office:value-type="string">
+ <xsl:variable name="cell-no">
+ <xsl:value-of select="$fixed-cell-sum -$cell-sum +1"/>
+ </xsl:variable>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="char">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$cell-start +$cell-no -2"/>
+ <xsl:with-param name="output-type" select="'CHARS_UPPER_LETTER'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <text:p>
+ <xsl:value-of select="concat('列 ',$char)"/>
+ </text:p>
+ </table:table-cell>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="表:本地表_表头行_单元格">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum -1"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_行">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="fixed-row-sum"/>
+ <xsl:choose>
+ <xsl:when test="$row-current >$fixed-row-sum"/>
+ <xsl:otherwise>
+ <xsl:variable name="series-value-current">
+ <xsl:for-each select="表:数据源/表:系列[position()=$row-current]">
+ <xsl:value-of select="@表:系列值"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <table:table-row>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-end">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,':'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-end,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cell-sum">
+ <xsl:value-of select="$cell-end -$cell-start +2"/>
+ </xsl:variable>
+ <xsl:variable name="fixed-cell-sum" select="$cell-sum"/>
+ <xsl:call-template name="表:本地表_行_单元格">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </table:table-row>
+ <xsl:call-template name="表:本地表_行">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="row-current" select="$row-current +1"/>
+ <xsl:with-param name="fixed-row-sum" select="$fixed-row-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:本地表_行_单元格">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="series-value-current"/>
+ <xsl:param name="row-current"/>
+ <xsl:param name="cell-sum"/>
+ <xsl:param name="fixed-cell-sum"/>
+ <xsl:choose>
+ <xsl:when test="$cell-sum=0"/>
+ <xsl:otherwise>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-no">
+ <xsl:value-of select="$cell-start +$fixed-cell-sum -$cell-sum -1"/>
+ </xsl:variable>
+ <xsl:variable name="row-start">
+ <xsl:value-of select="substring(substring-after($series-value-start,'!'),2,1)"/>
+ </xsl:variable>
+ <xsl:variable name="row-no">
+ <xsl:value-of select="$row-start +$row-current -1"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$fixed-cell-sum=$cell-sum">
+ <table:table-cell office:value-type="string">
+ <text:p>
+ <xsl:value-of select="concat('行 ',$row-no)"/>
+ </text:p>
+ </table:table-cell>
+ </xsl:when>
+ <xsl:otherwise>
+ <table:table-cell office:value-type="float">
+ <xsl:variable name="cell-content">
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行/@表:行号">
+ <xsl:for-each select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行[@表:行号=$row-no]">
+ <xsl:for-each select="表:单元格[@表:列号=$cell-no]">
+ <xsl:value-of select="表:数据/字:句/字:文本串"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="/uof:UOF/uof:电子表格/表:主体/表:工作表/表:工作表内容/表:行[position()=$row-no]">
+ <xsl:for-each select="表:单元格[position()=$cell-no]">
+ <xsl:value-of select="表:数据/字:句/字:文本串"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:value"><xsl:value-of select="$cell-content"/></xsl:attribute>
+ <text:p>
+ <xsl:value-of select="$cell-content"/>
+ </text:p>
+ </table:table-cell>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="表:本地表_行_单元格">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="series-value-current" select="$series-value-current"/>
+ <xsl:with-param name="row-current" select="$row-current"/>
+ <xsl:with-param name="cell-sum" select="$cell-sum -1"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:数据组">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:variable name="input-char-start">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:value-of select="substring(substring-after($series-value-start,'!'),1,1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(substring(substring-after($series-value-start,'!'),2),':')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="input-char-end">
+ <xsl:choose>
+ <xsl:when test="$series-generate-type='row'">
+ <xsl:value-of select="substring(substring-after($series-value-start,':'),1,1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring(substring-after($series-value-start,':'),2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cell-start">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$input-char-start"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="cell-end">
+ <xsl:call-template name="General-Char-Transition">
+ <xsl:with-param name="input-char" select="$input-char-end"/>
+ <xsl:with-param name="output-type" select="'ARABIC'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="fixed-cell-sum">
+ <xsl:value-of select="$cell-end -$cell-start +1"/>
+ </xsl:variable>
+ <xsl:for-each select="表:数据系列集/表:数据系列">
+ <chart:series>
+ <xsl:attribute name="chart:style-name"><xsl:value-of select="concat('data-series',position())"/></xsl:attribute>
+ <xsl:call-template name="表:数据点">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="data-series-current" select="position()"/>
+ <xsl:with-param name="cell-current" select="'1'"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </chart:series>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:数据点">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="data-series-current"/>
+ <xsl:param name="cell-current"/>
+ <xsl:param name="fixed-cell-sum"/>
+ <xsl:choose>
+ <xsl:when test="$cell-current>$fixed-cell-sum"/>
+ <xsl:otherwise>
+ <chart:data-point>
+ <xsl:attribute name="chart:style-name"><xsl:value-of select="concat('data-point',$data-series-current,$cell-current)"/></xsl:attribute>
+ </chart:data-point>
+ <xsl:call-template name="表:数据点">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="data-series-current" select="$data-series-current"/>
+ <xsl:with-param name="cell-current" select="$cell-current +1"/>
+ <xsl:with-param name="fixed-cell-sum" select="$fixed-cell-sum"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="表:图表区式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="chart-area" style:family="chart">
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="字:句属性类型"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:绘图区式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="plot-area" style:family="chart">
+ <style:chart-properties>
+ <xsl:choose>
+ <xsl:when test="$table-subtype='bar_stacked' or $table-subtype='column_stacked' or $table-subtype='line_stacked'">
+ <xsl:attribute name="chart:stacked">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$table-subtype='bar_percent' or $table-subtype='column_percent' or $table-subtype='line_percent'">
+ <xsl:attribute name="chart:percentage">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="chart:vertical"><xsl:choose><xsl:when test="$table-type='bar'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="chart:series-source"><xsl:choose><xsl:when test="$series-generate-type='row'">rows</xsl:when><xsl:otherwise>columns</xsl:otherwise></xsl:choose></xsl:attribute>
+ </style:chart-properties>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:图表背景墙式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="chart-wall" style:family="chart">
+ <style:graphic-properties>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <xsl:call-template name="图:填充类型"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:分类轴式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="category-axis" style:family="chart">
+ <xsl:call-template name="表:坐标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="axis-type" select="'category axis'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:数值轴式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="value-axis" style:family="chart">
+ <xsl:call-template name="表:坐标轴类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="axis-type" select="'value axis'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:图例式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="legend" style:family="chart">
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="字:句属性类型"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:数据表式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <style:style style:name="data-table" style:family="chart">
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="字:句属性类型"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="表:数据系列集式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:数据系列">
+ <style:style style:family="chart">
+ <xsl:variable name="current-positon" select="position()"/>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('data-series',$current-positon)"/></xsl:attribute>
+ <xsl:call-template name="表:数据点类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="recall-type" select="'data-series'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:数据点集式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:数据点">
+ <style:style style:family="chart">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('data-point',@表:系列,@表:点)"/></xsl:attribute>
+ <xsl:call-template name="表:数据点类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ <xsl:with-param name="recall-type" select="'data-point'"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:网格线集式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:网格线">
+ <xsl:choose>
+ <xsl:when test="@表:位置='category axis'">
+ <style:style style:name="category-axis-grid" style:family="chart">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@表:位置='value axis'">
+ <style:style style:name="value-axis-grid" style:family="chart">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:数据源式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:系列">
+ <style:style style:family="chart">
+ <xsl:variable name="current-positon" select="position()"/>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('data-source',$current-positon)"/></xsl:attribute>
+ </style:style>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:标题集式样">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="表:标题">
+ <xsl:choose>
+ <xsl:when test="@表:位置='chart'">
+ <style:style style:name="chart-title" style:family="chart">
+ <xsl:call-template name="表:标题类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@表:位置='category axis'">
+ <style:style style:name="category-axis-title" style:family="chart">
+ <xsl:call-template name="表:标题类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:when>
+ <xsl:when test="@表:位置='value axis'">
+ <style:style style:name="value-axis-title" style:family="chart">
+ <xsl:call-template name="表:标题类型">
+ <xsl:with-param name="table-name" select="$table-name"/>
+ <xsl:with-param name="table-type" select="$table-type"/>
+ <xsl:with-param name="table-subtype" select="$table-subtype"/>
+ <xsl:with-param name="series-value-start" select="$series-value-start"/>
+ <xsl:with-param name="series-value-end" select="$series-value-end"/>
+ <xsl:with-param name="series-generate-type" select="$series-generate-type"/>
+ </xsl:call-template>
+ </style:style>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:坐标轴类型">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="axis-type"/>
+ <style:chart-properties>
+ <xsl:choose>
+ <xsl:when test="@表:主刻度类型='cross'">
+ <xsl:attribute name="chart:tick-marks-major-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-major-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:主刻度类型='inside'">
+ <xsl:attribute name="chart:tick-marks-major-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-major-outer">false</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:主刻度类型='outside'">
+ <xsl:attribute name="chart:tick-marks-major-inner">false</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-major-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@表:次刻度类型='cross'">
+ <xsl:attribute name="chart:tick-marks-minor-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-minor-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:次刻度类型='inside'">
+ <xsl:attribute name="chart:tick-marks-minor-inner">true</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-minor-outer">false</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@表:次刻度类型='outside'">
+ <xsl:attribute name="chart:tick-marks-minor-inner">false</xsl:attribute>
+ <xsl:attribute name="chart:tick-marks-minor-outer">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:if test="@表:刻度线标志='next to axis'">
+ <xsl:attribute name="chart:display-label">true</xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:线型'">
+ <xsl:call-template name="uof:线型"/>
+ </xsl:when>
+ <xsl:when test="name(.)='表:数值'">
+ <xsl:attribute name="chart:link-data-style-to-source"><xsl:value-of select="@表:链接到源"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="name(.)='表:刻度'">
+ <xsl:call-template name="表:刻度类型"/>
+ </xsl:when>
+ <xsl:when test="name(.)='表:对齐'">
+ <xsl:if test="表:文字方向">
+ <xsl:attribute name="fo:direction"><xsl:value-of select="表:文字方向"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:旋转角度">
+ <xsl:attribute name="text:rotation-angle"><xsl:value-of select="表:旋转角度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </style:chart-properties>
+ <xsl:if test="表:字体">
+ <xsl:for-each select="表:字体">
+ <xsl:element name="style:text-properties">
+ <xsl:call-template name="字:句属性类型"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:数据点类型">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:param name="recall-type"/>
+ <xsl:if test="name(.)='表:数据点'">
+ <style:chart-properties>
+ <xsl:if test="$table-type='pie' and $table-subtype='pie_offset1' and @表:点='1'">
+ <xsl:attribute name="chart:pie-offset">10</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$table-type='pie' and $table-subtype='pie_offset2'">
+ <xsl:attribute name="chart:pie-offset">10</xsl:attribute>
+ </xsl:if>
+ </style:chart-properties>
+ </xsl:if>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="字:句属性类型"/>
+ </style:text-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:显示标志'">
+ <style:chart-properties>
+ <xsl:if test="@表:类别名">
+ <xsl:attribute name="chart:data-label-text"><xsl:value-of select="@表:类别名"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:数值">
+ <xsl:attribute name="chart:data-label-number">value</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:百分数">
+ <xsl:attribute name="chart:data-label-number">percentage</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@表:图例标志">
+ <xsl:attribute name="chart:data-label-symbol"><xsl:value-of select="@表:图例标志"/></xsl:attribute>
+ </xsl:if>
+ </style:chart-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="表:标题类型">
+ <xsl:param name="table-name"/>
+ <xsl:param name="table-type"/>
+ <xsl:param name="table-subtype"/>
+ <xsl:param name="series-value-start"/>
+ <xsl:param name="series-value-end"/>
+ <xsl:param name="series-generate-type"/>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name(.)='表:边框'">
+ <style:graphic-properties>
+ <xsl:call-template name="uof:边框"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:填充'">
+ <style:graphic-properties>
+ <xsl:call-template name="图:填充类型"/>
+ </style:graphic-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:对齐'">
+ <style:chart-properties>
+ <xsl:call-template name="表:对齐格式类型"/>
+ </style:chart-properties>
+ </xsl:when>
+ <xsl:when test="name(.)='表:字体'">
+ <style:text-properties>
+ <xsl:call-template name="字:句属性类型"/>
+ </style:text-properties>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="uof:边框">
+ <xsl:if test="@uof:类型">
+ <xsl:variable name="type" select="@uof:类型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="@uof:类型='single'">solid</xsl:when><xsl:when test="@uof:类型='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$type='dash'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$type='dot-dash'">Ultrafine_20_2_20_Dots_20_3_20_Dashes</xsl:when><xsl:when test="$type='dashed-heavy'">Fine_20_Dashed</xsl:when><xsl:when test="$type='dotted' ">Fine_20_Dotted</xsl:when><xsl:when test="$type='dash-long-heavy'">Line_20_with_20_Fine_20_Dots</xsl:when><xsl:when test="$type='dash-long'">Fine_20_Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-dot'">_33__20_Dashes_20_3_20_Dots_20__28_var_29_</xsl:when><xsl:when test="$type='dotted-heavy'">Ultrafine_20_Dotted_20__28_var_29_</xsl:when><xsl:when test="$type='thick'">Line_20_Style_20_9</xsl:when><xsl:when test="$type='dot-dot-dash'">_32__20_Dots_20_1_20_Dash</xsl:when><xsl:when test="$type='dash-dot-dot-heavy'">Dashed_20__28_var_29_</xsl:when><xsl:when test="$type='dash-dot-heavy'">Dash_20_10</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:宽度">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(@uof:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="@uof:颜色"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="图:填充类型">
+ <xsl:if test="图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:图片">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:value-of select="图:图片/@图:名称"/></xsl:attribute>
+ <xsl:if test="not(图:图片/@图:位置='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-hatch-name"><xsl:value-of select="图:图案/@图:图形引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:渐变">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="图:渐变/@图:图形引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:线型">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:template>
+ <xsl:template name="字:句属性类型">
+ <xsl:apply-templates select="./*"/>
+ </xsl:template>
+ <xsl:template name="表:刻度类型">
+ <xsl:if test="表:最小值">
+ <xsl:attribute name="chart:minimum"><xsl:value-of select="表:最小值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:最大值">
+ <xsl:attribute name="chart:maximum"><xsl:value-of select="表:最大值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:主单位">
+ <xsl:attribute name="chart:interval-major"><xsl:value-of select="表:主单位"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:次单位">
+ <xsl:attribute name="chart:interval-minor"><xsl:value-of select="表:次单位"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:分类交叉点">
+ <xsl:attribute name="chart:origin"><xsl:value-of select="表:分类交叉点"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="表:对齐格式类型">
+ <xsl:if test="表:文字方向">
+ <xsl:attribute name="style:direction"><xsl:value-of select="表:文字方向"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="表:文字旋转角度">
+ <xsl:attribute name="style:rotation-angle"><xsl:value-of select="表:文字旋转角度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:字体">
+ <xsl:if test="@字:字号">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:相对字号 and self::node( )[not(parent::字:句属性)]">
+ <xsl:variable name="stylename" select="parent::node()/@字:基式样引用"/>
+ <xsl:variable name="zihao">
+ <xsl:for-each select="/uof:UOF/uof:式样集//uof:段落式样[@字:标识符=$stylename]">
+ <xsl:value-of select="字:字体/@字:字号"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="font-size" select="@字:相对字号"/>
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="string(@字:颜色)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:中文字体引用">
+ <xsl:attribute name="style:font-family-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:西文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="@字:西文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:斜体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:粗体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:下划线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'double'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'thick'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted-heavy'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dashed-heavy'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wave'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-heavy'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-double'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@字:颜色">
+ <xsl:attribute name="style:text-underline-color"><xsl:choose><xsl:when test="@字:颜色='auto'">font-color</xsl:when><xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:着重号">
+ <xsl:if test="not(@字:类型='none')">
+ <xsl:choose>
+ <xsl:when test="@字:类型='accent above' ">
+ <xsl:attribute name="style:text-emphasize">accent above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot above' ">
+ <xsl:attribute name="style:text-emphasize">dot above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc above' ">
+ <xsl:attribute name="style:text-emphasize">disc above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle above' ">
+ <xsl:attribute name="style:text-emphasize">circle above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='accent below' ">
+ <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot below' ">
+ <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc below' ">
+ <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle below' ">
+ <xsl:attribute name="style:text-emphasize">circle below</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:隐藏文字">
+ <xsl:attribute name="text:display"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:空心">
+ <xsl:attribute name="style:text-outline"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:阴影">
+ <xsl:if test="not(@字:值='false')">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:删除线">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@字:类型='double'">
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='single'">
+ <xsl:attribute name="style:text-underline-mode">continuous</xsl:attribute>
+ <xsl:attribute name="style:text-line-through-mode">continuous</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='bold'">
+ <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='带/'">
+ <xsl:attribute name="style:text-line-through-text">/</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='带X'">
+ <xsl:attribute name="style:text-line-through-text">X</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="@字:颜色[not(.='auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:浮雕">
+ <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="@字:类型='engrave'">engraved</xsl:when><xsl:when test="@字:类型='emboss'">embossed</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:醒目字体">
+ <xsl:choose>
+ <xsl:when test="@字:类型='small-caps'">
+ <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='none'">
+ <xsl:attribute name="fo:font-variant">normal</xsl:attribute>
+ <xsl:attribute name="fo:text-transform">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-transform"><xsl:choose><xsl:when test="@字:类型='uppercase'">uppercase</xsl:when><xsl:when test="@字:类型='lowercase'">lowercase</xsl:when><xsl:when test="@字:类型='capital'">capitalize</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:位置">
+ <xsl:attribute name="style:text-position"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:字符间距">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:调整字间距">
+ <xsl:attribute name="style:letter-kerning"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:外框">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:字符间距[parent::字:句属性]">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( number(.)* $other-to-cm-conversion-factor, $uofUnit)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="General-Char-Transition">
+ <xsl:param name="input-char"/>
+ <xsl:param name="output-type"/>
+ <xsl:choose>
+ <xsl:when test="$input-char='A' or $input-char='a' or $input-char='1' or $input-char='Roman_I' or $input-char='Roman_i' or $input-char='一' or $input-char='壹' or $input-char='甲' or $input-char='子'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">甲</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">子</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='B' or $input-char='b' or $input-char='2' or $input-char='Roman_II' or $input-char='Roman_ii' or $input-char='二' or $input-char='贰' or $input-char='乙' or $input-char='丑'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">2</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">b</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">B</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">II</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">2</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">2</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">2</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">乙</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">丑</xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='C' or $input-char='c' or $input-char='3' or $input-char='Roman_III' or $input-char='Roman_iii' or $input-char='三' or $input-char='叁' or $input-char='丙' or $input-char='寅'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">c</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">C</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">III</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">3</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">叁</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">3</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">丙</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">寅</xsl:when>
+ <xsl:otherwise>3</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='D' or $input-char='d' or $input-char='4' or $input-char='Roman_IV' or $input-char='Roman_iv' or $input-char='四' or $input-char='肆' or $input-char='丁' or $input-char='卯'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">4</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">d</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">D</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">iv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">4</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">四</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">4</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">4</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">丁</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">卯</xsl:when>
+ <xsl:otherwise>4</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='E' or $input-char='e' or $input-char='5' or $input-char='Roman_V' or $input-char='Roman_v' or $input-char='五' or $input-char='伍' or $input-char='戊' or $input-char='辰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">e</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">E</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">v</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">5</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">伍</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">5</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">戊</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">辰</xsl:when>
+ <xsl:otherwise>5</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='F' or $input-char='f' or $input-char='6' or $input-char='Roman_VI' or $input-char='Roman_vi' or $input-char='六' or $input-char='陆' or $input-char='己' or $input-char='巳'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">6</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">f</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">F</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">6</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">六</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">6</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">6</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">己</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">巳</xsl:when>
+ <xsl:otherwise>6</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='G' or $input-char='g' or $input-char='7' or $input-char='7' or $input-char='Roman_VII' or $input-char='Roman_vii' or $input-char='七' or $input-char='柒' or $input-char='庚' or $input-char='午'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">7</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">g</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">G</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">vii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">7</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">7</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">7</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">庚</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">午</xsl:when>
+ <xsl:otherwise>7</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='H' or $input-char='h' or $input-char='8' or $input-char='Roman_VIII' or $input-char='Roman_viii' or $input-char='八' or $input-char='捌' or $input-char='辛' or $input-char='未'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">h</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">H</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">VIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">viii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">八</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">8</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">捌</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">8</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">辛</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">未</xsl:when>
+ <xsl:otherwise>8</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='I' or $input-char='i' or $input-char='9' or $input-char='Roman_IX' or $input-char='Roman_ix' or $input-char='九' or $input-char='玖' or $input-char='壬' or $input-char='申'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">9</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">i</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">IX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">ix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">9</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">九</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">9</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">9</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">壬</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">申</xsl:when>
+ <xsl:otherwise>9</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='J' or $input-char='j' or $input-char='10' or $input-char='Roman_X' or $input-char='Roman_x' or $input-char='十' or $input-char='拾' or $input-char='癸' or $input-char='酉'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">j</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">J</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">x</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">10</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">10</xsl:when>
+ <xsl:when test="$output-type='TIAN_GAN_ZH'">癸</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">酉</xsl:when>
+ <xsl:otherwise>10</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='K' or $input-char='k' or $input-char='11' or $input-char='Roman_XI' or $input-char='Roman_xi' or $input-char='十一' or $input-char='拾壹' or $input-char='戌'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">k</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">K</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">11</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">11</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">戌</xsl:when>
+ <xsl:otherwise>11</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='L' or $input-char='l' or $input-char='12' or $input-char='Roman_XII' or $input-char='Roman_xii' or $input-char='十二' or $input-char='拾贰' or $input-char='亥'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">l</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">L</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">12</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">12</xsl:when>
+ <xsl:when test="$output-type='DI_ZI_ZH'">亥</xsl:when>
+ <xsl:otherwise>12</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='M' or $input-char='m' or $input-char='13' or $input-char='Roman_XIII' or $input-char='Roman_xiii' or $input-char='十三' or $input-char='拾叁'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">m</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">M</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">13</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾叁</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">13</xsl:when>
+ <xsl:otherwise>13</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='N' or $input-char='n' or $input-char='14' or $input-char='Roman_XIV' or $input-char='Roman_xiv' or $input-char='十四' or $input-char='拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">n</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">N</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十四</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">14</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">14</xsl:when>
+ <xsl:otherwise>14</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='O' or $input-char='o' or $input-char='15' or $input-char='Roman_XV' or $input-char='Roman_xv' or $input-char='十五' or $input-char='拾伍'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">o</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">O</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">15</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾伍</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">15</xsl:when>
+ <xsl:otherwise>15</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='P' or $input-char='p' or $input-char='16' or $input-char='Roman_XVI' or $input-char='Roman_xvi' or $input-char='十六' or $input-char='拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">p</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">P</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十六</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">16</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">16</xsl:when>
+ <xsl:otherwise>16</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Q' or $input-char='q' or $input-char='17' or $input-char='Roman_XVII' or $input-char='Roman_xvii' or $input-char='十七' or $input-char='拾柒'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">q</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Q</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xvii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十七</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">17</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾柒</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">17</xsl:when>
+ <xsl:otherwise>17</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='R' or $input-char='r' or $input-char='18' or $input-char='Roman_XVIII' or $input-char='Roman_xviii' or $input-char='十八' or $input-char='拾捌'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">r</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">R</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XVIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xviii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十八</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">18</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾捌</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">18</xsl:when>
+ <xsl:otherwise>18</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='S' or $input-char='s' or $input-char='19' or $input-char='Roman_XIX' or $input-char='Roman_xix' or $input-char='十九' or $input-char='拾玖'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">s</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">S</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XIX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xix</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">十九</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">19</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">拾玖</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">19</xsl:when>
+ <xsl:otherwise>19</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='T' or $input-char='t' or $input-char='20' or $input-char='Roman_XX' or $input-char='Roman_xx' or $input-char='二十' or $input-char='贰拾'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">t</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">T</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XX</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xx</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">20</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">20</xsl:when>
+ <xsl:otherwise>20</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='U' or $input-char='u' or $input-char='21' or $input-char='Roman_XXI' or $input-char='Roman_xxi' or $input-char='二十一' or $input-char='贰拾壹'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">u</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">U</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">21</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">21</xsl:when>
+ <xsl:otherwise>21</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='V' or $input-char='v' or $input-char='22' or $input-char='Roman_XXII' or $input-char='Roman_xxii' or $input-char='二十二' or $input-char='贰拾贰'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">v</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">V</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十二</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">22</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾贰</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">22</xsl:when>
+ <xsl:otherwise>22</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='W' or $input-char='w' or $input-char='23' or $input-char='Roman_XXIII' or $input-char='Roman_xxiii' or $input-char='二十三' or $input-char='贰拾叁'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">w</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">W</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIII</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiii</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十三</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">23</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾叁</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">23</xsl:when>
+ <xsl:otherwise>23</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='X' or $input-char='x' or $input-char='24' or $input-char='Roman_XXIV' or $input-char='Roman_xxiv' or $input-char='二十四' or $input-char='贰拾肆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">x</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">X</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXIV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxiv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十四</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">24</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾肆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">24</xsl:when>
+ <xsl:otherwise>24</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Y' or $input-char='y' or $input-char='25' or $input-char='Roman_XXV' or $input-char='Roman_xxv' or $input-char='二十五' or $input-char='贰拾伍'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">y</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Y</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXV</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxv</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十五</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">25</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾伍</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">25</xsl:when>
+ <xsl:otherwise>25</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$input-char='Z' or $input-char='z' or $input-char='26' or $input-char='Roman_XXVI' or $input-char='Roman_xxvi' or $input-char='二十六' or $input-char='贰拾陆'">
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">z</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">Z</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">XXVI</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">xxvi</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">二十六</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">26</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">贰拾陆</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">26</xsl:when>
+ <xsl:otherwise>26</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$output-type='ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='CHARS_LOWER_LETTER'">a</xsl:when>
+ <xsl:when test="$output-type='CHARS_UPPER_LETTER'">A</xsl:when>
+ <xsl:when test="$output-type='ROMAN_UPPER'">I</xsl:when>
+ <xsl:when test="$output-type='ROMAN_LOWER'">i</xsl:when>
+ <xsl:when test="$output-type='FULLWIDTH_ARABIC'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_LOWER_ZH'">一</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH_TW'">1</xsl:when>
+ <xsl:when test="$output-type='NUMBER_UPPER_ZH'">壹</xsl:when>
+ <xsl:when test="$output-type='CIRCLE_NUMBER'">1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--RedOffice comment (Zengjh) end charts-->
+ <!-- 以下模板的作用是将网格线颜色由16进制转换为十进制 -->
+ <xsl:template name="transform-hex-to-decimal">
+ <xsl:param name="number"/>
+ <xsl:variable name="R-color-number">
+ <xsl:call-template name="color-hex-to-decimal">
+ <xsl:with-param name="chars" select="substring($number,2,2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="G-color-number">
+ <xsl:call-template name="color-hex-to-decimal">
+ <xsl:with-param name="chars" select="substring($number,4,2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="B-color-number">
+ <xsl:call-template name="color-hex-to-decimal">
+ <xsl:with-param name="chars" select="substring($number,6,2)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$R-color-number * 65536 + $G-color-number * 256 + $B-color-number"/>
+ </xsl:template>
+ <!-- 以下模板的作用是为R或G或B颜色转换为十进制形式-->
+ <xsl:template name="color-hex-to-decimal">
+ <xsl:param name="chars"/>
+ <xsl:variable name="first-num">
+ <xsl:call-template name="hex-to-decimal">
+ <xsl:with-param name="char" select="substring($chars,1,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="second-num">
+ <xsl:call-template name="hex-to-decimal">
+ <xsl:with-param name="char" select="substring($chars,2,1)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$first-num *16 + $second-num"/>
+ </xsl:template>
+ <xsl:template name="hex-to-decimal">
+ <xsl:param name="char"/>
+ <xsl:choose>
+ <xsl:when test="$char='0'">0</xsl:when>
+ <xsl:when test="$char='1'">1</xsl:when>
+ <xsl:when test="$char='2'">2</xsl:when>
+ <xsl:when test="$char='3'">3</xsl:when>
+ <xsl:when test="$char='4'">4</xsl:when>
+ <xsl:when test="$char='5'">5</xsl:when>
+ <xsl:when test="$char='6'">6</xsl:when>
+ <xsl:when test="$char='7'">7</xsl:when>
+ <xsl:when test="$char='8'">8</xsl:when>
+ <xsl:when test="$char='9'">9</xsl:when>
+ <xsl:when test="$char='a'">10</xsl:when>
+ <xsl:when test="$char='b'">11</xsl:when>
+ <xsl:when test="$char='c'">12</xsl:when>
+ <xsl:when test="$char='d'">13</xsl:when>
+ <xsl:when test="$char='e'">14</xsl:when>
+ <xsl:when test="$char='f'">15</xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <!-- end -->
+ <!--ro000179 chenjh-->
+ <xsl:template name="search-left-top-in-tables">
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="tableslist"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$tableslist and $return=''">
+ <xsl:variable name="firsttablerows" select="$tableslist[1]//表:行"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-inatable">
+ <xsl:with-param name="row-num" select="'1'"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-in-tables">
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="tableslist" select="$tableslist[position()!=1]"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top!=''">
+ <xsl:value-of select="$rest-left-top"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- 以下模板的作用为在一个table中寻找左上角-->
+ <xsl:template name="search-left-top-inatable">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firsttablerows"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firsttablerows and $return=''">
+ <xsl:variable name="firstcells" select="$firsttablerows[1]/表:单元格"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="firstcells" select="$firstcells"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="row-num-p">
+ <xsl:choose>
+ <xsl:when test="$firsttablerows[1]/@表:跨度">
+ <xsl:value-of select="$row-num+ $firsttablerows[1]/@表:跨度"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$row-num+1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-inatable">
+ <xsl:with-param name="row-num" select="$row-num-p"/>
+ <xsl:with-param name="firsttablerows" select="$firsttablerows[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- 以下模板的作用为在某一行中寻找左上角-->
+ <xsl:template name="search-left-top-inarow">
+ <xsl:param name="row-num"/>
+ <xsl:param name="firstcells"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:param name="return"/>
+ <xsl:choose>
+ <xsl:when test="$firstcells and $return=''">
+ <xsl:variable name="firstcell" select="$firstcells[1]"/>
+ <xsl:variable name="first-left-top">
+ <xsl:call-template name="search-left-top-inacell">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="cell" select="$firstcell"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rest-left-top">
+ <xsl:call-template name="search-left-top-inarow">
+ <xsl:with-param name="row-num" select="$row-num"/>
+ <xsl:with-param name="firstcells" select="$firstcells[position()!=1]"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="return" select="$first-left-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$first-left-top!=''">
+ <xsl:value-of select="$first-left-top"/>
+ </xsl:when>
+ <xsl:when test="$rest-left-top !=''">
+ <xsl:value-of select="$rest-left-top "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- 以下的模板的作用为判断某个cell是否为左上角 -->
+ <xsl:template name="search-left-top-inacell">
+ <xsl:param name="row-num"/>
+ <xsl:param name="cell"/>
+ <xsl:param name="cellstylename"/>
+ <xsl:choose>
+ <xsl:when test="$cell/@表:式样引用=$cellstylename">
+ <xsl:value-of select="concat($cell/ancestor::表:工作表/@表:名称,'.',$cell/@表:列号,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ <!-- <xsl:variable name="style-is-default">
+ <xsl:call-template name="is-default-or-not-condition-format">
+ <xsl:with-param name="column-num" select="$cell/@表:列号"/>
+ <xsl:with-param name="cell" select="$cell"/>
+ <xsl:with-param name="preceding-cellstylename" select="''"/>
+ <xsl:with-param name="temp-num" select="'0'"/>
+ <xsl:with-param name="cellstylename" select="$cellstylename"/>
+ <xsl:with-param name="table-collumns" select="$cell/ancestor::表:工作表内容//表:列"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$style-is-default='yes' ">
+ <xsl:value-of select="concat($cell/ancestor::表:工作表/@表:名称,'.',$cell/@表:列号,' ',$row-num)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="''"/>
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="translate-left-top">
+ <xsl:param name="left-top"/>
+ <xsl:if test="$left-top!=''">
+ <xsl:variable name="column-number" select="substring-before(substring-after($left-top,'.'),' ')"/>
+ <xsl:variable name="column-number1">
+ <xsl:value-of select="floor( $column-number div 26 )"/>
+ </xsl:variable>
+ <xsl:variable name="column-number2">
+ <xsl:value-of select="$column-number mod 26"/>
+ </xsl:variable>
+ <xsl:variable name="column-character1">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="column-character2">
+ <xsl:call-template name="number-to-character">
+ <xsl:with-param name="number" select="$column-number2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat(substring-before($left-top,'.'),'.',$column-character1,$column-character2,substring-after($left-top,' '))"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-the-condition-format-map">
+ <xsl:param name="condition-format-set"/>
+ <xsl:param name="current-left-top"/>
+ <xsl:if test="$condition-format-set">
+ <xsl:choose>
+ <xsl:when test="contains($condition-format-set[1]/表:区域/text(),$current-left-top)">
+ <xsl:for-each select="$condition-format-set[1]/表:条件">
+ <xsl:variable name="condition-text">
+ <xsl:choose>
+ <xsl:when test="@表:类型='cell value'">
+ <xsl:choose>
+ <xsl:when test="表:操作码/text()='between' ">
+ <xsl:value-of select="concat('cell-content-is-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test=" 表:操作码/text()='not between'">
+ <xsl:value-of select="concat('cell-content-is-not-between','(',表:第一操作数/text(),',',表:第二操作数/text(),')')"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='equal to'">
+ <xsl:value-of select="concat('cell-content()=',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='not equal to'">
+ <xsl:value-of select="concat('cell-content()!=',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='greater than'">
+ <xsl:value-of select="concat('cell-content()&gt;',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='less than'">
+ <xsl:value-of select="concat('cell-content()&lt;',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='greater than or equal to'">
+ <xsl:value-of select="concat('cell-content()&gt;=',表:第一操作数/text())"/>
+ </xsl:when>
+ <xsl:when test="表:操作码/text()='less than or equal to'">
+ <xsl:value-of select="concat('cell-content()&lt;=',表:第一操作数/text())"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="@表:类型='formula'">
+ <xsl:value-of select="concat('is-true-formula','(',表:第一操作数/text(),')')"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="style:map">
+ <xsl:attribute name="style:condition"><xsl:value-of select="$condition-text"/></xsl:attribute>
+ <xsl:attribute name="style:apply-style-name"><xsl:value-of select="//uof:单元格式样[@表:标识符=current()/表:格式/@表:式样引用]/@表:名称"/></xsl:attribute>
+ <xsl:attribute name="style:base-cell-address"><xsl:value-of select="substring-after($condition-format-set[1]/表:区域/text(),':')"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-the-condition-format-map">
+ <xsl:with-param name="condition-format-set" select="$condition-format-set[position()!=1]"/>
+ <xsl:with-param name="current-left-top" select="$current-left-top"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--ro000179 end-->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/uof/uof2odf_text.xsl b/filter/source/xslt/import/uof/uof2odf_text.xsl
new file mode 100644
index 000000000000..abf597853c97
--- /dev/null
+++ b/filter/source/xslt/import/uof/uof2odf_text.xsl
@@ -0,0 +1,4650 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:uof="http://schemas.uof.org/cn/2003/uof" xmlns:表="http://schemas.uof.org/cn/2003/uof-spreadsheet" xmlns:演="http://schemas.uof.org/cn/2003/uof-slideshow" xmlns:字="http://schemas.uof.org/cn/2003/uof-wordproc" xmlns:图="http://schemas.uof.org/cn/2003/graph" 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:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:template match="uof:UOF">
+ <office:document 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:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" office:version="1.0">
+ <xsl:apply-templates select="uof:元数据"/>
+ <xsl:apply-templates select="uof:文字处理/字:公用处理规则/字:文档设置"/>
+ <xsl:apply-templates select="uof:字体集"/>
+ <xsl:apply-templates select="uof:式样集"/>
+ <xsl:apply-templates select="uof:文字处理"/>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="uof:元数据">
+ <xsl:element name="office:meta">
+ <meta:generator>UOFText 2004</meta:generator>
+ <dc:title>
+ <xsl:value-of select="uof:标题"/>
+ </dc:title>
+ <dc:description>
+ <xsl:value-of select="uof:摘要"/>
+ </dc:description>
+ <dc:subject>
+ <xsl:value-of select="uof:主题"/>
+ </dc:subject>
+ <meta:initial-creator>
+ <xsl:value-of select="uof:创建者"/>
+ </meta:initial-creator>
+ <meta:creation-date>
+ <xsl:value-of select="substring-before( uof:创建日期, 'Z')"/>
+ </meta:creation-date>
+ <dc:creator>
+ <xsl:value-of select="uof:最后作者"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="substring-before( uof:编辑时间, 'Z')"/>
+ </dc:date>
+ <meta:printed-by/>
+ <meta:print-date/>
+ <meta:keywords>
+ <meta:keyword>
+ <xsl:value-of select="uof:关键字集/uof:关键字"/>
+ </meta:keyword>
+ </meta:keywords>
+ <dc:language/>
+ <meta:editing-cycles>
+ <xsl:value-of select="uof:编辑次数"/>
+ </meta:editing-cycles>
+ <meta:editing-duration>
+ <xsl:if test="uof:编辑时间">
+ <xsl:value-of select="concat('PT', floor(uof:编辑时间 div 60), 'H', uof:编辑时间 mod 60, 'M0S')"/>
+ </xsl:if>
+ </meta:editing-duration>
+ <meta:user-defined meta:name="Category">
+ <xsl:value-of select="uof:分类"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Manager">
+ <xsl:value-of select="uof:经理名称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Company">
+ <xsl:value-of select="uof:公司名称"/>
+ </meta:user-defined>
+ <meta:user-defined meta:name="Version">
+ <xsl:value-of select="uof:创建应用程序"/>
+ </meta:user-defined>
+ <xsl:if test="uof:文档模板|child::*[@uof:locID='u0013']">
+ <meta:template xlink:type="simple" xlink:actuate="onRequest" xlink:href="{child::*[@uof:locID='u0013']}"/>
+ </xsl:if>
+ <xsl:if test="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:for-each select="uof:用户自定义元数据集/uof:用户自定义元数据|child::*[@uof:locID='u0016']/*[@uof:locID='u0017']">
+ <xsl:element name="meta:user-defined">
+ <xsl:attribute name="meta:name"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <meta:document-statistic>
+ <xsl:attribute name="meta:page-count">
+ <xsl:choose>
+ <xsl:when test="child::*[@uof:locID='u0020']"><xsl:value-of select="uof:页数"/></xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:段落/字:域开始[@字:类型='numpages']">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:value-of select="substring-before($date0,' \*')"/>
+ </xsl:variable>
+ <xsl:if test="$fmt='Arabic'"><xsl:value-of select="following-sibling::字:句/字:文本串"/></xsl:if>
+ <xsl:if test="not($fmt='Arabic')">
+ <xsl:variable name="content">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$content='I' or $content='i' or $content='A' or $content='a'">1</xsl:when>
+ <xsl:when test="$content='II' or $content='ii' or $content='B' or $content='b'">2</xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="meta:paragraph-count"><xsl:if test="child::*[@uof:locID='u0025']"><xsl:value-of select="uof:段落数"/></xsl:if></xsl:attribute>
+ <xsl:attribute name="meta:word-count"><xsl:if test="child::*[@uof:locID='u0023']"><xsl:value-of select="uof:中文字符数"/></xsl:if></xsl:attribute>
+ <xsl:attribute name="meta:object-count"><xsl:if test="child::*[@uof:locID='u0026']"><xsl:value-of select="uof:对象数"/></xsl:if></xsl:attribute>
+ <xsl:attribute name="meta:character-count">
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:段落/字:域开始[@字:类型='numchars']">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:for-each>
+ <xsl:if test="child::*[@uof:locID='u0021']"><xsl:value-of select="uof:字数"/></xsl:if>
+ </xsl:attribute>
+ </meta:document-statistic>
+ <meta:document-statistic/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:variable name="uofUnit">
+ <xsl:variable name="uu">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:度量单位"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$uu='cm'">cm</xsl:when>
+ <xsl:when test="$uu='mm'">mm</xsl:when>
+ <xsl:when test="$uu='pt'">pt</xsl:when>
+ <xsl:when test="$uu='inch'">in</xsl:when>
+ <xsl:otherwise>cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="other-to-cm-conversion-factor">
+ <xsl:choose>
+ <xsl:when test="$uofUnit='cm'">1</xsl:when>
+ <xsl:when test="$uofUnit='mm'">0.1</xsl:when>
+ <xsl:when test="$uofUnit='pt'">0.03527</xsl:when>
+ <xsl:when test="$uofUnit='inch'">2.54</xsl:when>
+ <xsl:when test="$uofUnit='pica'">0.4233</xsl:when>
+ <xsl:otherwise>0.03527</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:template match="uof:式样集">
+ <xsl:apply-templates select="uof:字体集"/>
+ <xsl:variable name="default_paragraph_style" select="uof:段落式样"/>
+ <xsl:variable name="default_character_style" select="uof:句式样"/>
+ <xsl:variable name="default_table_style" select="uof:文字表式样"/>
+ <office:styles>
+ <xsl:if test="uof:段落式样[@字:类型 = 'default']">
+ <style:default-style style:family="paragraph">
+ <xsl:element name="style:paragraph-properties">
+ <xsl:attribute name="style:tab-stop-distance"><xsl:value-of select="concat( number(/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:默认制表位位置),$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:式样集/uof:字体集/uof:默认字体">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:ascii"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:fareast"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-complex"><xsl:value-of select="/uof:UOF//uof:字体集/uof:默认字体/@uof:cs"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="uof:UOF/uof:式样集/uof:句式样/字:字体"/>
+ <xsl:if test="not(uof:UOF/uof:式样集/uof:句式样/字:字体/@字:字号 or uof:UOF/uof:式样集/uof:句属性/字:字体/@字:字号)">
+ <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+ <xsl:attribute name="fo:font-size-asian">10pt</xsl:attribute>
+ <xsl:attribute name="fo:font-size-complex">10pt</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </style:default-style>
+ </xsl:if>
+ <xsl:for-each select="uof:段落式样[@字:类型='auto']">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@字:基式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:别名">
+ <xsl:attribute name="style:display-name"><xsl:value-of select="@字:别名"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:call-template name="XDParagraphAttr"/>
+ <xsl:apply-templates select="*[not(name()='字:大纲级别')]"/>
+ <xsl:if test="字:制表位设置">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="字:句属性/*"/>
+ </xsl:element>
+ <xsl:variable name="biaoshi" select="@字:标识符"/>
+ <xsl:for-each select="../uof:句式样">
+ <xsl:if test="@字:标识符=$biaoshi">
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="uof:句式样[@字:类型='auto']">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ancestor::字:段落式样">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <style:style style:name="ColumnBreakPara" style:family="paragraph">
+ <style:text-properties fo:break-after="column"/>
+ </style:style>
+ <xsl:if test="uof:句式样">
+ <style:default-style style:family="text"/>
+ </xsl:if>
+ <style:style style:name="Numbering Symbols" style:family="text"/>
+ <style:style style:name="Bullet Symbols" style:family="text">
+ <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/>
+ </style:style>
+ <xsl:apply-templates select="uof:文字表式样" mode="table"/>
+ <xsl:apply-templates select="uof:式样"/>
+ <xsl:call-template name="脚注设置"/>
+ <xsl:call-template name="尾注设置"/>
+ <xsl:call-template name="行编号"/>
+ </office:styles>
+ <xsl:element name="office:automatic-styles">
+ <style:style style:name="PageBreak" style:family="paragraph">
+ <style:text-properties fo:break-before="page"/>
+ </style:style>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体/字:段落/字:句/字:句属性" mode="style"/>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:句">
+ <xsl:variable name="stylename1" select="字:句属性/@字:式样引用"/>
+ <xsl:element name="style:style">
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('T',$stylenum)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="ancestor::字:段落式样">
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样">
+ <xsl:if test="$stylename1=@字:标识符">
+ <xsl:choose>
+ <xsl:when test="@字:标识符=/uof:UOF/uof:文字处理/字:主体/字:段落/字:句/字:句属性/字:格式修订/@字:修订信息引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:element name="style:text-properties">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样">
+ <xsl:if test="$stylename1=@字:标识符">
+ <xsl:apply-templates select="./字:位置" mode="oo"/>
+ <xsl:apply-templates select="*[not(name()='字:位置')]"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'date']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">Date<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'date']"/></xsl:attribute>
+ <xsl:call-template name="日期域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'createdate']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">CreateDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createdate']"/></xsl:attribute>
+ <xsl:call-template name="日期域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'savedate']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">SaveDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'savedate']"/></xsl:attribute>
+ <xsl:call-template name="日期域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'time']">
+ <xsl:element name="number:date-style">
+ <xsl:attribute name="style:name">Time<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'time']"/></xsl:attribute>
+ <xsl:call-template name="时间域"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'edittime']">
+ <xsl:element name="number:time-style">
+ <xsl:attribute name="style:name">EditTime<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'edittime']"/></xsl:attribute>
+ <xsl:call-template name="编辑时间"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:域开始[@字:类型 = 'createtime']">
+ <xsl:element name="number:time-style">
+ <xsl:attribute name="style:name">CREATETIME<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createtime']"/></xsl:attribute>
+ <xsl:call-template name="创建时间"/>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:文字表[not(@字:类型='sub-table')]" mode="style"/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:单元格" mode="style"/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:行[not(../../@字:类型='sub-table')]" mode="style"/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:主体//字:列宽集[not(../../@字:类型='sub-table')]" mode="style"/>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:自动编号信息">
+ <xsl:variable name="currlistid" select="@字:编号引用"/>
+ <xsl:variable name="currlist" select="."/>
+ <xsl:variable name="rootlist" select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号[@字:标识符 =$currlistid]"/>
+ <xsl:if test="not(ancestor::字:段落/preceding-sibling::字:段落[1]/字:段落属性/字:自动编号信息/@字:编号引用= $currlistid)">
+ <xsl:element name="text:list-style">
+ <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::字:自动编号信息)"/></xsl:attribute>
+ <xsl:for-each select="$rootlist">
+ <xsl:for-each select="字:级别">
+ <xsl:choose>
+ <xsl:when test="字:项目符号">
+ <xsl:call-template name="xiangmufuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="字:图片符号引用">
+ <xsl:call-template name="imagefuhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="jibianhao">
+ <xsl:with-param name="biaoshifu" select="../@字:标识符"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:节属性">
+ <xsl:element name="style:page-layout">
+ <xsl:attribute name="style:name">pm<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any"/></xsl:attribute>
+ <xsl:if test="字:对称页边距/@字:值='true'">
+ <xsl:attribute name="style:page-usage">mirrored</xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:if test="字:纸张方向">
+ <xsl:attribute name="style:print-orientation"><xsl:choose><xsl:when test="字:纸张方向='portrait'">portrait</xsl:when><xsl:when test="字:纸张方向='landscape'">landscape</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="fo:page-width"><xsl:value-of select="concat(字:纸张/@uof:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:page-height"><xsl:value-of select="concat(字:纸张/@uof:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="字:页边距">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上 ,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:页边距/@uof:左,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:页边距/@uof:下,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:装订线/@字:位置='top'">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上 ,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:页边距/@uof:左,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:装订线/@字:位置='left' ">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat((字:页边距/@uof:左+ 字:装订线/@字:距边界),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页边距/@uof:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:页边距/@uof:左,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:页边距/@uof:右,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:页边距/@uof:下,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="字:拼页/@字:值='1' or 字:拼页/@字:值='true'">
+ <xsl:attribute name="style:page-usage">mirrored</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="string(字:文字排列方向)='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string(字:文字排列方向)='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string(字:文字排列方向)='hori-l2r'">
+ <xsl:attribute name="style:writing-mode">lr-tb</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string(字:文字排列方向)='hori-r2l'">
+ <xsl:attribute name="style:writing-mode">lr-tb</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:writing-mode">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="字:网格设置/@字:网格类型">
+ <xsl:attribute name="style:layout-grid-mode"><xsl:choose><xsl:when test="字:网格设置/@字:网格类型='line-char'">both-nosnap</xsl:when><xsl:when test="字:网格设置/@字:网格类型='char'">both</xsl:when><xsl:when test="字:网格设置/@字:网格类型='line'">line</xsl:when><xsl:when test="字:网格设置/@字:网格类型='none'">none</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:网格设置/@字:宽度">
+ <xsl:attribute name="style:layout-grid-base-width"><xsl:value-of select="concat(字:网格设置/@字:宽度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:网格设置/@字:高度">
+ <xsl:attribute name="style:layout-grid-base-height"><xsl:value-of select="concat(字:网格设置/@字:高度,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:网格设置/@字:显示网格">
+ <xsl:attribute name="style:layout-grid-display"><xsl:value-of select="字:网格设置/@字:显示网格"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:网格设置/@字:打印网格">
+ <xsl:attribute name="style:layout-grid-print"><xsl:value-of select="字:网格设置/@字:打印网格"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:稿纸设置/@字:类型">
+ <xsl:attribute name="style:layout-grid-mode"><xsl:choose><xsl:when test="字:稿纸设置/@字:类型='draft-paper' ">both</xsl:when><xsl:when test="字:稿纸设置/@字:类型='letter-paper' ">line</xsl:when><xsl:otherwise>both</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:稿纸设置/@字:格式">
+ <xsl:choose>
+ <xsl:when test="字:稿纸设置/@字:格式='fourth-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">0.496cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:稿纸设置/@字:格式='third-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.584cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.584cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">0.64cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:稿纸设置/@字:格式='second-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">0.905cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:稿纸设置/@字:格式='first-gear'">
+ <xsl:attribute name="style:layout-grid-base-width">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-base-height">0.728cm</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-ruby-height">1.633cm</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="style:layout-grid-display">true</xsl:attribute>
+ <xsl:attribute name="style:layout-grid-print">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:稿纸设置/@字:颜色">
+ <xsl:attribute name="style:layout-grid-color"><xsl:value-of select="字:稿纸设置/@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:边框">
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="字:填充">
+ <xsl:for-each select="字:填充">
+ <xsl:call-template name="uof:填充"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:apply-templates select="字:填充"/>
+ <xsl:attribute name="style:num-format"><xsl:variable name="format"><xsl:value-of select="字:页码设置/@字:格式"/></xsl:variable><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="$format"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="字:纸张来源/@字:其他页">
+ <xsl:attribute name="style:paper-tray-name"><xsl:value-of select="字:纸张来源/@字:其他页"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:分栏/@字:栏数">
+ <xsl:apply-templates select="字:分栏"/>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="字:页眉位置">
+ <style:header-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:页眉位置/@字:距边界,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="字:页眉位置/@字:距边界"/>
+ <xsl:variable name="long2" select="字:页眉位置/@字:距版芯"/>
+ <xsl:variable name="long" select="$long1 + $long2"/>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat($long,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">false</xsl:attribute>
+ </xsl:element>
+ </style:header-style>
+ </xsl:if>
+ <xsl:if test="字:页脚位置">
+ <style:footer-style>
+ <xsl:element name="style:header-footer-properties">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:页脚位置/@字:距边界,$uofUnit)"/></xsl:attribute>
+ <xsl:variable name="long1" select="字:页脚位置/@字:距边界"/>
+ <xsl:variable name="long2" select="字:页脚位置/@字:距版芯"/>
+ <xsl:variable name="long" select="$long1 + $long2"/>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat($long,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">false</xsl:attribute>
+ </xsl:element>
+ </style:footer-style>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="字:分栏/@字:栏数">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">sect<xsl:value-of select="count(preceding::字:节属性[字:分栏/@字:栏数])"/></xsl:attribute>
+ <xsl:attribute name="style:family">section</xsl:attribute>
+ <xsl:element name="style:page-layout-properties">
+ <xsl:element name="style:columns">
+ <xsl:attribute name="fo:column-count"><xsl:value-of select="number(字:分栏/@字:栏数)"/></xsl:attribute>
+ <xsl:attribute name="fo:column-gap"><xsl:value-of select="concat(number(字:分栏/@字:分割线宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='png' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象/@uof:公有类型='gif' or /uof:UOF/uof:对象集/uof:其他对象/@uof:私有类型='图片'">
+ <style:style style:name="Graphics" style:family="graphic">
+ <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
+ </style:style>
+ </xsl:if>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形/图:文本内容/字:段落/字:句/字:句属性" mode="style"/>
+ <xsl:call-template name="duanluoshuxing"/>
+ </xsl:element>
+ <office:master-styles>
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体//字:节属性">
+ <xsl:element name="style:master-page">
+ <xsl:variable name="master-page-name">
+ <xsl:number count="字:节属性" from="/uof:UOF/uof:文字处理/字:主体" level="any"/>
+ </xsl:variable>
+ <xsl:attribute name="style:name"><xsl:choose>
+ <xsl:when test="../@字:名称"><xsl:value-of select="../@字:名称"/></xsl:when>
+ <xsl:otherwise>Standard</xsl:otherwise>
+ </xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:page-layout-name"><xsl:value-of select="concat('pm', $master-page-name)"/></xsl:attribute>
+ <xsl:if test="following::字:节属性">
+ <xsl:attribute name="style:next-style-name">Standard<xsl:value-of select="$master-page-name +1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="字:页眉">
+ <xsl:if test="字:首页页眉 or 字:奇数页页眉">
+ <xsl:element name="style:header">
+ <xsl:apply-templates select="字:奇数页页眉/字:段落 | 字:首页页眉/字:段落 | 字:奇数页页眉/字:文字表 | 字:首页页眉/字:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="字:偶数页页眉">
+ <xsl:element name="style:header-left">
+ <xsl:apply-templates select="字:偶数页页眉/字:段落 | 字:偶数页页眉/字:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="字:页脚">
+ <xsl:if test="字:奇数页页脚 or 字:首页页脚">
+ <xsl:element name="style:footer">
+ <xsl:apply-templates select="字:奇数页页脚/字:段落 | 字:首页页脚/字:段落 | 字:奇数页页脚/字:文字表 | 字:首页页脚/字:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="字:偶数页页脚">
+ <xsl:element name="style:footer-left">
+ <xsl:apply-templates select="字:偶数页页脚/字:段落 | 字:偶数页页脚/字:文字表"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="字:奇偶页页眉页脚不同">
+ <xsl:element name="style:header-left">
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template match="字:填充">
+ <xsl:choose>
+ <xsl:when test="图:颜色">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:图案/@图:背景色">
+ <xsl:attribute name="style:text-background-color"><xsl:choose><xsl:when test="contains(图:图案/@图:背景色,'#')"><xsl:value-of select="图:图案/@图:背景色"/></xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:图案/@图:前景色">
+ <xsl:attribute name="fo:text-background-color"><xsl:choose><xsl:when test="contains(图:图案/@图:前景色,'#')"><xsl:value-of select="图:图案/@图:前景色"/></xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:分栏">
+ <xsl:element name="style:columns">
+ <xsl:attribute name="fo:column-count"><xsl:value-of select="//字:分栏/@字:栏数"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="//字:分栏/字:栏[position()=1]/@字:间距"/>
+ </xsl:variable>
+ <xsl:if test="//字:分栏/@字:等宽='true' ">
+ <xsl:attribute name="fo:column-gap"><xsl:value-of select="concat($aa * 2,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//字:分栏/@字:分隔线宽度">
+ <xsl:element name="style:column-sep">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat(@字:分隔线宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:color"><xsl:value-of select="@字:分隔线颜色"/></xsl:attribute>
+ <xsl:attribute name="style:height">100%</xsl:attribute>
+ <xsl:attribute name="style:vertical-align">top</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="//字:分栏/字:栏">
+ <xsl:element name="style:column">
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="@字:宽度"/>*</xsl:attribute>
+ <xsl:if test="parent::字:分栏/@字:宽度='true'">
+ <xsl:choose>
+ <xsl:when test="self::node()[not(preceding-sibling::字:栏)]">
+ <xsl:attribute name="fo:start-indent">0cm</xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="self::node()[not(following-sibling::字:栏)]">
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent">0cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="parent::字:分栏/@字:等宽='false'">
+ <xsl:variable name="last" select="preceding-sibling::字:栏[1]/@字:间距"/>
+ <xsl:choose>
+ <xsl:when test="self::node()[not(preceding-sibling::字:栏)]">
+ <xsl:attribute name="fo:start-indent">0cm</xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="self::node()[not(following-sibling::字:栏)]">
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat($last,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent">0cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:start-indent"><xsl:value-of select="concat($last,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:end-indent"><xsl:value-of select="concat(@字:间距,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:文字表式样" mode="table">
+ <style:style style:family="table">
+ <xsl:attribute name="style:name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:if test="@字:基式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute>
+ </xsl:if>
+ <style:table-properties>
+ <xsl:choose>
+ <xsl:when test="字:对齐">
+ <xsl:attribute name="table:align"><xsl:value-of select="字:对齐"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:align">margins</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="字:宽度/@字:相对宽度">
+ <xsl:variable name="reltblw">
+ <xsl:value-of select="concat(number(字:宽度/@字:相对宽度),'%')"/>
+ </xsl:variable>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/>
+ </xsl:variable>
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(number(字:宽度/@字:相对宽度) * 100,'%')"/></xsl:attribute>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)) * number($reltblw),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:宽度/@字:绝对宽度">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat(number(字:宽度/@字:绝对宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </style:table-properties>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="字:文字表" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <xsl:if test="@字:式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="name(preceding-sibling::*[1])='字:分节'">
+ <xsl:attribute name="style:master-page-name"><xsl:value-of select="preceding-sibling::*[1]/@字:名称"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:table-properties">
+ <xsl:for-each select="字:文字表属性">
+ <xsl:variable name="biaoshi" select="@字:式样引用"/>
+ <xsl:choose>
+ <xsl:when test="字:对齐 = 'left' or 字:对齐 = 'center' or 字:对齐 = 'right'">
+ <xsl:attribute name="table:align"><xsl:value-of select="字:对齐"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:对齐">
+ <xsl:attribute name="table:align"><xsl:value-of select="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:对齐"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:align">margins</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="字:左缩进">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(number(字:左缩进),$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:绕排/@字:值='around'">
+ <xsl:if test="字:绕排边距/@字:上">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:绕排边距/@字:上,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:绕排边距/@字:左">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:绕排边距/@字:左,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:绕排边距/@字:右">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:绕排边距/@字:右,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:绕排边距/@字:下">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:绕排边距/@字:下,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="@字:式样引用">
+ <xsl:variable name="rootStyle" select="@字:式样引用"/>
+ <xsl:variable name="rootStyleNode" select="/uof:UOF/uof:式样集/字:文字表式样[@字:基式样引用 = $rootStyle]"/>
+ <xsl:variable name="paddingleft">
+ <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:左"/>
+ </xsl:variable>
+ <xsl:variable name="paddingright">
+ <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:右"/>
+ </xsl:variable>
+ <xsl:variable name="paddingtop">
+ <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:上"/>
+ </xsl:variable>
+ <xsl:variable name="paddingbottom">
+ <xsl:value-of select="$rootStyleNode/字:文字表属性/字:边距/@uof:下"/>
+ </xsl:variable>
+ <xsl:if test="$rootStyleNode/字:文字表属性/字:边距/@uof:左">
+ <xsl:attribute name="fo:margin-left">-<xsl:value-of select="(number($paddingleft))* $other-to-cm-conversion-factor"/>cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="字:宽度/@字:相对宽度">
+ <xsl:variable name="reltblw">
+ <xsl:value-of select="字:宽度/@字:相对宽度"/>
+ </xsl:variable>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/>
+ </xsl:variable>
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(number(字:宽度/@字:相对宽度) * 100,'%')"/></xsl:attribute>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)) * number($reltblw),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:宽度/@字:绝对宽度">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat(number(字:宽度/@字:绝对宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:相对宽度 or /uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:绝对宽度">
+ <xsl:attribute name="style:rel-width"><xsl:value-of select="concat(/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:相对宽度 * 100,'%')"/></xsl:attribute>
+ <xsl:attribute name="style:width"><xsl:value-of select="/uof:UOF/uof:式样集/uof:文字表式样[@字:标识符=$biaoshi]/字:宽度/@字:绝对宽度"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/>
+ </xsl:variable>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat((number($pagew)-number($leftm)-number($rightm)),$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="tblsize" select="sum(字:列宽集/字:列宽)"/>
+ <xsl:if test="(not($tblsize='0')) and not(字:宽度) ">
+ <xsl:choose>
+ <xsl:when test="字:左缩进">
+ <xsl:attribute name="style:width"><xsl:value-of select="concat( number($tblsize - 字:左缩进), $uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:width"><xsl:value-of select="concat( number(sum(字:列宽集/字:列宽) ), $uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:边框">
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="字:填充">
+ <xsl:call-template name="uof:填充"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:列宽集" mode="style">
+ <xsl:choose>
+ <xsl:when test="not(./字:列宽)">
+ <xsl:for-each select="../..">
+ <xsl:for-each select="字:行[1]/字:单元格">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="字:文字表" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number value="count(preceding::字:单元格)+1"/></xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="字:单元格属性/字:宽度/@字:相对值">
+ <xsl:variable name="tblw1">
+ <xsl:choose>
+ <xsl:when test="../../字:文字表属性/字:宽度/@字:绝对宽度">
+ <xsl:value-of select="../../字:文字表属性/字:宽度/@字:绝对宽度"/>
+ </xsl:when>
+ <xsl:when test="../../字:文字表属性/字:宽度/@字:相对宽度">
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/>
+ </xsl:variable>
+ <xsl:variable name="relw">
+ <xsl:value-of select="../../字:文字表属性/字:宽度/@字:相对宽度"/>
+ </xsl:variable>
+ <xsl:value-of select=" ( number($pagew)-number($leftm)-number($rightm))* number($relw) div 100"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="pagew">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:纸张/@uof:宽度"/>
+ </xsl:variable>
+ <xsl:variable name="leftm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:左"/>
+ </xsl:variable>
+ <xsl:variable name="rightm">
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页边距/@uof:右"/>
+ </xsl:variable>
+ <xsl:value-of select="(number($pagew)-number($leftm)-number($rightm))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(number(number($tblw1)*number(字:单元格属性/字:宽度/@字:相对值) div 100),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:单元格属性/字:宽度/@字:绝对值">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(number(字:单元格属性/字:宽度/@字:绝对值),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="'1cm'"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="字:列宽">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number count="字:列宽" from="/uof:UOF/uof:文字处理/字:主体" level="single" format="1"/></xsl:attribute>
+ <xsl:variable name="tableRoot" select="ancestor::字:文字表"/>
+ <xsl:element name="style:table-column-properties">
+ <xsl:choose>
+ <xsl:when test="string(.)">
+ <xsl:attribute name="style:column-width"><xsl:value-of select="concat(.,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:column-width"><xsl:value-of select="'1cm'"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:行" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/></xsl:attribute>
+ <xsl:element name="style:table-row-properties">
+ <xsl:for-each select="字:表行属性">
+ <xsl:choose>
+ <xsl:when test="字:高度/@字:固定值">
+ <xsl:attribute name="style:row-height"><xsl:value-of select="concat(number(字:高度/@字:固定值),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:高度/@字:最小值">
+ <xsl:attribute name="style:min-row-height"><xsl:value-of select="concat(number(字:高度/@字:最小值), $uofUnit )"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:attribute name="fo:keep-together"><xsl:value-of select="字:跨页/@字:值"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:单元格" mode="style">
+ <style:style>
+ <xsl:attribute name="style:name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/>C<xsl:number count="字:单元格" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]/字:行" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:element name="style:table-cell-properties">
+ <xsl:for-each select="字:单元格属性">
+ <xsl:choose>
+ <xsl:when test="字:单元格边距/@字:左">
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(number(字:单元格边距/@字:左),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:左"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="字:单元格边距/@字:右">
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(number(字:单元格边距/@字:右),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:右"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="字:单元格边距/@字:上">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(number(字:单元格边距/@字:上),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:上"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="字:单元格边距/@字:下">
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(number(字:单元格边距/@字:下),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="../../../../字:文字表属性/字:默认单元格边距/@字:下"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="cellbefore">
+ <xsl:value-of select="count(ancestor::字:单元格/preceding-sibling::字:单元格)"/>
+ </xsl:variable>
+ <xsl:variable name="cellafter">
+ <xsl:value-of select="count(ancestor::字:单元格/following-sibling::字:单元格)"/>
+ </xsl:variable>
+ <xsl:variable name="rowbefore">
+ <xsl:value-of select="count(ancestor::字:行/preceding-sibling::字:行)"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="字:边框">
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="number($cellafter) &gt; 0">
+ <xsl:attribute name="fo:border-right">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:border-right">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:border-left">0.002cm solid #000000</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="number($rowbefore) &gt; 0">
+ <xsl:attribute name="fo:border-top">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:border-top">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:border-bottom">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:垂直对齐方式='center' ">middle</xsl:when><xsl:when test="字:垂直对齐方式='bottom' ">bottom</xsl:when><xsl:otherwise>top</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="字:填充">
+ <xsl:call-template name="uof:填充"/>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:element>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="uof:字体集">
+ <xsl:element name="office:font-face-decls">
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
+ <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <xsl:if test="not(uof:字体声明[@uof:名称='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="uof:字体声明">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name"><xsl:value-of select="@uof:标识符"/></xsl:attribute>
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ <xsl:if test="@uof:字符集 = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@uof:字体族">
+ <xsl:choose>
+ <xsl:when test="@uof:字体族 = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:字体族 ='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:attribute name="style:font-pitch">12</xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ <xsl:apply-templates select="uof:字体声明"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:式样">
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="uof:句式样/*"/>
+ <xsl:apply-templates select="uof:段落式样/*"/>
+ <xsl:call-template name="paragraph-properties"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="uof:段落式样"/>
+ <xsl:template match="uof:句式样"/>
+ <xsl:template match="字:公用处理规则">
+ <xsl:apply-templates select="uof:文字处理/字:公用处理规则/字:文档设置"/>
+ </xsl:template>
+ <xsl:template match="uof:文字处理/字:公用处理规则/字:文档设置">
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="InBrowseMode" config:type="boolean">
+ <xsl:choose>
+ <xsl:when test="字:当前视图='web'">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <xsl:if test="字:缩放">
+ <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item>
+ <xsl:choose>
+ <xsl:when test="字:缩放 = 'best-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
+ </xsl:when>
+ <xsl:when test="字:缩放 = 'full-page'">
+ <config:config-item config:name="ZoomType" config:type="short">2</config:config-item>
+ </xsl:when>
+ <xsl:when test="字:缩放 = 'text-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">1</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <config:config-item config:name="ZoomFactor" config:type="short">
+ <xsl:value-of select="字:缩放"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="configuration-settings">
+ <config:config-item-map-indexed config:name="ForbiddenCharacters">
+ <config:config-item-map-entry>
+ <config:config-item config:name="Language" config:type="string">zh</config:config-item>
+ <config:config-item config:name="Country" config:type="string">CN</config:config-item>
+ <config:config-item config:name="Variant" config:type="string"/>
+ <config:config-item config:name="BeginLine" config:type="string">
+ <xsl:choose>
+ <xsl:when test="字:标点禁则/字:行首字符 or *[@uof:locID='t0007']/*[@uof:locID='t0008']">
+ <xsl:value-of select="*[@uof:locID='t0007']/*[@uof:locID='t0008']"/>
+ </xsl:when>
+ <xsl:otherwise>:!),.:;?]}_'"、。〉》」』】〕〗〞︰︱︳﹐_﹒﹔﹕﹖﹗﹚﹜﹞!),.:;?|}︴︶︸︺︼︾﹀﹂﹄﹏_~¢々‖_·ˇˉ―--′</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item config:name="EndLine" config:type="string">
+ <xsl:choose>
+ <xsl:when test="字:标点禁则/字:行尾字符 or *[@uof:locID='t0007']/*[@uof:locID='t0009']">
+ <xsl:value-of select="*[@uof:locID='t0007']/*[@uof:locID='t0009']"/>
+ </xsl:when>
+ <xsl:otherwise>([{__'"‵〈《「『【〔〖([{£¥〝︵︷︹︻︽︿﹁﹃﹙﹛﹝({</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ </office:settings>
+ </xsl:template>
+ <xsl:template match="uof:文字处理">
+ <xsl:element name="office:body">
+ <xsl:element name="office:text">
+ <xsl:call-template name="GenerateTrackChanges"/>
+ <text:sequence-decls>
+ <xsl:call-template name="default_seqence_declaration"/>
+ </text:sequence-decls>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="default_seqence_declaration">
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="AutoNr">
+ </text:sequence-decl>
+ </xsl:template>
+ <xsl:template name="段落" match="字:段落[not((preceding-sibling::字:段落/字:域开始) and (not(preceding-sibling::字:段落/字:域结束)))][not(字:段落属性[字:自动编号信息])]">
+ <xsl:if test="字:域开始/@字:类型='caption'">
+ <xsl:apply-templates select="字:域代码"/>
+ </xsl:if>
+ <xsl:if test="字:域开始/@字:类型='REF'">
+ <xsl:call-template name="目录域"/>
+ </xsl:if>
+ <xsl:if test="字:域开始/@字:类型='INDEX'">
+ <xsl:call-template name="索引域"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0107'">
+ <xsl:apply-templates select="字:脚注"/>
+ </xsl:when>
+ <xsl:when test="string(parent::node()/@uof:locID)='t0108'">
+ <xsl:apply-templates select="字:尾注"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:脚注">
+ <xsl:element name="text:note">
+ <xsl:attribute name="text:note-class">footnote</xsl:attribute>
+ <xsl:element name="text:note-citation">
+ <xsl:attribute name="text:label"><xsl:value-of select="@字:引文体"/></xsl:attribute>
+ <xsl:value-of select="@字:引文体"/>
+ </xsl:element>
+ <xsl:element name="text:note-body">
+ <xsl:for-each select="字:段落">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:尾注">
+ <xsl:element name="text:note">
+ <xsl:attribute name="text:note-class">endnote</xsl:attribute>
+ <xsl:element name="text:note-citation">
+ <xsl:attribute name="text:label"><xsl:value-of select="@字:引文体"/></xsl:attribute>
+ <xsl:value-of select="@字:引文体"/>
+ </xsl:element>
+ <xsl:element name="text:note-body">
+ <xsl:for-each select="字:段落">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:锚点">
+ <xsl:call-template name="图形解析"/>
+ </xsl:template>
+ <xsl:key match="/uof:UOF/uof:文字处理/字:主体/字:段落/字:句/字:锚点 | /uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页眉//字:锚点 | /uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:页脚//字:锚点" name="rel_graphic_name" use="字:图形/@字:图形引用"/>
+ <xsl:template match="图:图形">
+ <xsl:variable name="random-name">
+ <xsl:value-of select="generate-id()"/>
+ </xsl:variable>
+ <xsl:variable name="draw-name">
+ <xsl:value-of select="substring($random-name,string-length($random-name)-1)"/>
+ </xsl:variable>
+ <xsl:call-template name="graphic-fill">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ <xsl:with-param name="gradient-name" select="图:预定义图形/图:属性/图:填充/图:渐变"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变 | 图:预定义图形/图:属性/图:填充/图:颜色 | 图:预定义图形/图:属性/图:填充/图:图片 | 图:预定义图形/图:属性/图:填充/图:位图">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:if test="图:文本内容/@图:自动换行='true' or 图:文本内容/@图:自动换行='1'">
+ <xsl:attribute name="draw:fit-to-contour">true</xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:graphic-properties">
+ <xsl:call-template name="process-graphics">
+ <xsl:with-param name="draw-name" select="$draw-name"/>
+ </xsl:call-template>
+ </xsl:element>
+ <xsl:if test="图:文本内容/@图:文字排列方向">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="@图:其他对象 or key('rel_graphic_name',@图:标识符)/字:锚点属性/字:锚点属性/字:位置/字:垂直/字:相对/@字:相对于">
+ <xsl:attribute name="fo:clip">rect(0cm 0cm 0cm 0cm)</xsl:attribute>
+ <xsl:attribute name="draw:color-mode">standard</xsl:attribute>
+ <xsl:attribute name="draw:luminance">0%</xsl:attribute>
+ <xsl:attribute name="draw:contrast">0%</xsl:attribute>
+ <xsl:attribute name="draw:gamma">100%</xsl:attribute>
+ <xsl:attribute name="draw:red">0%</xsl:attribute>
+ <xsl:attribute name="draw:green">0%</xsl:attribute>
+ <xsl:attribute name="draw:blue">0%</xsl:attribute>
+ <xsl:attribute name="draw:image-opacity">100%</xsl:attribute>
+ <xsl:attribute name="style:mirror">none</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="process-graphics"/>
+ </xsl:element>
+ <xsl:if test="图:文本内容/@图:文字排列方向">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'">
+ <style:paragraph-properties style:writing-mode="tb-rl"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="bina_graphic">
+ <xsl:param name="refGraphic"/>
+ <xsl:element name="office:binary-data">
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符 = $refGraphic]">
+ <xsl:value-of select="uof:数据"/>
+ </xsl:for-each>
+ </xsl:element>
+ <text:p/>
+ </xsl:template>
+ <xsl:template name="graphic-fill">
+ <xsl:param name="draw-name"/>
+ <xsl:param name="gradient-name"/>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:element name="draw:gradient">
+ <xsl:attribute name="draw:name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ <xsl:attribute name="draw:style"><xsl:choose><xsl:when test="$gradient-name/@图:种子类型='linear'"><xsl:value-of select="'linear'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='radar'"><xsl:value-of select="'radial'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='oval'"><xsl:value-of select="'ellipsoid'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='square'"><xsl:value-of select="'square'"/></xsl:when><xsl:when test="$gradient-name/@图:种子类型='rectangle'"><xsl:value-of select="'rectangular'"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="draw:start-color"><xsl:value-of select="$gradient-name/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:end-color"><xsl:value-of select="$gradient-name/@图:终止色"/></xsl:attribute>
+ <xsl:attribute name="draw:start-intensity"><xsl:value-of select="concat($gradient-name/@图:起始浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:end-intensity"><xsl:value-of select="concat($gradient-name/@图:终止浓度,'%')"/></xsl:attribute>
+ <xsl:attribute name="draw:angle"><xsl:value-of select="$gradient-name/@图:渐变方向 * 10"/></xsl:attribute>
+ <xsl:attribute name="draw:border"><xsl:value-of select="concat($gradient-name/@图:边界,'%')"/></xsl:attribute>
+ <xsl:if test="$gradient-name/@图:种子X位置">
+ <xsl:attribute name="draw:cx"><xsl:value-of select="concat($gradient-name/@图:种子X位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$gradient-name/@图:种子Y位置">
+ <xsl:attribute name="draw:cy"><xsl:value-of select="concat($gradient-name/@图:种子Y位置,'%')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头">
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">
+ <xsl:attribute name="svg:viewBox">0 0 20 30</xsl:attribute>
+ <xsl:attribute name="svg:d">m10 0-10 30h20z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">
+ <xsl:attribute name="svg:viewBox">0 0 1122 2243</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1580</xsl:attribute>
+ <xsl:attribute name="svg:d">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">
+ <xsl:attribute name="svg:viewBox">0 0 1131 1131</xsl:attribute>
+ <xsl:attribute name="svg:d">m0 564 564 567 567-567-567-564z</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用 or 图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:element name="draw:fill-image">
+ <xsl:attribute name="draw:name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:类型"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/></xsl:when></xsl:choose></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:call-template name="bina_graphic">
+ <xsl:with-param name="refGraphic">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:图形引用"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="not(图:预定义图形/图:属性/图:线型='single') and not(图:预定义图形/图:属性/图:线型='thick') and 图:预定义图形/图:属性/图:线型">
+ <xsl:variable name="line" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:element name="draw:stroke-dash">
+ <xsl:choose>
+ <xsl:when test="$line='dash-long' or $line='dash-long-heavy'">
+ <xsl:attribute name="draw:name">Fine_20_Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dot-dash' or $line='dash-dot-dot-heavy'">
+ <xsl:attribute name="draw:name">2 Dots 1 Dash</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.203cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.203cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dash' or $line='dashed-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.051cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dotted' or $line='dotted-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine Dotted (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:distance">50%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wave' or $line='wavy-heavy'">
+ <xsl:attribute name="draw:name">Ultrafine 2 Dots 3 Dashes</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">2</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.051cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.254cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.127cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='dot-dash' or $line='dash-dot-heavy'">
+ <xsl:attribute name="draw:name">3 Dashes 3 Dots (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">3</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:dots2">3</xsl:attribute>
+ <xsl:attribute name="draw:distance">100%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='double'">
+ <xsl:attribute name="draw:name">Line with Fine Dots</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">2.007cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">10</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.152cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$line='wavy-double'">
+ <xsl:attribute name="draw:name">Fine Dashed (var)</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">197%</xsl:attribute>
+ <xsl:attribute name="draw:distance">197%</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:name">Fine Dashed</xsl:attribute>
+ <xsl:attribute name="draw:style">rect</xsl:attribute>
+ <xsl:attribute name="draw:dots1">1</xsl:attribute>
+ <xsl:attribute name="draw:dots1-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:dots2">1</xsl:attribute>
+ <xsl:attribute name="draw:dots2-length">0.508cm</xsl:attribute>
+ <xsl:attribute name="draw:distance">0.508cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="process-graphics">
+ <xsl:param name="draw-name"/>
+ <xsl:if test="图:预定义图形/图:类别">
+ </xsl:if>
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:位置/字:垂直">
+ <xsl:attribute name="style:vertical-pos"><xsl:choose><xsl:when test="字:绝对">from-top</xsl:when><xsl:when test="字:相对/@字:值='bottom'">bottom</xsl:when><xsl:when test="字:相对/@字:值='center'">middle</xsl:when><xsl:when test="字:相对/@字:值='inside'">below</xsl:when><xsl:otherwise>top</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:vertical-rel"><xsl:choose><xsl:when test="@字:相对于='margin'">paragraph-content</xsl:when><xsl:otherwise><xsl:value-of select="@字:相对于"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:位置/字:水平">
+ <xsl:attribute name="style:horizontal-pos"><xsl:choose><xsl:when test="字:绝对">from-left</xsl:when><xsl:otherwise><xsl:value-of select="字:相对/@字:值"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:horizontal-rel"><xsl:choose><xsl:when test="@字:相对于='margin'">paragraph</xsl:when><xsl:when test="@字:相对于='page'">page</xsl:when><xsl:when test="@字:相对于='column'">paragraph</xsl:when><xsl:when test="@字:相对于='char'">char</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:variable name="wrap_type">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:绕排/@字:绕排方式"/>
+ </xsl:variable>
+ <xsl:variable name="aa">
+ <xsl:value-of select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:绕排/@字:绕排顶点"/>
+ </xsl:variable>
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:绕排/@字:绕排方式">
+ <xsl:attribute name="style:wrap"><xsl:choose><xsl:when test="$wrap_type = 'through'">run-through</xsl:when><xsl:when test="$wrap_type = 'tight'">right</xsl:when><xsl:when test="$wrap_type = 'square'">parallel</xsl:when><xsl:when test="$wrap_type = 'top-bottom'">dynamic</xsl:when><xsl:when test="$wrap_type = 'infrontoftext'">run-through</xsl:when><xsl:when test="$wrap_type = 'behindtext'">run-through</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:run-through"><xsl:choose><xsl:when test="$wrap_type = 'behindtext'">background</xsl:when><xsl:otherwise>foreground</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:for-each>
+ <xsl:if test="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:边距">
+ <xsl:for-each select="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:边距">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(@字:上,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(@字:下,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(@字:右,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(@字:左,$uofUnit)"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="key('rel_graphic_name',@图:标识符)/字:锚点属性/字:保护/@字:值='true'">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:名称">
+ <xsl:attribute name="style:protect">position size</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:protect">content size position</xsl:attribute>
+ <xsl:attribute name="draw:size-protect">true</xsl:attribute>
+ <xsl:attribute name="draw:move-protect">true</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:名称">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:名称='椭圆'">
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="not(图:预定义图形/图:属性/图:填充)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称='background-image'">
+ <xsl:element name="style:background-image">
+ <xsl:element name="office:binary-data">
+ <xsl:variable name="biaoshi">
+ <xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/>
+ </xsl:variable>
+ <xsl:value-of select="ancestor::uof:对象集/uof:其他对象[@uof:标识符=$biaoshi]/uof:数据"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:名称"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图片/@图:图形引用"/></xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="not(图:预定义图形/图:属性/图:填充/图:图片/@图:位置='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='center'">no-repeat</xsl:when><xsl:when test="图:预定义图形/图:属性/图:填充/图:图片/@图:位置='stretch'">stretch</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:图案">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:图案/@图:前景色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:颜色">
+ <xsl:attribute name="draw:fill">solid</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:颜色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:预定义图形/图:属性/图:填充/图:渐变">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-color"><xsl:value-of select="图:预定义图形/图:属性/图:填充/图:渐变/@图:起始色"/></xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name"><xsl:value-of select="concat('Gradient ',$draw-name)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="图:预定义图形/图:属性/图:线颜色">
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线型 and not(图:预定义图形/图:属性/图:线型 = 'single') and not(图:预定义图形/图:属性/图:线型 = 'thick')">
+ <xsl:variable name="linetype" select="图:预定义图形/图:属性/图:线型"/>
+ <xsl:attribute name="draw:stroke"><xsl:choose><xsl:when test="$linetype='none'">none</xsl:when><xsl:otherwise>dash</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="$linetype='none'">
+ <xsl:attribute name="fo:border">none</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:stroke-dash"><xsl:choose><xsl:when test="$linetype='dot-dot-dash' or $linetype='dash-dot-dot-heavy'">2 Dots 1 Dash</xsl:when><xsl:when test="$linetype='dash' or $linetype='dashed-heavy'">Ultrafine_20_Dashed</xsl:when><xsl:when test="$linetype='dotted' or $linetype='dotted-heavy'">Ultrafine Dotted (var)</xsl:when><xsl:when test="$linetype='double'">Line with Fine Dots</xsl:when><xsl:when test="$linetype='dot-dash' or $linetype='dash-dot-heavy'">3 Dashes 3 Dots (var)</xsl:when><xsl:when test="$linetype='wave' or $linetype='wavy-heavy'">Ultrafine 2 Dots 3 Dashes</xsl:when><xsl:when test="$linetype='wavy-double'">Fine Dashed (var)</xsl:when><xsl:otherwise>Fine Dashed</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:线粗细">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="concat(图:预定义图形/图:属性/图:线粗细,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头">
+ <xsl:attribute name="draw:marker-start"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:前端箭头/图:大小">
+ <xsl:attribute name="draw:marker-start-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:前端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头">
+ <xsl:attribute name="draw:marker-end"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='normal'">Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='open'">Line Arrow</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='stealth'">Arrow concave</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='oval'">Circle</xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:式样='diamond'">Square 45</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:后端箭头/图:大小">
+ <xsl:attribute name="draw:marker-end-width"><xsl:choose><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '1'"><xsl:value-of select="concat('0.05',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '2'"><xsl:value-of select="concat('0.10',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '3'"><xsl:value-of select="concat('0.15',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '4'"><xsl:value-of select="concat('0.20',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '5'"><xsl:value-of select="concat('0.25',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '6'"><xsl:value-of select="concat('0.30',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '7'"><xsl:value-of select="concat('0.35',$uofUnit)"/></xsl:when><xsl:when test="图:预定义图形/图:属性/图:后端箭头/图:大小 = '8'"><xsl:value-of select="concat('0.40',$uofUnit)"/></xsl:when><xsl:otherwise><xsl:value-of select="concat('0.45',$uofUnit)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:宽度">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:高度">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:锁定纵横比">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:打印对象">
+ </xsl:if>
+ <xsl:if test="图:预定义图形/图:属性/图:透明度">
+ <xsl:attribute name="draw:opacity"><xsl:value-of select="concat((100 - 图:预定义图形/图:属性/图:透明度),'%')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:if test="图:文本内容/@图:上边距">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(图:文本内容/@图:上边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(图:文本内容/@图:下边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(图:文本内容/@图:左边距,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(图:文本内容/@图:右边距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:文字排列方向">
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-l2r'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:文本内容/@图:文字排列方向='vert-r2l'">
+ <xsl:attribute name="style:writing-mode">tb-rl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:水平对齐">
+ <xsl:attribute name="draw:textarea-horizontal-align"><xsl:value-of select="图:文本内容/@图:水平对齐"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:垂直对齐">
+ <xsl:attribute name="draw:textarea-vertical-align"><xsl:value-of select="图:文本内容/@图:垂直对齐"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容/@图:自动换行">
+ <xsl:attribute name="fo:wrap-option"><xsl:choose><xsl:when test="图:文本内容/@图:自动换行='1' or 图:文本内容/@图:自动换行='true'">wrap</xsl:when><xsl:otherwise>no-wrap</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="图:文本内容/@图:大小适应文字='true'">
+ <xsl:attribute name="draw:auto-grow-width">true</xsl:attribute>
+ <xsl:attribute name="draw:auto-grow-height">true</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:auto-grow-width">false</xsl:attribute>
+ <xsl:attribute name="draw:auto-grow-height">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="图:控制点">
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="图形解析">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:variable name="paiban">
+ <xsl:value-of select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:名称"/>
+ </xsl:variable>
+ <xsl:variable name="otherobject">
+ <xsl:value-of select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/@图:其他对象"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]">
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='png' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='jpg' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='bmp' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:公共类型='gif' or /uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/@uof:私有类型='图片'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::字:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生成软件"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据">
+ <draw:image>
+ <office:binary-data>
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:数据"/>
+ </office:binary-data>
+ </draw:image>
+ </xsl:if>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/@图:其他对象 and /uof:UOF/uof:对象集/uof:其他对象/@uof:公共类型='jpg'">
+ <xsl:variable name="bshi">
+ <xsl:value-of select="/uof:UOF/uof:对象集/图:图形/@图:其他对象"/>
+ </xsl:variable>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$bshi]/@uof:公共类型='jpg'">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:name"><xsl:variable name="pos"><xsl:value-of select="count(preceding::字:锚点)"/></xsl:variable><xsl:value-of select="concat('图形',$pos)"/></xsl:attribute>
+ <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生成软件"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ <xsl:variable name="qita">
+ <xsl:value-of select="self::node()/@图:其他对象"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$qita]/uof:数据">
+ <draw:image>
+ <office:binary-data>
+ <xsl:value-of select="."/>
+ </office:binary-data>
+ </draw:image>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:if test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径">
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$tuxing1]/uof:路径"/></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:文本内容[@图:文本框='true'] and not($paiban='排版框')">
+ <draw:frame text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$tuxing1"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]"><xsl:value-of select="@图:层次"/></xsl:for-each>
+ </xsl:attribute>
+ <draw:text-box>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:段落"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="leibie">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]">
+ <xsl:value-of select="图:预定义图形/图:类别"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="leibie2">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]">
+ <xsl:value-of select="图:预定义图形/图:名称"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$leibie='22'">
+ <xsl:call-template name="排版框">
+ <xsl:with-param name="biaoshi" select="$tuxing1"/>
+ <xsl:with-param name="name" select="$leibie2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$leibie='23'">
+ <xsl:call-template name="文本框">
+ <xsl:with-param name="biaoshi" select="$tuxing1"/>
+ <xsl:with-param name="name" select="$leibie2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$leibie='11'">
+ <xsl:call-template name="Rectangle"/>
+ </xsl:when>
+ <xsl:when test="$leibie='19'">
+ <xsl:call-template name="Oval"/>
+ </xsl:when>
+ <xsl:when test="$leibie='61'">
+ <xsl:call-template name="Line"/>
+ </xsl:when>
+ <xsl:when test="$leibie='62'">
+ <xsl:call-template name="Line"/>
+ </xsl:when>
+ <xsl:when test="$leibie='63'">
+ <xsl:call-template name="Line"/>
+ </xsl:when>
+ <xsl:when test="$leibie='64'">
+ <xsl:call-template name="Curve"/>
+ </xsl:when>
+ <xsl:when test="$leibie='65'">
+ <xsl:call-template name="Freeform"/>
+ </xsl:when>
+ <xsl:when test="$leibie='66'">
+ <xsl:call-template name="Scribble"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="文本框">
+ <xsl:param name="biaoshi"/>
+ <xsl:param name="name"/>
+ <draw:frame text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$biaoshi"/></xsl:attribute>
+ <xsl:attribute name="draw:name"><xsl:value-of select="$name"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $biaoshi]">
+ <xsl:value-of select="@图:层次"/>
+ </xsl:for-each>
+ </xsl:attribute>
+ <draw:text-box>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:段落"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:template>
+ <xsl:template name="Curve">
+ <xsl:element name="draw:path">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]">
+ <xsl:variable name="width" select="number(图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="svg:d"><xsl:value-of select="图:预定义图形/图:关键点坐标/@图:路径"/></xsl:attribute>
+ </xsl:for-each>
+ <xsl:call-template name="common"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="common">
+ <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生成软件"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="common1">
+ <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:预定义图形/图:属性/图:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:height"><xsl:value-of select="concat(/uof:UOF/uof:对象集/图:图形[@图:标识符=$tuxing1]/图:预定义图形/图:属性/图:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:anchor-type"><xsl:choose><xsl:when test="@字:类型='inline'">as-char</xsl:when><xsl:otherwise>paragraph</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生成软件"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="Freeform">
+ <xsl:element name="draw:polygon">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:variable name="width" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:关键点坐标"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="concat(number(图:坐标[1]/@x坐标)*1000,',',number(图:坐标[1]/@y坐标)*1000)"/><xsl:with-param name="point-pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ <xsl:call-template name="common"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="drawpoints">
+ <xsl:param name="points"/>
+ <xsl:param name="point-pos"/>
+ <xsl:choose>
+ <xsl:when test="图:坐标[$point-pos]">
+ <xsl:variable name="points1" select="concat($points,' ',number(图:坐标[$point-pos]/@x坐标)*1000,',',number(图:坐标[$point-pos]/@y坐标)*1000)"/>
+ <xsl:call-template name="drawpoints">
+ <xsl:with-param name="points" select="$points1"/>
+ <xsl:with-param name="point-pos" select="$point-pos+1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$points"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Scribble">
+ <xsl:element name="draw:polyline">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:variable name="width" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:宽度)*1000"/>
+ <xsl:variable name="height" select="number(/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:属性/图:高度)*1000"/>
+ <xsl:attribute name="svg:viewBox"><xsl:value-of select="concat('0 0 ',$width, ' ',$height)"/></xsl:attribute>
+ <xsl:attribute name="draw:points"><xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]/图:预定义图形/图:关键点坐标"><xsl:call-template name="drawpoints"><xsl:with-param name="points" select="concat(number(图:坐标[1]/@x坐标)*1000,',',number(图:坐标[1]/@y坐标)*1000)"/><xsl:with-param name="point-pos" select="2"/></xsl:call-template></xsl:for-each></xsl:attribute>
+ <xsl:call-template name="common"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Oval">
+ <xsl:element name="draw:ellipse">
+ <xsl:call-template name="common1"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="排版框">
+ <xsl:param name="biaoshi"/>
+ <xsl:param name="name"/>
+ <draw:frame text:anchor-type="paragraph">
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="$biaoshi"/></xsl:attribute>
+ <xsl:attribute name="draw:name"><xsl:value-of select="$name"/></xsl:attribute>
+ <xsl:attribute name="svg:width"><xsl:value-of select="concat(字:锚点属性/字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="字:锚点属性/字:位置/字:水平/字:绝对">
+ <xsl:attribute name="svg:x"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:锚点属性/字:位置/字:垂直/字:绝对">
+ <xsl:attribute name="svg:y"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:z-index">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $biaoshi]">
+ <xsl:value-of select="@图:层次"/>
+ </xsl:for-each>
+ </xsl:attribute>
+ <draw:text-box>
+ <xsl:attribute name="fo:min-height"><xsl:value-of select="concat(字:锚点属性/字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:段落"/>
+ <xsl:apply-templates select="/uof:UOF/uof:对象集/图:图形[@图:标识符=$biaoshi]/图:文本内容/字:文字表"/>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:template>
+ <xsl:template name="Rectangle">
+ <xsl:element name="draw:rect">
+ <xsl:call-template name="common1"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="Line">
+ <xsl:element name="draw:line">
+ <xsl:variable name="tuxing1" select="字:图形/@字:图形引用"/>
+ <xsl:attribute name="svg:x1"><xsl:value-of select="concat(字:锚点属性/字:位置/字:水平/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y1"><xsl:value-of select="concat(字:锚点属性/字:位置/字:垂直/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:x2"><xsl:value-of select="concat((字:锚点属性/字:位置/字:水平/字:绝对/@字:值 + 字:锚点属性/字:宽度),$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="svg:y2"><xsl:value-of select="concat((字:锚点属性/字:位置/字:垂直/字:绝对/@字:值 + 字:锚点属性/字:高度),$uofUnit)"/></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形[@图:标识符 = $tuxing1]">
+ <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+ <xsl:attribute name="draw:style-name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="draw:z-index"><xsl:value-of select="@图:层次"/></xsl:attribute>
+ <xsl:if test="图:预定义图形/图:属性/图:旋转角度 and not(图:预定义图形/图:属性/图:旋转角度='0.0')">
+ <xsl:variable name="jiaodu">
+ <xsl:value-of select="图:预定义图形/图:属性/图:旋转角度"/>
+ </xsl:variable>
+ <xsl:variable name="shibie">
+ <xsl:value-of select="图:预定义图形/图:生成软件"/>
+ </xsl:variable>
+ <xsl:variable name="rotate-angle">
+ <xsl:choose>
+ <xsl:when test="图:预定义图形/图:生成软件 and not($shibie='PNG')">
+ <xsl:value-of select="((360 - $jiaodu) * 2 * 3.14159265 ) div 360"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="(图:预定义图形/图:属性/图:旋转角度 * 2 * 3.14159265 ) div 360"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="draw:transform"><xsl:value-of select="concat('rotate (',$rotate-angle,') translate (-0.0194027777777778cm 3.317875cm)')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="图:文本内容">
+ <xsl:apply-templates select="图:文本内容/字:段落"/>
+ <xsl:apply-templates select="图:文本内容/字:文字表"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="processPageBreaks">
+ <xsl:variable name="pageBreak" select="字:句/字:分页符"/>
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="$pageBreak[1]/preceding-sibling::字:句"/>
+ <xsl:with-param name="pageBreak"/>
+ <xsl:with-param name="needsPageBreak">false</xsl:with-param>
+ </xsl:call-template>
+ <xsl:for-each select="$pageBreak">
+ <xsl:call-template name="createSubParagraph">
+ <xsl:with-param name="list" select="./following-sibling::字:句[preceding::字:句/字:分页符 = '.']"/>
+ <xsl:with-param name="pageBreak" select="."/>
+ <xsl:with-param name="needsPageBreak">true</xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="createSubParagraph">
+ <xsl:param name="list"/>
+ <xsl:param name="pageBreak"/>
+ <xsl:param name="needsPageBreak"/>
+ <xsl:if test="(count($list) &gt; 0) or ($needsPageBreak ='true') ">
+ <xsl:element name="text:p">
+ <xsl:choose>
+ <xsl:when test="$needsPageBreak = 'true'">
+ <xsl:choose>
+ <xsl:when test="ancestor::字:段落/字:段落属性">
+ <xsl:attribute name="text:style-name">P<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落属性"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">PageBreak</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="$pageBreak">
+ <xsl:apply-templates select="$pageBreak"/>
+ </xsl:if>
+ <xsl:apply-templates select="$list"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:句/字:区域开始[@字:类型='bookmark']">
+ <xsl:variable name="biaoshi">
+ <xsl:value-of select="@字:标识符"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(@字:名称)">
+ <text:bookmark-start text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本位置/@字:区域引用=$biaoshi]/@uof:名称}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:bookmark-start text:name="{@字:名称}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:句/字:区域结束[preceding::字:区域开始[1]/@字:类型='bookmark']">
+ <xsl:variable name="biaoshi">
+ <xsl:value-of select="@字:标识符引用"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(@字:名称)">
+ <text:bookmark-end text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本位置/@字:区域引用=$biaoshi]/@uof:名称}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:bookmark-end text:name="{@字:名称}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:区域开始[@字:类型='annotation']">
+ <text:bookmark-start text:name="{@字:标识符}"/>
+ </xsl:template>
+ <xsl:template match="字:区域结束[preceding::字:区域开始[1]/@字:类型='annotation']">
+ <text:bookmark-end text:name="{@字:标识符引用}"/>
+ </xsl:template>
+ <xsl:template match="字:区域开始[@字:类型='user-data']">
+ <text:alphabetical-index-mark-start text:id="{@字:标识符}" text:string-value-phonetic="{@字:名称}"/>
+ </xsl:template>
+ <xsl:template match="字:区域结束[preceding::字:区域开始[1]/@字:类型='user-data']">
+ <text:alphabetical-index-mark-end text:id="{@字:标识符引用}"/>
+ </xsl:template>
+ <xsl:template match="字:段落/字:域开始">
+ <xsl:choose>
+ <xsl:when test="@字:类型='createdate'">
+ <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/>
+ <xsl:element name="text:creation-date">
+ <xsl:attribute name="style:data-style-name">CreateDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createdate']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='savedate'">
+ <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/>
+ <xsl:element name="text:date">
+ <xsl:attribute name="style:data-style-name">SaveDate<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'savedate']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:attribute name="text:fixed">true</xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='date'">
+ <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/>
+ <xsl:element name="text:date">
+ <xsl:attribute name="style:data-style-name">Date<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'date']"/></xsl:attribute>
+ <xsl:attribute name="text:date-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='time'">
+ <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/>
+ <xsl:element name="text:time">
+ <xsl:attribute name="style:data-style-name">Time<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'time']"/></xsl:attribute>
+ <xsl:attribute name="text:time-value"><xsl:value-of select="$datestr"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='edittime'">
+ <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/>
+ <xsl:element name="text:editing-duration">
+ <xsl:attribute name="style:data-style-name">EditTime<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'edittime']"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='createtime'">
+ <xsl:variable name="datestr" select="../字:句[preceding-sibling::字:域代码]/字:文本串"/>
+ <xsl:element name="text:creation-time">
+ <xsl:attribute name="style:data-style-name">CREATETIME<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落/字:域开始[@字:类型 = 'createtime']"/></xsl:attribute>
+ <xsl:value-of select="$datestr"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@字:类型='page'">
+ <xsl:call-template name="页码域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='numpages'">
+ <xsl:call-template name="页数域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='author'">
+ <xsl:call-template name="作者域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='username'">
+ <xsl:call-template name="用户域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='userinitials'">
+ <xsl:call-template name="缩写域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='title'">
+ <xsl:call-template name="标题域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='subject'">
+ <xsl:call-template name="主题域"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='numchars'">
+ <xsl:call-template name="字符数"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='filename'">
+ <xsl:call-template name="文件名"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='edittime'">
+ <xsl:call-template name="编辑时间"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='creation-time'">
+ <xsl:call-template name="创建时间"/>
+ </xsl:when>
+ <xsl:when test="@字:类型='seq'">
+ <xsl:call-template name="题注"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="commonParagraph">
+ <xsl:choose>
+ <xsl:when test="字:段落属性/字:大纲级别">
+ <xsl:element name="text:h">
+ <xsl:call-template name="commonParagraphAttributes"/>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="not (字:域开始/@字:类型='ref') and not(字:域开始/@字:类型='index')">
+ <xsl:element name="text:p">
+ <xsl:call-template name="commonParagraphAttributes"/>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="commonParagraphAttributes">
+ <xsl:choose>
+ <xsl:when test="字:段落属性">
+ <xsl:variable name="pp">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/>
+ </xsl:variable>
+ <xsl:variable name="aa">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:域结束]"/>
+ </xsl:variable>
+ <xsl:variable name="stylename" select="字:段落属性/@字:式样引用"/>
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::字:段落/字:域结束">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$pp+$aa)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($stylename,'Heading')">
+ <xsl:attribute name="text:style-name"><xsl:value-of select="$stylename"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$pp)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="字:段落属性/字:大纲级别">
+ <xsl:attribute name="text:outline-level"><xsl:value-of select="字:段落属性/字:大纲级别"/></xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="generate-id(ancestor::字:主体/descendant::字:段落[1]) = generate-id(.)">
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">P<xsl:value-of select="number($paragraph-number)"/>_1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not(字:段落属性) and (descendant::字:分栏符 or ancestor::字:分节/descendant::字:节属性[字:分栏/@字:栏数 &gt; 1])">
+ <xsl:attribute name="text:style-name">ColumnBreakPara</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:句">
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:段落属性"/>
+ <xsl:template match="字:句/字:句属性"/>
+ <xsl:template match="字:句属性" mode="style">
+ <xsl:if test="not(@字:式样引用)">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句属性" format="1"/></xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="@字:式样引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:式样引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="./*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:句/字:文本串">
+ <xsl:choose>
+ <xsl:when test="string(.) = ' ' ">
+ <xsl:element name="text:s"/>
+ </xsl:when>
+ <xsl:when test="contains(.,' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="replace-spaces">
+ <xsl:param name="curr-string"/>
+ <xsl:if test="contains($curr-string,' ')">
+ <xsl:value-of select="substring-before($curr-string,' ')"/>
+ <text:s text:c="2"/>
+ <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-string, ' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="$next-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next-string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:空格符[parent::字:句]">
+ <xsl:element name="text:s">
+ <xsl:attribute name="text:c"><xsl:value-of select="@字:个数"/></xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:制表符[parent::字:句]">
+ <xsl:element name="text:tab"/>
+ </xsl:template>
+ <xsl:template match="字:句">
+ <xsl:if test="name(following-sibling::*[1])!='字:域结束'">
+ <xsl:if test="字:换行符">
+ <xsl:element name="text:line-break"/>
+ </xsl:if>
+ <xsl:variable name="currently-node" select="./字:锚点"/>
+ <xsl:choose>
+ <xsl:when test="字:句属性//字:隐藏文字/@字:值='true'">
+ <text:hidden-text text:is-hidden="true" text:string-value="{.}"/>
+ </xsl:when>
+ <xsl:when test="字:区域开始[@字:类型='hyperlink']">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:variable name="hyperDest" select="字:区域开始/@字:标识符"/>
+ <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链源=$hyperDest"><xsl:if test="@uof:提示"><xsl:attribute name="office:name"><xsl:value-of select="@uof:提示"/></xsl:attribute></xsl:if><xsl:if test="@uof:目标"><xsl:variable name="bsh" select="@uof:目标"/><xsl:choose><xsl:when test="contains($bsh,'\')"><xsl:value-of select="concat('/',translate($bsh,'\','/'))"/></xsl:when><xsl:otherwise><xsl:value-of select="$bsh"/></xsl:otherwise></xsl:choose></xsl:if><xsl:if test="@uof:书签"><xsl:variable name="bookmarkDest" select="@uof:书签"/><xsl:choose><xsl:when test="/uof:UOF/uof:书签集/uof:书签"><xsl:for-each select="/uof:UOF/uof:书签集/uof:书签"><xsl:if test="@uof:名称=$bookmarkDest"><xsl:value-of select="concat('#',@uof:名称)"/></xsl:if></xsl:for-each></xsl:when><xsl:otherwise><xsl:value-of select="concat('#',$bookmarkDest)"/></xsl:otherwise></xsl:choose></xsl:if></xsl:if></xsl:for-each></xsl:attribute>
+ <xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接">
+ <xsl:if test="@uof:链源=$hyperDest">
+ <xsl:if test="@uof:提示">
+ <xsl:attribute name="office:name"><xsl:value-of select="@uof:提示"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:choose>
+ <xsl:when test="./字:文本串">
+ <xsl:apply-templates select="字:文本串"/>
+ </xsl:when>
+ <xsl:when test="following-sibling::字:句/字:文本串">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="字:区域结束 and preceding::字:区域开始[1]/@字:类型='bookmark' and not(self::node()/字:区域开始)">
+ <xsl:variable name="aa">
+ <xsl:value-of select="字:区域结束/@字:标识符引用"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="preceding::字:区域开始[1]/@字:类型='bookmark' and not(preceding::字:区域开始[1]/@字:名称)">
+ <text:bookmark-end text:name="{/uof:UOF/uof:书签集/uof:书签[uof:文本位置/@字:区域引用=$aa]/@uof:名称}"/>
+ </xsl:when>
+ <xsl:when test="preceding::字:区域开始[1]/@字:类型='bookmark'">
+ <text:bookmark-end text:name="{preceding::字:区域开始[1]/@字:名称}"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::字:句[position()=1]/字:区域开始[@字:类型='hyperlink'] and not(preceding-sibling::字:句[position()=1]/字:区域结束)"/>
+ <xsl:when test="(preceding-sibling::字:句) or (字:句属性)or(字:区域开始)">
+ <xsl:element name="text:span">
+ <xsl:choose>
+ <xsl:when test="字:区域开始[@字:类型='annotation']">
+ <xsl:variable name="ref_comment">
+ <xsl:value-of select="字:区域开始/@字:标识符"/>
+ </xsl:variable>
+ <xsl:apply-templates/>
+ <xsl:apply-templates select="/uof:UOF/uof:文字处理/字:公用处理规则/字:批注集/字:批注[@字:区域引用 = $ref_comment]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('T',$stylenum)"/></xsl:attribute>
+ <xsl:apply-templates select="*[not(name()='字:引文符号')]"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="字:文本串|字:锚点|字:空格符|字:换行符|字:制表符|字:区域开始|字:区域结束|字:脚注|字:尾注"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="node()[name() = '字:位置']">
+ <xsl:attribute name="style:text-position"><xsl:variable name="val"><xsl:value-of select="."/></xsl:variable><xsl:choose><xsl:when test="$val='sub' or $val='super'"><xsl:value-of select="concat($val,' 58%')"/></xsl:when><xsl:when test="contains($val,'sub ') or contains($val,'super ')"><xsl:value-of select="concat($val,'%')"/></xsl:when><xsl:when test="not(contains($val,' '))"><xsl:value-of select="concat($val,'% 100%')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(substring-before($val,' '),'% ',substring-after($val,' '),'%' )"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:批注">
+ <office:annotation office:display="true">
+ <xsl:variable name="name" select="@字:作者"/>
+ <dc:creator>
+ <xsl:value-of select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$name]/@字:姓名"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="@字:日期"/>
+ </dc:date>
+ <xsl:apply-templates select="字:段落"/>
+ </office:annotation>
+ </xsl:template>
+ <xsl:template match="字:字体">
+ <xsl:if test="@字:字号">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="@字:字号"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:相对字号 and self::node( )[not(parent::字:句属性)]">
+ <xsl:variable name="stylename" select="parent::node()/@字:基式样引用"/>
+ <xsl:variable name="zihao">
+ <xsl:for-each select="/uof:UOF/uof:式样集//uof:段落式样[@字:标识符=$stylename]">
+ <xsl:value-of select="字:字体/@字:字号"/>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="font-size" select="@字:相对字号"/>
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex"><xsl:value-of select="($zihao * $font-size div 100)"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:中文字体引用">
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:西文字体引用">
+ <xsl:variable name="xiwen" select="@字:西文字体引用"/>
+ <xsl:attribute name="style:font-name"><xsl:value-of select="translate($xiwen,'_',' ')"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:斜体">
+ <xsl:if test="@字:值='true'">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:粗体">
+ <xsl:if test="@字:值='true'or @字:值='1'">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:下划线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'double'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'thick'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dotted-heavy'">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dashed-heavy'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dot-dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'dash-dot-dot-heavy'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wave'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-heavy'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'wavy-double'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ <xsl:attribute name="style:text-underline-width">auto</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@字:颜色">
+ <xsl:attribute name="style:text-underline-color"><xsl:choose><xsl:when test="@字:颜色='auto'">font-color</xsl:when><xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-underline-color">font-color</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:着重号">
+ <xsl:if test="not(@字:类型='none')">
+ <xsl:choose>
+ <xsl:when test="@字:类型='dot'">
+ <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='accent above' ">
+ <xsl:attribute name="style:text-emphasize">accent above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot above' ">
+ <xsl:attribute name="style:text-emphasize">dot above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc above' ">
+ <xsl:attribute name="style:text-emphasize">disc above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle above' ">
+ <xsl:attribute name="style:text-emphasize">circle above</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='accent below' ">
+ <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='dot below' ">
+ <xsl:attribute name="style:text-emphasize">dot below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='disc below' ">
+ <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='circle below' ">
+ <xsl:attribute name="style:text-emphasize">circle below</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>none</xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:颜色">
+ <xsl:attribute name="fo:color"><xsl:value-of select="@字:颜色"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:隐藏文字">
+ <xsl:attribute name="text:display"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:空心">
+ <xsl:attribute name="style:text-outline"><xsl:value-of select="@字:值"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:阴影">
+ <xsl:if test="not(@字:值='false')">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:闪动的">
+ <xsl:attribute name="style:text-blinking"><xsl:value-of select="@字:闪动的"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:删除线">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'single' ">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'double' ">
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'bold' ">
+ <xsl:attribute name="style:text-line-through-width">bold</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = 'xl' ">
+ <xsl:attribute name="style:text-line-through-text">X</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型 = '/l' ">
+ <xsl:attribute name="style:text-line-through-text">/</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-crossing-out">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:突出显示">
+ <xsl:attribute name="fo:background-color">
+ <xsl:choose>
+ <xsl:when test="@字:颜色='auto'">transparent</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@字:颜色"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template match="@字:颜色[not(.='auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="."/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:浮雕">
+ <xsl:attribute name="style:font-relief"><xsl:choose><xsl:when test="@字:类型='engrave'">engraved</xsl:when><xsl:when test="@字:类型='emboss'">embossed</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:醒目字体">
+ <xsl:choose>
+ <xsl:when test="@字:类型='small-caps'">
+ <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:类型='none'">
+ <xsl:attribute name="fo:font-variant">normal</xsl:attribute>
+ <xsl:attribute name="fo:text-transform">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-transform"><xsl:choose><xsl:when test="@字:类型='uppercase'">uppercase</xsl:when><xsl:when test="@字:类型='lowercase'">lowercase</xsl:when><xsl:when test="@字:类型='capital'">capitalize</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:位置" mode="oo">
+ <xsl:attribute name="style:text-position"><xsl:variable name="val"><xsl:value-of select="."/></xsl:variable><xsl:choose><xsl:when test="$val='sub' or $val='super'"><xsl:value-of select="concat($val,' 58%')"/></xsl:when><xsl:when test="contains($val,'sub ') or contains($val,'super ')"><xsl:value-of select="concat($val,'%')"/></xsl:when><xsl:when test="not(contains($val,' '))"><xsl:value-of select="concat($val,'% 100%')"/></xsl:when><xsl:otherwise><xsl:value-of select="concat(substring-before($val,' '),'% ',substring-after($val,' '),'%' )"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:缩放">
+ <xsl:attribute name="style:text-scale"><xsl:value-of select="."/>%</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:字符间距">
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="."/>cm</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:调整字间距">
+ <xsl:variable name="tt" select="字:调整字间距"/>
+ <xsl:attribute name="style:letter-kerning"><xsl:choose><xsl:when test="$tt='1'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:外框">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:字符间距[parent::字:句属性]">
+ <xsl:variable name="aa">
+ <xsl:value-of select="."/>
+ </xsl:variable>
+ <xsl:attribute name="fo:letter-spacing"><xsl:value-of select="concat( $aa, $uofUnit)"/></xsl:attribute>
+ </xsl:template>
+ <xsl:template match="字:分节">
+ <xsl:if test="字:节属性/字:脚注设置">
+ <xsl:call-template name="脚注设置"/>
+ </xsl:if>
+ <xsl:if test="字:节属性/字:尾注设置">
+ <xsl:call-template name="尾注设置"/>
+ </xsl:if>
+ <xsl:if test="字:节属性/字:行号设置">
+ <xsl:call-template name="行编号"/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="行编号">
+ <xsl:element name="text:linenumbering-configuration">
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:行号设置">
+ <xsl:choose>
+ <xsl:when test="@字:使用行号='false'">
+ <xsl:attribute name="text:number-lines">false</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">Line numbering</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@字:编号方式">
+ <xsl:choose>
+ <xsl:when test="@字:编号方式='section'">
+ <xsl:attribute name="text:count-in-floating-frames">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@字:编号方式='page'">
+ <xsl:attribute name="text:restart-on-page">true</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="字:编号方式='continuous'">
+ <xsl:attribute name="text:count-empty-lines">true</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="@字:起始编号">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="@字:起始编号"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:距边界">
+ <xsl:attribute name="text:offset"><xsl:value-of select="concat(@字:距边界,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@字:行号间隔">
+ <xsl:attribute name="text:increment"><xsl:value-of select="@字:行号间隔"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="脚注设置">
+ <xsl:element name="text:notes-configuration">
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:脚注设置">
+ <xsl:attribute name="text:note-class">footnote</xsl:attribute>
+ <xsl:attribute name="text:master-page-name">Footnote</xsl:attribute>
+ <xsl:attribute name="text:footnotes-position"><xsl:choose><xsl:when test="@字:位置='page-bottom'">page</xsl:when><xsl:when test="@字:位置='below-text'">document</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="text:start-numbering-at"><xsl:choose><xsl:when test="@字:编号方式='continuous'">document</xsl:when><xsl:when test="@字:编号方式='section'">chapter</xsl:when><xsl:when test="@字:编号方式='page'">page</xsl:when></xsl:choose></xsl:attribute>
+ <xsl:attribute name="text:start-value"><xsl:value-of select="@字:起始编号 - 1"/></xsl:attribute>
+ <xsl:attribute name="style:num-format"><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="@字:格式"/></xsl:call-template></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="尾注设置">
+ <xsl:element name="text:notes-configuration">
+ <xsl:for-each select="/uof:UOF/uof:文字处理/字:主体/字:分节/字:节属性/字:尾注设置">
+ <xsl:attribute name="text:note-class">endnote</xsl:attribute>
+ <xsl:attribute name="text:master-page-name">Endnote</xsl:attribute>
+ <xsl:attribute name="style:num-format"><xsl:call-template name="oo数字格式"><xsl:with-param name="oo_format" select="@字:格式"/></xsl:call-template></xsl:attribute>
+ <xsl:attribute name="text:start-value"><xsl:value-of select="@字:起始编号 - 1"/></xsl:attribute>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="paragraph-properties">
+ <xsl:choose>
+ <xsl:when test="descendant::字:页边距[@uof:左]">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="number((descendant::字:页边距/@uof:左)) * $other-to-cm-conversion-factor"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="descendant::字:页边距[@uof:右]">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="number((descendant::字:页边距/@uof:右)) * $other-to-cm-conversion-factor"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:text-indent">0cm</xsl:attribute>
+ <xsl:call-template name="bidi"/>
+ </xsl:template>
+ <xsl:template name="bidi">
+ </xsl:template>
+ <xsl:template match="字:文字表">
+ <xsl:choose>
+ <xsl:when test="@字:类型 = 'sub-table'">
+ <xsl:element name="table:table">
+ <xsl:attribute name="table:is-sub-table">true</xsl:attribute>
+ <xsl:apply-templates select="字:文字表属性">
+ <xsl:with-param name="sub-table" select="@字:类型"/>
+ </xsl:apply-templates>
+ <xsl:if test="字:行[position()=1]/字:表行属性/字:表头行/@字:值='true'">
+ <xsl:element name="table:table-header-rows">
+ <xsl:for-each select="字:行">
+ <xsl:if test="字:表行属性/字:表头行/@字:值='true'">
+ <xsl:apply-templates select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="字:行[not(字:表行属性/字:表头行) or (字:表行属性/字:表头行/@字:值='false')]">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="table:table">
+ <xsl:if test="字:文字表属性">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(字:文字表属性/字:列宽集/字:列宽)">
+ <xsl:for-each select="字:行[1]/字:单元格">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number value="count(preceding::字:单元格)+1"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:apply-templates select="字:文字表属性"/>
+ <xsl:if test="字:行[position()=1]/字:表行属性/字:表头行/@字:值='true'">
+ <xsl:element name="table:table-header-rows">
+ <xsl:for-each select="字:行">
+ <xsl:if test="字:表行属性/字:表头行/@字:值='true'">
+ <xsl:apply-templates select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:for-each select="字:行[not(字:表行属性/字:表头行) or (字:表行属性/字:表头行/@字:值='false')]">
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:文字表属性">
+ <xsl:param name="sub-table"/>
+ <xsl:apply-templates select="字:列宽集">
+ <xsl:with-param name="sub-table" select="$sub-table"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="字:列宽集">
+ <xsl:param name="sub-table"/>
+ <xsl:apply-templates select="字:列宽">
+ <xsl:with-param name="sub-table" select="$sub-table"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="字:列宽">
+ <xsl:param name="sub-table"/>
+ <xsl:element name="table:table-column">
+ <xsl:choose>
+ <xsl:when test="$sub-table='sub-table'">
+ <xsl:variable name="subtable-leikuan" select="."/>
+ <xsl:variable name="weizi">
+ <xsl:for-each select="ancestor::*[name()='字:文字表' and not(@字:类型='sub-table')]/字:文字表属性/字:列宽集/字:列宽">
+ <xsl:variable name="yyyyy" select="."/>
+ <xsl:if test="substring(string($yyyyy),1,string-length(string($yyyyy))-1)=substring(string($subtable-leikuan),1,string-length(string($subtable-leikuan))-1)">
+ <xsl:value-of select="concat(position(),';')"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="xxxxx">
+ <xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="table:style-name"><xsl:value-of select="concat('Table',$xxxxx,'.C',substring-before($weizi,';'))"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.C<xsl:number count="字:列宽" from="/uof:UOF/uof:文字处理/字:主体" level="single" format="1"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:行">
+ <xsl:element name="table:table-row">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/></xsl:attribute>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="name()='字:单元格'">
+ <xsl:call-template name="字:单元格"/>
+ </xsl:when>
+ <xsl:when test="name()='字:单元格覆盖'">
+
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="字:单元格">
+ <xsl:element name="table:table-cell">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="字:文字表[not (@字:类型='sub-table')]" from="/uof:UOF/uof:文字处理/字:主体" level="any" format="1"/>.R<xsl:number count="字:行" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]" level="any" format="1"/>C<xsl:number count="字:单元格" from="/uof:UOF/uof:文字处理/字:主体/字:文字表[not (@字:类型='sub-table')]/字:行" level="any" format="1"/></xsl:attribute>
+ <xsl:if test="字:单元格属性">
+ <xsl:apply-templates select="字:单元格属性"/>
+ </xsl:if>
+ <xsl:for-each select="node( )">
+ <xsl:choose>
+ <xsl:when test="name( )='字:段落'">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="name( )='字:文字表'">
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:单元格属性/字:边框">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="字:对齐[parent::字:文字表属性]">
+
+ </xsl:template>
+ <xsl:template match="uof:上">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil' ">
+ <xsl:attribute name="fo:border-top">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-top"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:下">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil' ">
+ <xsl:attribute name="fo:border-bottom">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-bottom"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:左">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil'">
+ <xsl:attribute name="fo:border-left">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-left"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="uof:右">
+ <xsl:choose>
+ <xsl:when test="@uof:宽度='nil' ">
+ <xsl:attribute name="fo:border-right">none</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度 and @uof:颜色">
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/><xsl:text> </xsl:text><xsl:choose><xsl:when test="@uof:颜色 ='auto'"><xsl:text>solid #000000</xsl:text></xsl:when><xsl:otherwise><xsl:text>solid </xsl:text><xsl:value-of select="@uof:颜色"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@uof:宽度">
+ <xsl:attribute name="fo:border-right"><xsl:value-of select="concat(number(@uof:宽度),$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:文字表属性/字:边框">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="字:单元格属性/字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:template>
+ <xsl:template match="字:左缩进">
+ </xsl:template>
+ <xsl:template match="字:单元格属性">
+ <xsl:if test="字:跨列/@字:值">
+ <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="字:跨列/@字:值"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="编号风格">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="concat('P',@字:标识符)"/></xsl:attribute>
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">Standard</xsl:attribute>
+ <xsl:attribute name="style:list-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:attribute name="fo:margin-left">0cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-right">0cm</xsl:attribute>
+ <xsl:attribute name="fo:color"><xsl:value-of select="字:级别/字:符号字体/字:字体/字:颜色"/></xsl:attribute>
+ <xsl:attribute name="fo:text-indent"/>
+ <xsl:attribute name="style:auto-text-indent">false</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="编号格式">
+ <xsl:attribute name="style:num-format"><xsl:choose><xsl:when test="string(字:编号格式)='lower-letter'">a</xsl:when><xsl:when test="string(字:编号格式)='upper-letter'">A</xsl:when><xsl:when test="string(字:编号格式)='lower-roman'">i</xsl:when><xsl:when test="string(字:编号格式)='upper-roman'">I</xsl:when><xsl:when test="string(字:编号格式)='decimal-enclosed-circle'">①, ②, ③, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-traditional'">甲, 乙, 丙, ...</xsl:when><xsl:when test="string(字:编号格式)='ideograph-zodiac'">子, 丑, 寅, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-counting'">一, 二, 三, ...</xsl:when><xsl:when test="string(字:编号格式)='chinese-legal-simplified'">壹, 贰, 叁, ...</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:template>
+ <xsl:template name="图形style">
+ <xsl:for-each select="/uof:UOF/uof:对象集/图:图形">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name"><xsl:value-of select="@图:标识符"/></xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">Graphics</xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:attribute name="svg:stroke-width"><xsl:value-of select="图:预定义图形/图:属性/图:线粗细"/></xsl:attribute>
+ <xsl:attribute name="svg:stroke-color"><xsl:value-of select="图:预定义图形/图:属性/图:线颜色"/></xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash"><xsl:value-of select="图:预定义图形/图:属性/图:线型"/></xsl:attribute>
+ <xsl:attribute name="draw:marker-start"><xsl:value-of select="图:预定义图形/图:属性/图:前端箭头/图:式样"/></xsl:attribute>
+ <xsl:attribute name="draw:marker-end"><xsl:value-of select="图:预定义图形/图:属性/图:后端箭头/图:式样"/></xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="duanluoshuxing">
+ <xsl:for-each select="/uof:UOF/uof:文字处理//字:段落">
+ <xsl:choose>
+ <xsl:when test="count(字:句)&lt;=1">
+ <xsl:call-template name="单个或者没有句"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="多个句"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="单个或者没有句">
+ <xsl:variable name="stylename" select="字:段落属性/@字:式样引用"/>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">P<xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落"/></xsl:attribute>
+ <xsl:attribute name="style:family">paragraph</xsl:attribute>
+ <xsl:if test="name(preceding-sibling::*[1])='字:分节'">
+ <xsl:attribute name="style:master-page-name"><xsl:value-of select="preceding-sibling::字:分节[1]/@字:名称"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/@字:式样引用">
+ <xsl:variable name="duanluoyinyong">
+ <xsl:value-of select="字:段落属性/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF//uof:段落式样">
+ <xsl:if test="$duanluoyinyong=@字:标识符">
+ <xsl:if test="@字:基式样引用">
+ <xsl:choose>
+ <xsl:when test="@字:标识符=/uof:UOF/uof:文字处理/字:主体/字:段落/字:段落属性/字:格式修订/@字:修订信息引用">
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:标识符"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name"><xsl:value-of select="@字:基式样引用"/></xsl:attribute>
+ <xsl:variable name="aa">
+ <xsl:value-of select="@字:基式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF//uof:段落式样">
+ <xsl:if test="$aa=@字:标识符">
+ <xsl:attribute name="style:display-name"><xsl:choose><xsl:when test="@字:别名"><xsl:value-of select="@字:别名"/></xsl:when><xsl:otherwise><xsl:value-of select="@字:名称"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:if test="字:对齐">
+ <xsl:if test="字:对齐/@字:文字对齐">
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:对齐/@字:文字对齐='base'">baseline</xsl:when><xsl:when test="字:对齐/@字:文字对齐='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="字:对齐/@字:文字对齐"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:对齐/@字:水平对齐">
+ <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="字:对齐/@字:水平对齐='left'">start</xsl:when><xsl:when test="字:对齐/@字:水平对齐='right'">end</xsl:when><xsl:when test="字:对齐/@字:水平对齐='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="字:对齐/@字:水平对齐='distributed'">
+ <xsl:attribute name="fo:text-align-last">justify</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:call-template name="ParagraphAttr"/>
+ <xsl:if test="字:段落属性/字:制表位设置">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ </xsl:element>
+ <xsl:if test="字:句属性">
+ <xsl:variable name="bsh">
+ <xsl:value-of select="字:句属性/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:element name="style:text-properties">
+ <xsl:for-each select="/uof:UOF//uof:句式样">
+ <xsl:if test="$bsh=@字:标识符">
+ <xsl:apply-templates select="./*"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="字:句/字:句属性/字:字体">
+ <xsl:variable name="ziti">
+ <xsl:value-of select="字:句/字:句属性/字:字体/@字:中文字体引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:字体集/uof:字体声明">
+ <xsl:if test="@uof:标识符=$ziti">
+ <xsl:attribute name="style:font-name"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="@uof:名称"/></xsl:attribute>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:if test="字:句/字:句属性/字:字体/@字:字号">
+ <xsl:attribute name="fo:font-size"><xsl:value-of select="字:句/字:句属性/字:字体/@字:字号"/></xsl:attribute>
+ <xsl:attribute name="style:font-size-asian"><xsl:value-of select="字:句/字:句属性/字:字体/@字:字号"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:句属性">
+ <xsl:for-each select="字:段落属性/字:句属性">
+ <xsl:apply-templates select="./*"/>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:apply-templates select="字:句/字:句属性/字:浮雕 | 字:句/字:句属性/字:边框 | 字:句/字:句属性/字:缩放 | 字:句/字:句属性/字:阴影 | 字:句/字:句属性/字:删除线 | 字:句/字:句属性/字:下划线 | 字:句/字:填充"/>
+ <xsl:call-template name="ParagraphAttr"/>
+ <xsl:if test="字:段落属性/字:制表位设置">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样[@字:标识符=$stylename]">
+ <xsl:apply-templates select="./*"/>
+ </xsl:for-each>
+ </xsl:element>
+ <style:paragraph-properties>
+ <xsl:if test="字:句/字:分栏符">
+ <xsl:attribute name="fo:break-before">column</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:句/字:分页符">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="ParagraphAttr"/>
+ <xsl:if test="字:段落属性/字:制表位设置">
+ <xsl:call-template name="ootab"/>
+ </xsl:if>
+ </style:paragraph-properties>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ParagraphAttr">
+ <xsl:apply-templates select="字:段落属性/字:填充"/>
+ <xsl:if test="字:段落属性/字:对齐">
+ <xsl:if test="字:段落属性/字:对齐/@字:文字对齐">
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:段落属性/字:对齐/@字:文字对齐='base'">baseline</xsl:when><xsl:when test="字:段落属性/字:对齐/@字:文字对齐='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="字:段落属性/字:对齐/@字:文字对齐"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:对齐/@字:水平对齐">
+ <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="字:段落属性/字:对齐/@字:水平对齐='left'">start</xsl:when><xsl:when test="字:段落属性/字:对齐/@字:水平对齐='right'">end</xsl:when><xsl:when test="字:段落属性/字:对齐/@字:水平对齐='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="字:段落属性/字:对齐/@字:水平对齐='distributed'">
+ <xsl:attribute name="fo:text-align-last">justify</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="字:段落属性/字:缩进">
+ <xsl:variable name="a1">
+ <xsl:value-of select="字:段落属性/字:缩进/字:左/字:相对/@字:值"/>
+ </xsl:variable>
+ <xsl:variable name="a2">
+ <xsl:value-of select="字:段落属性/字:缩进/字:右/字:相对/@字:值"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="字:段落属性/字:缩进/字:左/字:相对 or 字:段落属性/字:缩进/字:右/字:相对">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat($a1 * 0.37,'cm')"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat($a2 * 0.37,'cm')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:段落属性/字:缩进/字:左/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:段落属性/字:缩进/字:右/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(字:段落属性/字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进/字:左/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进/字:右/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(ancestor::uof:UOF/uof:式样集/uof:自动编号集/字:自动编号/字:级别[following-sibling::字:级别[position()=1]/@字:级别值='1']/字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="字:段落属性/字:行距">
+ <xsl:variable name="type">
+ <xsl:value-of select="字:段落属性/字:行距/@字:类型"/>
+ </xsl:variable>
+ <xsl:variable name="val">
+ <xsl:value-of select="字:段落属性/字:行距/@字:值"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$type='fixed'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='multi-lines'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val * 100,'%')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='at-least'">
+ <xsl:attribute name="style:line-height-at-least"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='line-space'">
+ <xsl:attribute name="style:line-spacing"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:段间距">
+ <xsl:if test="字:段落属性/字:段间距/字:段前距/字:绝对值/@字:值">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:段落属性/字:段间距/字:段前距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:段间距/字:段后距/字:绝对值/@字:值">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:段落属性/字:段间距/字:段后距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="aa">
+ <xsl:value-of select="字:段落属性/字:段间距/字:段前距/字:相对值/@字:值"/>
+ </xsl:variable>
+ <xsl:variable name="bb">
+ <xsl:value-of select="字:段落属性/字:段间距/字:段后距/字:相对值/@字:值"/>
+ </xsl:variable>
+ <xsl:if test="字:段落属性/字:段间距/字:段前距/字:相对值/@字:值">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat($aa * 15.6,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:段间距/字:段后距/字:相对值/@字:值">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat($bb * 15.6,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:孤行控制">
+ <xsl:attribute name="fo:widows"><xsl:value-of select="字:段落属性/字:孤行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:寡行控制">
+ <xsl:attribute name="fo:orphans"><xsl:value-of select="字:段落属性/字:寡行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:段中不分页">
+ <xsl:attribute name="fo:keep-together"><xsl:choose><xsl:when test="字:段落属性/字:段中不分页/@字:值='1' or 字:段落属性/字:段中不分页/@字:值='true'">always</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:与下段同页">
+ <xsl:attribute name="fo:keep-with-next"><xsl:choose><xsl:when test="字:段落属性/字:与下段同页/@字:值='1' or 字:段落属性/字:与下段同页/@字:值='true'">always</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="字:段落属性/字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ <xsl:for-each select="字:段落属性/字:填充">
+ <xsl:call-template name="uof:填充"/>
+ </xsl:for-each>
+ <xsl:if test="字:段落属性/字:对齐网格">
+ <xsl:attribute name="style:snap-to-layout-grid"><xsl:choose><xsl:when test="字:段落属性/字:对齐网格/@字:值='1' or 字:段落属性/字:对齐网格/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:取消断字">
+ <xsl:attribute name="fo:hyphenation-ladder-count">no-limit</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-remain-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-push-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenate"><xsl:choose><xsl:when test="字:段落属性/字:取消断字/@字:值='1' or 字:段落属性/字:取消断字/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:取消行号">
+ <xsl:attribute name="text:number-lines"><xsl:choose><xsl:when test="字:段落属性/字:取消行号/@字:值='1' or 字:段落属性/字:取消行号/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:行首尾标点控制">
+ <xsl:attribute name="style:punctuation-wrap"><xsl:choose><xsl:when test="字:段落属性/字:行首尾标点控制/@字:值='1' or 字:段落属性/字:行首尾标点控制/@字:值='true'">hanging</xsl:when><xsl:otherwise>simple</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:是否行首标点压缩/@字:值='true'">
+ <xsl:attribute name="style:punctuation-compress">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:中文习惯首尾字符">
+ <xsl:attribute name="style:line-break"><xsl:choose><xsl:when test="字:段落属性/字:中文习惯首尾字符/@字:值='1' or 字:段落属性/字:中文习惯首尾字符/@字:值='true'">strict</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:自动调整中英文字符间距 or 字:段落属性/字:自动调整中文与数字间距">
+ <xsl:attribute name="style:text-autospace"><xsl:choose><xsl:when test="字:段落属性/字:自动调整中英文字符间距/@字:值='1' or 字:段落属性/字:自动调整中文与数字间距/@字:值='1'or 字:段落属性/字:自动调整中英文字符间距/@字:值='true' or 字:段落属性/字:自动调整中文与数字间距/@字:值='true'">ideograph-alpha</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:首字下沉">
+ <xsl:element name="style:drop-cap">
+ <xsl:if test="字:段落属性/字:首字下沉/@字:行数">
+ <xsl:attribute name="style:lines"><xsl:value-of select="字:段落属性/字:首字下沉/@字:行数"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:首字下沉/@字:间距">
+ <xsl:attribute name="style:distance"><xsl:value-of select="concat(字:段落属性/字:首字下沉/@字:间距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:首字下沉/@字:字体引用">
+ <xsl:attribute name="style:style-name"><xsl:value-of select="translate(字:段落属性/字:首字下沉/@字:字体引用,'_',' ')"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段落属性/字:首字下沉/@字:字符数">
+ <xsl:attribute name="style:length"><xsl:choose><xsl:when test="字:段落属性/字:首字下沉/@字:字符数='1'">word</xsl:when><xsl:otherwise><xsl:value-of select="字:段落属性/字:首字下沉/@字:字符数"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="XDParagraphAttr">
+ <xsl:apply-templates select="字:填充"/>
+ <xsl:if test="字:对齐">
+ <xsl:if test="字:对齐/@字:文字对齐">
+ <xsl:attribute name="style:vertical-align"><xsl:choose><xsl:when test="字:对齐/@字:文字对齐='base'">baseline</xsl:when><xsl:when test="字:对齐/@字:文字对齐='center'">middle</xsl:when><xsl:otherwise><xsl:value-of select="字:对齐/@字:文字对齐"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:对齐/@字:水平对齐">
+ <xsl:attribute name="fo:text-align"><xsl:choose><xsl:when test="字:对齐/@字:水平对齐='left'">start</xsl:when><xsl:when test="字:对齐/@字:水平对齐='right'">end</xsl:when><xsl:when test="字:对齐/@字:水平对齐='center'">center</xsl:when><xsl:otherwise>justify</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="字:对齐/@字:水平对齐='distributed'">
+ <xsl:attribute name="fo:text-align-last">justify</xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="字:缩进">
+ <xsl:if test="字:缩进/字:左/字:绝对/@字:值">
+ <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat(字:缩进/字:左/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:缩进/字:右/字:绝对/@字:值">
+ <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat(字:缩进/字:右/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:缩进/字:首行/字:绝对/@字:值">
+ <xsl:attribute name="fo:text-indent"><xsl:value-of select="concat(字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="字:行距">
+ <xsl:variable name="type">
+ <xsl:value-of select="字:行距/@字:类型"/>
+ </xsl:variable>
+ <xsl:variable name="val">
+ <xsl:value-of select="字:行距/@字:值"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$type='fixed'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='multi-lines'">
+ <xsl:attribute name="fo:line-height"><xsl:value-of select="concat($val * 100,'%')"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='at-least'">
+ <xsl:attribute name="style:line-height-at-least"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$type='line-space'">
+ <xsl:attribute name="style:line-spacing"><xsl:value-of select="concat($val,$uofUnit)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="字:段间距">
+ <xsl:if test="字:段间距/字:段前距/字:绝对值/@字:值">
+ <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat(字:段间距/字:段前距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段间距/字:段后距/字:绝对值/@字:值">
+ <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat(字:段间距/字:段后距/字:绝对值/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="字:孤行控制">
+ <xsl:attribute name="fo:orphans"><xsl:value-of select="字:孤行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:寡行控制">
+ <xsl:attribute name="fo:widows"><xsl:value-of select="字:寡行控制"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:段中不分页">
+ <xsl:attribute name="fo:keep-together"><xsl:choose><xsl:when test="字:段中不分页/@字:值='1' or 字:段中不分页/@字:值='true'">always</xsl:when><xsl:otherwise>auto</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:与下段同页">
+ <xsl:attribute name="fo:keep-with-next"><xsl:choose><xsl:when test="字:与下段同页/@字:值='1' or 字:与下段同页/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="字:边框">
+ <xsl:call-template name="uof:边框"/>
+ </xsl:for-each>
+ <xsl:for-each select="字:填充">
+ <xsl:call-template name="uof:填充"/>
+ </xsl:for-each>
+ <xsl:if test="字:对齐网格">
+ <xsl:attribute name="style:snap-to-layout-grid"><xsl:choose><xsl:when test="字:对齐网格/@字:值='1' or 字:对齐网格/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:取消断字">
+ <xsl:attribute name="fo:hyphenation-ladder-count">no-limit</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-remain-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenation-push-char-count">2</xsl:attribute>
+ <xsl:attribute name="fo:hyphenate"><xsl:choose><xsl:when test="字:取消断字/@字:值='1' or 字:取消断字/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:取消行号">
+ <xsl:attribute name="text:number-lines"><xsl:choose><xsl:when test="字:取消行号/@字:值='1' or 字:取消行号/@字:值='true'">true</xsl:when><xsl:otherwise>false</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:行首尾标点控制">
+ <xsl:attribute name="style:punctuation-wrap"><xsl:choose><xsl:when test="字:行首尾标点控制/@字:值='1' or 字:行首尾标点控制/@字:值='true'">hanging</xsl:when><xsl:otherwise>simple</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:是否行首标点压缩/@字:值='true'">
+ <xsl:attribute name="style:punctuation-compress">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:中文习惯首尾字符">
+ <xsl:attribute name="style:line-break"><xsl:choose><xsl:when test="字:中文习惯首尾字符/@字:值='1' or 字:中文习惯首尾字符/@字:值='true'">strict</xsl:when><xsl:otherwise>normal</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:自动调整中英文字符间距 or 字:自动调整中文与数字间距">
+ <xsl:attribute name="style:text-autospace"><xsl:choose><xsl:when test="字:自动调整中英文字符间距/@字:值='1' or 字:自动调整中文与数字间距/@字:值='1'or 字:自动调整中英文字符间距/@字:值='true' or 字:自动调整中文与数字间距/@字:值='true'">ideograph-alpha</xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:首字下沉">
+ <xsl:element name="style:drop-cap">
+ <xsl:if test="字:首字下沉/@字:行数">
+ <xsl:attribute name="style:lines"><xsl:value-of select="字:首字下沉/@字:行数"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:首字下沉/@字:间距">
+ <xsl:attribute name="style:distance"><xsl:value-of select="concat(字:首字下沉/@字:间距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:首字下沉/@字:字体引用">
+ <xsl:attribute name="style:style-name"><xsl:value-of select="字:首字下沉/@字:字体引用"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:首字下沉/@字:字符数">
+ <xsl:attribute name="style:length"><xsl:choose><xsl:when test="字:首字下沉/@字:字符数='1'">word</xsl:when><xsl:otherwise><xsl:value-of select="字:首字下沉/@字:字符数"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="多个句">
+ <xsl:call-template name="单个或者没有句"/>
+ </xsl:template>
+ <xsl:template name="jibianhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:element name="text:list-level-style-number">
+ <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/>
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute>
+ <xsl:if test="@字:尾随字符">
+ <xsl:attribute name="style:num-suffix"><xsl:choose><xsl:when test="@字:尾随字符='space'"><xsl:value-of select="' ' "/></xsl:when><xsl:when test="@字:尾随字符='tab'"><xsl:value-of select="' '"/></xsl:when><xsl:otherwise>none</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:符号字体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="字:符号字体/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="$Font-ID"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:起始编号">
+ <xsl:attribute name="text:start-value"><xsl:value-of select="字:起始编号"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:正规格式">
+ <xsl:attribute name="text:num-regular-exp"><xsl:value-of select="字:正规格式/@值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(字:编号格式表示) - string-length(translate(字:编号格式表示,'%','') )"/></xsl:attribute>
+ <xsl:if test="字:编号格式">
+ <xsl:call-template name="编号格式"/>
+ </xsl:if>
+ <xsl:if test="字:编号格式表示">
+ <xsl:variable name="last" select="substring-after(字:编号格式表示,concat('%',$currlevel))"/>
+ <xsl:variable name="first">
+ <xsl:variable name="aa" select="substring-before(字:编号格式表示,concat('%',$currlevel))"/>
+ <xsl:choose>
+ <xsl:when test="not(substring-after($aa,'%'))">
+ <xsl:value-of select="$aa"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$first!=''">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$first"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$last!=''">
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="$last"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="bianhaogeshi">
+ <xsl:with-param name="biaoshi">
+ <xsl:value-of select="字:编号格式表示"/>
+ </xsl:with-param>
+ <xsl:with-param name="jibie">
+ <xsl:value-of select="1"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@字:编号对齐方式">
+ <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@字:编号对齐方式"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="字:符号字体">
+ <xsl:if test="字:符号字体/@字:式样引用">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="字:符号字体/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="bianhaogeshi">
+ <xsl:param name="biaoshi"/>
+ <xsl:param name="jibie"/>
+ <xsl:variable name="bb">
+ <xsl:value-of select="substring-after($biaoshi,'%')"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="substring-after($bb,'%')">
+ <xsl:call-template name="bianhaogeshi">
+ <xsl:with-param name="biaoshi" select="$bb"/>
+ <xsl:with-param name="jibie" select="$jibie +1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="not($jibie=1)">
+ <xsl:attribute name="text:display-levels"><xsl:value-of select="$jibie"/></xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="xiangmufuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/>
+ <xsl:element name="text:list-level-style-bullet">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="../@字:名称"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute>
+ <xsl:attribute name="text:bullet-char"><xsl:value-of select="字:项目符号"/></xsl:attribute>
+ <xsl:element name="style:text-properties">
+ <xsl:if test="字:符号字体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="字:符号字体/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="字:项目符号">
+ <xsl:attribute name="fo:font-family"><xsl:value-of select="'WingDings'"/></xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@字:编号对齐方式">
+ <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@字:编号对齐方式"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="imagefuhao">
+ <xsl:param name="biaoshifu"/>
+ <xsl:variable name="currlevel" select="number(@字:级别值) + 1"/>
+ <xsl:element name="text:list-level-style-image" style:vertical-pos="middle" style:vertical-rel="line" fo:width="0.265cm" fo:height="0.265cm">
+ <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat( $biaoshifu,$currlevel)"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(字:编号格式表示,'%1')"/></xsl:attribute>
+ <xsl:if test="字:图片符号引用">
+ <xsl:variable name="gid">
+ <xsl:value-of select="字:图片符号引用"/>
+ </xsl:variable>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据"/>
+ </xsl:element>
+ </xsl:if>
+ <xsl:element name="style:list-level-properties">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+ <xsl:attribute name="fo:width"><xsl:value-of select="concat(字:图片符号引用/@字:宽度,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="fo:height"><xsl:value-of select="concat(字:图片符号引用/@字:高度,$uofUnit)"/></xsl:attribute>
+ <xsl:if test="字:符号字体">
+ <xsl:variable name="Font-ID">
+ <xsl:value-of select="字:符号字体/@字:式样引用"/>
+ </xsl:variable>
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:句式样">
+ <xsl:if test="@字:标识符=$Font-ID">
+ <xsl:if test="字:字体/@字:中文字体引用">
+ <xsl:attribute name="svg:font-family"><xsl:value-of select="字:字体/@字:中文字体引用"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:call-template name="suojinleixing"/>
+ <xsl:if test="@字:编号对齐方式">
+ <xsl:attribute name="fo:text-align"><xsl:variable name="aa"><xsl:value-of select="@字:编号对齐方式"/></xsl:variable><xsl:choose><xsl:when test="$aa='center' ">center</xsl:when><xsl:when test="$aa='right' ">end</xsl:when><xsl:otherwise>left</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ootab">
+ <xsl:element name="style:tab-stops">
+ <xsl:for-each select="字:段落属性/字:制表位设置/字:制表位 | 字:制表位设置/字:制表位">
+ <xsl:element name="style:tab-stop">
+ <xsl:attribute name="style:position"><xsl:value-of select="concat(@字:位置,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="style:type"><xsl:choose><xsl:when test="@字:类型='decimal'">char</xsl:when><xsl:when test="@字:类型='left' or @字:类型='right' or @字:类型='center'"><xsl:value-of select="@字:类型"/></xsl:when><xsl:otherwise/></xsl:choose></xsl:attribute>
+ <xsl:if test="@字:制表位字符">
+ <xsl:attribute name="style:leader-text"><xsl:value-of select="@字:制表位字符"/></xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:leader-style"><xsl:value-of select="@字:前导符"/></xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="字:段落[字:段落属性[字:自动编号信息]]">
+ <xsl:call-template name="编号解析">
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="编号解析">
+ <xsl:variable name="bianhao">
+ <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号引用"/>
+ </xsl:variable>
+ <xsl:variable name="bianhaojibie">
+ <xsl:value-of select="字:段落属性/字:自动编号信息/@字:编号级别"/>
+ </xsl:variable>
+ <xsl:variable name="isxiangmuorisimage">
+ <xsl:for-each select="/uof:UOF/uof:式样集/uof:自动编号集/字:自动编号">
+ <xsl:choose>
+ <xsl:when test="$bianhao=@字:标识符">
+ <xsl:choose>
+ <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:项目符号">true</xsl:when>
+ <xsl:when test="字:级别[@字:级别值= (number($bianhaojibie))]/字:图片符号引用">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$isxiangmuorisimage='true'">
+ <xsl:call-template name="无序"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="有序"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="有序">
+ <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/>
+ <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别 + 1"/>
+ <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute>
+ <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="字:段落属性/字:自动编号信息/@字:重新编号='false'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:if test="字:段落属性/字:自动编号信息/@字:重新编号">
+ <xsl:attribute name="text:continue-numbering"><xsl:choose><xsl:when test="字:段落属性/字:自动编号信息/@字:重新编号='1'">false</xsl:when><xsl:otherwise>true</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="ordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="ordered-levels">
+ <xsl:with-param name="level" select="$level - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="无序">
+ <xsl:variable name="currlistid" select="字:段落属性/字:自动编号信息/@字:编号引用"/>
+ <xsl:variable name="currlistlvl" select="字:段落属性/字:自动编号信息/@字:编号级别 + 1"/>
+ <xsl:variable name="firstoccur" select="/descendant::字:段落属性[字:自动编号信息/@字:编号引用 = $currlistid][1]"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">List<xsl:value-of select="count($firstoccur/preceding::字:自动编号信息)"/></xsl:attribute>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$currlistlvl - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="unordered-levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="commonParagraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="unordered-levels">
+ <xsl:with-param name="level" select="$level - 1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- measure_conversion.xsl Begin-->
+ <xsl:param name="dpi" select="111"/>
+ <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-in-mm" select="4.2333333"/>
+ <xsl:param name="point-in-mm" select="0.3527778"/>
+ <xsl:param name="twip-in-mm" select="0.017636684"/>
+ <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+ <!-- ***** MEASUREMENT CONVERSIONS *****
+ PARAM 'value'
+ The measure to be converted.
+ The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+ directly added to the number.
+
+ PARAM 'rounding-factor'
+ Is used for the rounding of decimal places.
+ The parameter number is the product of 1 and some '10', where
+ every zero represents a decimal place.
+
+ For example, providing as parameter:
+ <xsl:param name="rounding-factor" select="10000" />
+ Gives by default four decimal places.
+
+ To round two decimal places, basically the following is done:
+ <xsl:value-of select="round(100 * value) div 100"/>
+
+ RETURN The converted number, by default rounded to four decimal places.
+ In case the input measure could not be matched the same value is
+ returned and a warning message is written out.
+
+
+
+ MEASURE LIST:
+ * 1 milimeter (mm), the basic measure
+
+ * 1 centimeter (cm) = 10 mm
+
+ * 1 inch (in) = 25.4 mm
+ While the English have already seen the light (read: the metric system), the US
+ remains loyal to this medieval system.
+
+ * 1 point (pt) = 0.35277777.. mm
+ Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+ There are exactly 72 PostScript points in 1 inch.
+
+ * 1 twip = twentieth of a (PostScript) point
+ A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+ * 1 didot point (dpt) = 0.376065 mm
+ Didot point after the French typographer Firmin Didot (1764-1836).
+
+ More details under
+ http://www.unc.edu/~rowlett/units/dictP.html:
+ "A unit of length used by typographers and printers. When printing was done
+ from hand-set metal type, one point represented the smallest element of type
+ that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+ in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+ about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+ traditionally used a slightly larger point of 0.014 83 inch (about
+ 1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+ after the French typographer Firmin Didot (1764-1836). In the U.S.,
+ Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+ or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+ of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+ all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+ * 1 pica = 4.233333 mm
+ 1/6 inch or 12 points
+
+ * 1 pixel (px) = 0.26458333.. mm (relative to 'DPI', here: 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="convert2cm">
+ <xsl:param name="value"/>
+ <xsl:param name="rounding-factor" select="10000"/>
+ <xsl:choose>
+ <xsl:when test="contains($value, 'mm')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, $uofUnit)">
+ <xsl:value-of select="substring-before($value, $uofUnit)"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'in')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'dpt')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'pica')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'twip')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:when test="contains($value, 'px')">
+ <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:通用边框">
+ <xsl:param name="lineType"/>
+ <xsl:param name="width"/>
+ <xsl:param name="color"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='none'">none</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$width"/>
+ <xsl:choose>
+ <xsl:when test="$lineType='single'">solid </xsl:when>
+ <xsl:when test="$lineType='double'">double </xsl:when>
+ <xsl:otherwise>solid </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$color='auto' or $color='none' or $color=''">#808080</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$color"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="uof:边框">
+ <xsl:if test="uof:上">
+ <xsl:variable name="type" select="uof:上/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:上/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:上/@uof:颜色"/>
+ <xsl:attribute name="fo:border-top"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:上/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-top"><xsl:value-of select="uof:上/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:下">
+ <xsl:variable name="type" select="uof:下/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:下/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:下/@uof:颜色"/>
+ <xsl:attribute name="fo:border-bottom"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:下/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-bottom"><xsl:value-of select="uof:下/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:左">
+ <xsl:variable name="type" select="uof:左/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:左/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:左/@uof:颜色"/>
+ <xsl:attribute name="fo:border-left"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:左/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-left"><xsl:value-of select="uof:左/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:右">
+ <xsl:variable name="type" select="uof:右/@uof:类型"/>
+ <xsl:variable name="size" select="concat(uof:右/@uof:宽度,$uofUnit,' ')"/>
+ <xsl:variable name="clr" select="uof:右/@uof:颜色"/>
+ <xsl:attribute name="fo:border-right"><xsl:call-template name="uof:通用边框"><xsl:with-param name="lineType" select="$type"/><xsl:with-param name="width" select="$size"/><xsl:with-param name="color" select="$clr"/></xsl:call-template></xsl:attribute>
+ <xsl:if test="uof:右/@uof:线宽度">
+ <xsl:attribute name="style:border-line-width-right"><xsl:value-of select="uof:右/@uof:线宽度"/></xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:上/@uof:阴影='true'or uof:上/@uof:阴影='1'">
+ <xsl:if test="uof:左/@uof:阴影='true'or uof:左/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm -0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:上/@uof:阴影='true'or uof:上/@uof:阴影='1'">
+ <xsl:if test="uof:右/@uof:阴影='true'or uof:右/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 0.18cm -0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:下/@uof:阴影='true'or uof:下/@uof:阴影='1'">
+ <xsl:if test="uof:左/@uof:阴影='true'or uof:左/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 -0.18cm 0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:下/@uof:阴影='true'or uof:下/@uof:阴影='1'">
+ <xsl:if test="uof:右/@uof:阴影='true'or uof:右/@uof:阴影='1'">
+ <xsl:attribute name="style:shadow">#808080 0.18cm 0.18cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="uof:上/@uof:边距">
+ <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat(uof:上/@uof:边距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="uof:下/@uof:边距">
+ <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat(uof:下/@uof:边距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="uof:左/@uof:边距">
+ <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat(uof:左/@uof:边距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="uof:右/@uof:边距">
+ <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat(uof:右/@uof:边距,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="uof:填充">
+ <xsl:choose>
+ <xsl:when test="图:颜色">
+ <xsl:attribute name="fo:background-color"><xsl:choose><xsl:when test="图:颜色"><xsl:value-of select="图:颜色"/></xsl:when><xsl:otherwise>transparent</xsl:otherwise></xsl:choose></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(图:图案/@图:前景色,'#')">
+ <xsl:attribute name="fo:text-background-color"><xsl:value-of select="图:图案/@图:前景色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="图:图案/@图:背景色">
+ <xsl:attribute name="fo:background-color"><xsl:value-of select="图:图案/@图:背景色"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ <xsl:if test="图:图片">
+ <xsl:element name="style:background-image">
+ <xsl:variable name="gid">
+ <xsl:value-of select="图:图片/@图:图形引用"/>
+ </xsl:variable>
+ <xsl:if test="图:图片/@图:位置 and not(图:图片/@图:位置='tile')">
+ <xsl:attribute name="style:repeat"><xsl:choose><xsl:when test="图:图片/@图:位置='stretch'">stretch</xsl:when><xsl:when test="图:图片/@图:位置='center'">no-repeat</xsl:when></xsl:choose></xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据">
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:数据"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="xlink:href"><xsl:value-of select="/uof:UOF/uof:对象集/uof:其他对象[@uof:标识符=$gid]/uof:路径"/></xsl:attribute>
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:attribute name="xlink:actuate">onLoad</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="日期域">
+ <xsl:if test="following-sibling::字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/>
+ <xsl:variable name="datestr">
+ <xsl:choose>
+ <xsl:when test="contains($date0,'\*')">
+ <xsl:value-of select="string(substring-before($date0,'\*'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$date0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="zydate">
+ <xsl:param name="str1"/>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,5)='am/pm'">
+ <xsl:variable name="str1-before" select="substring($str1,1,5)"/>
+ <xsl:variable name="str1-after" select="substring($str1,6)"/>
+ <number:am-pm/>
+ <xsl:if test="not($str1-after)=''">
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,4)='yyyy'">
+ <xsl:variable name="str1-before" select="substring($str1,1,4)"/>
+ <xsl:variable name="str1-after" select="substring($str1,5)"/>
+ <number:year number:style="long"/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,1)=substring($str1,2,1) and substring($str1,2,1) !=substring($str1,3,1) ">
+ <xsl:variable name="str1-before" select="substring($str1,1,2)"/>
+ <xsl:variable name="str1-after" select="substring($str1,3)"/>
+ <xsl:if test="substring($str1,1,1)='y'">
+ <number:year/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='M'">
+ <number:month number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='d'">
+ <number:day number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='h'">
+ <number:hours number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='m'">
+ <number:minutes number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='s'">
+ <number:seconds number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='W'">
+ <number:week-of-year number:style="long"/>
+ </xsl:if>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="substring($str1,1,1)='M'or substring($str1,1,1)='d'or substring($str1,1,1)='h'or substring($str1,1,1)='m'or substring($str1,1,1)='s'">
+ <xsl:variable name="str1-after" select="substring($str1,2)"/>
+ <xsl:variable name="str1-before" select="substring($str1,1,1)"/>
+ <xsl:if test="substring($str1,1,1)='M'">
+ <number:month/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='d'">
+ <number:day/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='h'">
+ <number:hours/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='m'">
+ <number:minutes/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='s'">
+ <number:seconds/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring($str1,1,3),'Q' )">
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,1)='Q'">
+ <xsl:variable name="str1-before" select="substring($str1,1,2)"/>
+ <xsl:variable name="str1-after" select="substring($str1,3)"/>
+ <number:quarter/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="str1-before" select="substring($str1,1,5)"/>
+ <xsl:variable name="str1-after" select="substring($str1,6)"/>
+ <number:quarter number:style="long"/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="contains(substring(normalize-space($str1),1,3),'W' )">
+ <xsl:variable name="str1-before" select="substring(normalize-space($str1),1,3)"/>
+ <xsl:variable name="str1-after" select="substring(normalize-space($str1),4)"/>
+ <number:day-of-week number:style="long"/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(substring($str1,1,3),'NN' ) and substring($str1,1,1)!='NN' ">
+ <xsl:variable name="str1-before" select="substring($str1,1,3)"/>
+ <xsl:variable name="str1-after" select="substring($str1,4)"/>
+ <number:text>第</number:text>
+ <number:week-of-year/>
+ <number:text>周</number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zydate">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="时间域">
+ <xsl:if test="following-sibling::字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/>
+ <xsl:variable name="datestr" select="$date0"/>
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="zytime">
+ <xsl:param name="str1"/>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,5)='am/pm'">
+ <xsl:variable name="str1-before" select="substring($str1,1,5)"/>
+ <xsl:variable name="str1-after" select="substring($str1,6)"/>
+ <number:am-pm/>
+ <xsl:if test="not($str1-after)=''">
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="substring($str1,1,1)=substring($str1,2,1) and substring($str1,2,1) !=substring($str1,3,1) ">
+ <xsl:variable name="str1-before" select="substring($str1,1,2)"/>
+ <xsl:variable name="str1-after" select="substring($str1,3)"/>
+ <xsl:if test="substring($str1,1,1)='H' or substring($str1,1,1)='h'">
+ <number:hours number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='M' or substring($str1,1,1)='m'">
+ <number:minutes number:style="long"/>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='S' or substring($str1,1,1)='s'">
+ <number:seconds number:style="long"/>
+ </xsl:if>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="substring($str1,1,1)='H'or substring($str1,1,1)='M'or substring($str1,1,1)='S'or substring($str1,1,1)='h' or substring($str1,1,1)='m' or substring($str1,1,1)='s'">
+ <xsl:variable name="str1-after" select="substring($str1,2)"/>
+ <xsl:variable name="str1-before" select="substring($str1,1,1)"/>
+ <xsl:if test="substring($str1,1,1)='H' or substring($str1,1,1)='h'">
+ <number:hours/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='M' or substring($str1,1,1)='m'">
+ <number:minutes/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="substring($str1,1,1)='S' or substring($str1,1,1)='s'">
+ <number:seconds/>
+ <number:text>
+ <xsl:value-of select="substring($str1-after,1,1)"/>
+ </number:text>
+ </xsl:if>
+ <xsl:if test="string-length($str1-after)&gt;1">
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($str1-after,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="oo数字格式域开关">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='Arabic'">1</xsl:when>
+ <xsl:when test="$oo_format='ROMAN'">I</xsl:when>
+ <xsl:when test="$oo_format='roman'">i</xsl:when>
+ <xsl:when test="$oo_format='ALPHABETIC'">A</xsl:when>
+ <xsl:when test="$oo_format='alphabetic'">a</xsl:when>
+ <xsl:when test="$oo_format='GB1'">1, 2, 3, ...</xsl:when>
+ <xsl:when test="$oo_format='GB3'">①, ②, ③, ...</xsl:when>
+ <xsl:when test="$oo_format='CHINESENUM3'">一, 二, 三, ...</xsl:when>
+ <xsl:when test="$oo_format='CHINESENUM2'">壹, 贰, 叁, ...</xsl:when>
+ <xsl:when test="$oo_format='ZODIAC1'">甲, 乙, 丙, ...</xsl:when>
+ <xsl:when test="$oo_format='ZODIAC2'">子, 丑, 寅, ...</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="题注">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串 or 字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="aa" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,'\f ')"/>
+ <xsl:variable name="ooow" select="substring-after($aa,'ooow:') "/>
+ <xsl:variable name="as" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="ad">
+ <xsl:value-of select="substring-after($as,'SEQ ') "/>
+ </xsl:variable>
+ <xsl:variable name="num">
+ <xsl:value-of select="substring-after(substring-before(../字:域代码/字:段落/字:句/字:文本串,' \f'),'\* ')"/>
+ </xsl:variable>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="$num"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:sequence">
+ <xsl:attribute name="text:name"><xsl:choose><xsl:when test="$ad='表格'">Table</xsl:when><xsl:when test="$ad='图表'">Drawing</xsl:when><xsl:otherwise><xsl:value-of select="$ad"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:choose><xsl:when test="contains($aa,'ooow:')"><xsl:value-of select="$ooow"/></xsl:when><xsl:when test="contains($as,'表格')"><xsl:value-of select="concat('Table','+',$fmt)"/></xsl:when><xsl:when test="contains($as,'图表')"><xsl:value-of select="concat('Drawing','+',$fmt)"/></xsl:when><xsl:otherwise><xsl:value-of select="$aa"/></xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="页码域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串 or 字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="$date0"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:page-number">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:attribute name="text:select-page">current</xsl:attribute>
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="页数域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="substring-before($date0,' \*')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:page-count">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="作者域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:element name="text:initial-creator">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="用户域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:element name="text:author-name">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="缩写域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:element name="text:author-initials">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="标题域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:element name="text:title">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="主题域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:element name="text:subject">
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="文件名">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:element name="text:file-name">
+ <xsl:variable name="string">
+ <xsl:value-of select="../字:域代码/字:段落/字:句/字:文本串"/>
+ </xsl:variable>
+ <xsl:attribute name="text:display"><xsl:choose><xsl:when test="contains($string,' \p')">full</xsl:when><xsl:otherwise>name-and-extension</xsl:otherwise></xsl:choose></xsl:attribute>
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="编辑时间">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/>
+ <xsl:variable name="datestr" select="$date0"/>
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="创建时间">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(following-sibling::字:域代码/字:段落/字:句/字:文本串,'\@ ')"/>
+ <xsl:variable name="datestr" select="$date0"/>
+ <xsl:call-template name="zytime">
+ <xsl:with-param name="str1" select="substring($datestr,2,string-length($datestr)-2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="字符数">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="substring-before($date0,' \#')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="text:character-count">
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:key name="mulu" match="/uof:UOF/uof:式样集/uof:段落式样" use="@字:标识符"/>
+ <xsl:template name="索引域">
+ <xsl:element name="text:alphabetical-index">
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:variable name="aanum">
+ <xsl:number value="0" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('索引目录',$aanum + 1)"/></xsl:attribute>
+ <text:alphabetical-index-source text:main-entry-style-name="Main_index_entry" text:sort-algorithm="pinyin" fo:language="zh" fo:country="CN">
+ <text:index-title-template text:style-name="Index_20_Heading">索引目录</text:index-title-template>
+ <text:alphabetical-index-entry-template text:outline-level="separator" text:style-name="Index_Separator">
+ <text:index-entry-text/>
+ </text:alphabetical-index-entry-template>
+ <text:alphabetical-index-entry-template text:outline-level="1" text:style-name="Index_20_1">
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ </text:alphabetical-index-entry-template>
+ <text:alphabetical-index-entry-template text:outline-level="2" text:style-name="Index_20_2">
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ </text:alphabetical-index-entry-template>
+ <text:alphabetical-index-entry-template text:outline-level="3" text:style-name="Index_20_3">
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ </text:alphabetical-index-entry-template>
+ </text:alphabetical-index-source>
+ <text:index-body>
+ <text:index-title>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('索引目录',$aanum + 1,'_Head')"/></xsl:attribute>
+ <xsl:for-each select="字:域代码/字:段落[position()=2]">
+ <text:p text:style-name="Index_20_Heading">
+ <xsl:apply-templates select=".//字:文本串"/>
+ </text:p>
+ </xsl:for-each>
+ </text:index-title>
+ <xsl:if test="字:域开始/@字:类型='INDEX'">
+ <xsl:for-each select="字:域代码/字:段落[position()>2]">
+ <xsl:element name="text:p">
+ <xsl:variable name="aa">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$aa + 1)"/></xsl:attribute>
+ <xsl:for-each select="字:句">
+ <xsl:apply-templates select="self::node()/*"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ </text:index-body>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="目录域">
+ <xsl:element name="text:table-of-content">
+ <xsl:variable name="stylenum">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:句" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:variable name="aanum">
+ <xsl:number value="0" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('内容目录',$aanum + 1)"/></xsl:attribute>
+ <text:table-of-content-source text:outline-level="10">
+ <text:index-title-template text:style-name="Contents_20_Heading">内容目录</text:index-title-template>
+ <text:table-of-content-entry-template text:outline-level="1" text:style-name="Contents 1">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="2" text:style-name="Contents 2">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="3" text:style-name="Contents 3">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="4" text:style-name="Contents 4">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="5" text:style-name="Contents 5">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="6" text:style-name="Contents 6">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="7" text:style-name="Contents 7">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="8" text:style-name="Contents 8">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="9" text:style-name="Contents 9">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="10" text:style-name="Contents 10">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ </text:table-of-content-source>
+ <text:index-body>
+ <text:index-title>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('Sect',$stylenum)"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select="concat('内容目录',$aanum + 1,'_Head')"/></xsl:attribute>
+ <xsl:for-each select="字:域代码/字:段落[position()=2]">
+ <text:p text:style-name="Contents_20_Heading">
+ <xsl:apply-templates select=".//字:文本串"/>
+ </text:p>
+ </xsl:for-each>
+ </text:index-title>
+ <xsl:if test="字:域开始/@字:类型='REF'">
+ <xsl:for-each select="字:域代码/字:段落[position()>2]">
+ <xsl:element name="text:p">
+ <xsl:variable name="aa">
+ <xsl:number from="/uof:UOF/uof:文字处理/字:主体" level="any" count="字:段落[字:段落属性]"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$aa + 1)"/></xsl:attribute>
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:attribute name="text:style-name">Index Link</xsl:attribute>
+ <xsl:attribute name="text:visited-style-name">Index Link</xsl:attribute>
+ <xsl:variable name="hyperDest" select="./字:句/字:区域开始/@字:标识符"/>
+ <xsl:attribute name="xlink:href"><xsl:for-each select="/uof:UOF/uof:链接集/uof:超级链接"><xsl:if test="@uof:链源=$hyperDest"><xsl:value-of select="concat('#',@uof:书签)"/></xsl:if></xsl:for-each></xsl:attribute>
+ <xsl:apply-templates select="字:句/*"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:if>
+ </text:index-body>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="suojinleixing">
+ <xsl:if test="字:缩进/字:首行/字:绝对/@字:值 and 字:缩进/字:左/字:绝对/@字:值">
+ <xsl:attribute name="text:min-label-width"><xsl:value-of select="concat(0 - 字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ <xsl:attribute name="text:space-before"><xsl:value-of select="concat(字:缩进/字:左/字:绝对/@字:值 + 字:缩进/字:首行/字:绝对/@字:值,$uofUnit)"/></xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="字:修订开始[@字:类型='insert']">
+ <xsl:choose>
+ <xsl:when test="./@字:标识符">
+ <text:change-start text:change-id="{@字:标识符}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:change-start text:change-id="{@字:修订信息引用}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:修订结束[preceding::字:修订开始[1]/@字:类型='insert']">
+ <text:change-end>
+ <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute>
+ </text:change-end>
+ </xsl:template>
+ <xsl:template match="字:修订开始[@字:类型='delete']">
+ <xsl:choose>
+ <xsl:when test="./@字:标识符">
+ <text:change-start text:change-id="{@字:标识符}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:change-start text:change-id="{@字:修订信息引用}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:修订结束[preceding::字:修订开始[1]/@字:类型='delete']">
+ <text:change-end>
+ <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute>
+ </text:change-end>
+ </xsl:template>
+ <xsl:template match="字:修订开始[@字:类型='format']">
+ <xsl:choose>
+ <xsl:when test="./@字:标识符">
+ <text:change-start text:change-id="{@字:标识符}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:change-start text:change-id="{@字:修订信息引用}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="字:修订结束[preceding::字:修订开始[1]/@字:类型='format']">
+ <text:change-end>
+ <xsl:attribute name="text:change-id"><xsl:value-of select="@字:开始标识引用"/></xsl:attribute>
+ </text:change-end>
+ </xsl:template>
+ <xsl:template name="GenerateTrackChanges">
+ <text:tracked-changes>
+ <xsl:if test="/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:修订">
+ <xsl:attribute name="text:track-changes"><xsl:value-of select="/uof:UOF/uof:文字处理/字:公用处理规则/字:文档设置/字:修订/@字:值"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="//字:段落/字:修订开始[@字:类型='insert']">
+ <xsl:for-each select="//字:段落/字:修订开始[@字:类型='insert']">
+ <xsl:variable name="id" select="@字:标识符"/>
+ <xsl:variable name="aid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:作者"/>
+ <xsl:variable name="sid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$aid]/@字:姓名"/>
+ <xsl:variable name="bid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:日期"/>
+ <text:changed-region text:id="{$id}">
+ <xsl:choose>
+ <xsl:when test="name()='字:修订开始'">
+ <xsl:choose>
+ <xsl:when test="not(name(following-sibling::node()[1])='字:修订结束')">
+ <text:insertion>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:insertion>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:format-change>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:format-change>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </text:changed-region>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="//字:段落/字:修订开始[@字:类型='insert']">
+ <xsl:for-each select="//字:段落/字:修订开始[@字:类型='delete']">
+ <xsl:variable name="id" select="@字:标识符"/>
+ <xsl:variable name="aid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:作者"/>
+ <xsl:variable name="sid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$aid]/@字:姓名"/>
+ <xsl:variable name="bid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:日期"/>
+ <text:changed-region text:id="{$id}">
+ <xsl:choose>
+ <xsl:when test="name()='字:修订开始'">
+ <xsl:choose>
+ <xsl:when test="not(name(following-sibling::node()[1])='字:修订结束')">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:deletion>
+ </xsl:when>
+ <xsl:otherwise>
+ <text:format-change>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:format-change>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </text:changed-region>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="//字:段落/字:修订开始[@字:类型='format']">
+ <xsl:for-each select="//字:段落/字:修订开始[@字:类型='format']">
+ <xsl:variable name="id" select="@字:标识符"/>
+ <xsl:variable name="aid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:作者"/>
+ <xsl:variable name="sid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:用户集/字:用户[@字:标识符=$aid]/@字:姓名"/>
+ <xsl:variable name="bid" select="/uof:UOF/uof:文字处理/字:公用处理规则/字:修订信息集/字:修订信息[@字:标识符=$id]/@字:日期"/>
+ <text:changed-region text:id="{$id}">
+ <xsl:choose>
+ <xsl:when test="name()='字:修订开始'">
+ <xsl:choose>
+ <xsl:when test="not(name(following-sibling::node()[1])='字:修订结束')">
+ <text:format-change>
+ <office:change-info>
+ <dc:creator>
+ <xsl:value-of select="$sid"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="$bid"/>
+ </dc:date>
+ </office:change-info>
+ </text:format-change>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </text:changed-region>
+ </xsl:for-each>
+ </xsl:if>
+
+ </text:tracked-changes>
+
+ </xsl:template>
+ <xsl:template name="oo数字格式">
+ <xsl:param name="oo_format"/>
+ <xsl:choose>
+ <xsl:when test="$oo_format='decimal'">1</xsl:when>
+ <xsl:when test="$oo_format='upper-roman'">I</xsl:when>
+ <xsl:when test="$oo_format='lower-roman'">i</xsl:when>
+ <xsl:when test="$oo_format='upper-letter'">A</xsl:when>
+ <xsl:when test="$oo_format='lower-letter'">a</xsl:when>
+ <xsl:when test="$oo_format='decimal-full-width'">1, 2, 3, ...</xsl:when>
+ <xsl:when test="$oo_format='decimal-enclosed-circle'">①, ②, ③, ...</xsl:when>
+ <xsl:when test="$oo_format='chinese-counting'">一, 二, 三, ...</xsl:when>
+ <xsl:when test="$oo_format='chinese-legal-simplified'">壹, 贰, 叁, ...</xsl:when>
+ <xsl:when test="$oo_format='ideograph-traditional'">甲, 乙, 丙, ...</xsl:when>
+ <xsl:when test="$oo_format='ideograph-zodiac'">子, 丑, 寅, ...</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="章节域">
+ <xsl:if test="../字:域代码/字:段落/字:句/字:文本串">
+ <xsl:variable name="date0" select="substring-after(../字:域代码/字:段落/字:句/字:文本串,' \* ')"/>
+ <xsl:variable name="datestr" select="substring-before(../字:域代码/字:段落/字:句/字:文本串,'\* ')"/>
+ <xsl:variable name="fmt">
+ <xsl:choose>
+ <xsl:when test="substring-before($date0,' \*')='Arabic'">
+ <xsl:call-template name="oo数字格式域开关">
+ <xsl:with-param name="oo_format" select="substring-before($date0,' \*')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="text:chapter">
+ <xsl:attribute name="text:display">name</xsl:attribute>
+ <xsl:attribute name="text:outline-level"><xsl:value-of select="$fmt"/></xsl:attribute>
+ <xsl:value-of select="following-sibling::字:句/字:文本串"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo.xsl b/filter/source/xslt/import/wordml/wordml2ooo.xsl
new file mode 100644
index 000000000000..e594e37012f9
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo.xsl
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo.xsl,v $
+
+ $Revision: 1.13 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v" xmlns:fla="urn:experimental:fla">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:include href="../../common/measure_conversion.xsl"/>
+ <xsl:include href="../common/ms2ooo_docpr.xsl"/>
+ <xsl:include href="wordml2ooo_text.xsl"/>
+ <xsl:include href="wordml2ooo_settings.xsl"/>
+ <xsl:include href="wordml2ooo_table.xsl"/>
+ <xsl:include href="wordml2ooo_page.xsl"/>
+ <xsl:include href="wordml2ooo_list.xsl"/>
+ <xsl:include href="wordml2ooo_draw.xsl"/>
+ <xsl:include href="wordml2ooo_field.xsl"/>
+ <xsl:include href="wordml2ooo_props.xsl"/>
+ <xsl:key name="paragraph-style" match="w:style[@w:type = 'paragraph']" use="@w:styleId"/>
+ <xsl:key name="heading-style" match="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl]" use="@w:styleId"/>
+ <xsl:variable name="preserve-alien-markup">no</xsl:variable>
+ <xsl:variable name="native-namespace-prefixes">,w,o,v,wx,aml,w10,dt,</xsl:variable>
+ <xsl:variable name="to-dispatch-elements">,wx:sect,wx:sub-section,w:p,w:tbl,w:sectPr,w:r,w:fldSimple,w:hlink,w:t,w:pict,w:br,w:instrText,w:fldChar,w:tab,w:footnote,w:endnote,aml:annotation,w:hlink,w:footnote,w:endnote,w:tblGrid,w:tr,w:tc,wx:pBdrGroup,</xsl:variable>
+ <xsl:template match="/">
+ <xsl:apply-templates select="w:wordDocument"/>
+ </xsl:template>
+ <xsl:template match="*" mode="dispatch">
+ <xsl:choose>
+ <xsl:when test="not(contains($native-namespace-prefixes, concat(',', substring-before(name(), ':'), ',')))">
+ <!-- if alien namespace dispatch -->
+ <xsl:choose>
+ <xsl:when test="$preserve-alien-markup = 'yes'">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains($to-dispatch-elements, concat(',',name(),','))">
+ <xsl:apply-templates select="current()"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:wordDocument">
+ <office:document office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.0">
+ <fla:fla.activate/>
+ <xsl:apply-templates select="o:DocumentProperties"/>
+ <xsl:apply-templates select="w:docOleData" mode="init"/>
+ <xsl:apply-templates select="w:docPr"/>
+ <xsl:apply-templates select="w:fonts"/>
+ <xsl:apply-templates select="w:styles"/>
+ <xsl:apply-templates select="w:body"/>
+ <xsl:apply-templates select="w:docOleData" mode="exit"/>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="w:fonts">
+ <xsl:element name="office:font-face-decls">
+ <!-- MS Word's default font declaration, added for Writer automatically. glu -->
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
+ <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <xsl:if test="not(w:font[@w:name='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="w:font">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@w:name"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:font-family">
+ <xsl:value-of select="@w:name"/>
+ </xsl:attribute>
+ <!-- added by glu, for process special fonts e.g. Marlett, -->
+ <xsl:if test="w:charset/@w:val = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:family">
+ <xsl:choose>
+ <xsl:when test="w:family/@w:val = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pitch and string-length(w:pitch/@w:val) &gt; 0">
+ <xsl:attribute name="style:font-pitch">
+ <xsl:choose>
+ <xsl:when test="w:pitch/@w:val = 'default'">variable</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:pitch/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:styles">
+ <office:styles>
+ <!--The next statement Added by wguo,collect the pict's dash and mark-style.The template is implemented in file wordml2ooo_draw.xsl-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style4dash_mark"/>
+ <xsl:apply-templates select="//v:fill" mode="office-style"/>
+ <xsl:call-template name="create-default-paragraph-styles"/>
+ <xsl:call-template name="create-default-text-styles"/>
+ <xsl:call-template name="create-default-frame-style"/>
+ <!-- StarWriter has no default style family 'list'. glu -->
+ <xsl:if test="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl and w:pPr/w:listPr]">
+ <xsl:call-template name="create-outline-style"/>
+ </xsl:if>
+ <xsl:apply-templates select="w:style[@w:type='table']" mode="table"/>
+ <xsl:apply-templates select="w:style[@w:type='list']" mode="list"/>
+ <xsl:apply-templates select="w:style[@w:type!='list']"/>
+ <xsl:apply-templates select="/w:wordDocument/w:docPr/w:footnotePr" mode="config"/>
+ <xsl:apply-templates select="/w:wordDocument/w:docPr/w:endnotePr" mode="config"/>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:p" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:rPr[not(parent::w:pPr)]" mode="style"/>
+ <!--The next statement Added by wguo for the pict's draw-style.The template is implemented in file wordml2ooo_draw.xsl-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:tblPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:gridCol" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:trPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:tcPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:listPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="page-layout"/>
+ <xsl:call-template name="default_date_style"/>
+ <!--add for generate the date , time style for date , time field G.Y.-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText | /w:wordDocument/w:body//w:fldSimple " mode="style"/>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="master-page"/>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template match="w:style">
+ <style:style>
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ <xsl:if test="w:basedOn">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:next">
+ <xsl:attribute name="style:next-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@w:type = 'character'">
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:when>
+ <!-- table, paragraph are the same as in Writer . glu -->
+ <xsl:when test="@w:type">
+ <xsl:attribute name="style:family">
+ <xsl:value-of select="@w:type"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@w:type = 'table'">
+ <xsl:element name="style:table-properties">
+ <!-- xsl:apply-templates select="w:tblPr" mode="style"/ -->
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@w:type = 'character' ">
+ <xsl:element name="style:text-properties">
+<!--
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ <xsl:apply-templates select="w:rPr"/>
+-->
+ <xsl:for-each select="w:rPr">
+ <xsl:call-template name="text-properties"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:apply-templates select="w:pPr"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="w:rPr"/>
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:body">
+ <xsl:element name="office:body">
+ <xsl:element name="office:text">
+ <!-- to add the sequece variable declaration at the begining of the office:body G.Y.-->
+ <text:sequence-decls>
+ <xsl:call-template name="default_seqence_declaration"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,3) = 'SEQ' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,3) = 'SEQ' ] " mode="sequence_declare"/>
+ </text:sequence-decls>
+ <!-- add the user field variables declare for Docpropety fields importing G.Y.-->
+ <text:user-field-decls>
+ <xsl:call-template name="user_fields_declare_docproperty"/>
+ </text:user-field-decls>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="wx:sect">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <xsl:template match="wx:sub-section">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <xsl:template name="create-default-frame-style">
+ <!--add for default frame style -->
+ <style:style style:name="Frame" style:family="graphic">
+ <style:graphic-properties text:anchor-type="paragraph" svg:x="0in" svg:y="0in" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="ConvertMeasure">
+ <xsl:param name="TargetMeasure" select="'cm'"/>
+ <xsl:param name="TargetTruncate" select=" 'all' "/>
+ <xsl:param name="value"/>
+ <!-- When TargetTruncate ='all' it returns the number whichsoever the return value is negative or positive
+ When TargetTruncate ='nonNegative' it only returns nonNegative number, all negative number to be returned as 0
+ When TargetTruncate ='positive" it only returns positive number, all nonPositive number to be returned as 1 -->
+ <xsl:variable name="return_value">
+ <xsl:choose>
+ <!-- remove the measure mark, if the value is null, the result should be 0. Must be the first case -->
+ <xsl:when test="string-length(translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ','')) = 0">0</xsl:when>
+ <xsl:when test="string-length(translate($value,'-.0123456789 ','')) = 0">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'cm'">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'pt'">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'twip'">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'in'">
+ <xsl:call-template name="convert2in">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$TargetTruncate = 'all' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'nonNegative' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt; 0 ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'positive' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt;= 0 ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl
new file mode 100644
index 000000000000..fedfd69ce458
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl
@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_custom_draw.xsl,v $
+
+ $Revision: 1.7 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt fo v">
+ <xsl:template name="ms_word_draw_map2ooo_custom_draw">
+ <xsl:param name="ms_word_draw_type"/>
+ <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
+ <xsl:choose>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t5' ">
+ <xsl:value-of select=" 'isosceles-triangle'"/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type ='#_x0000_t6' ">
+ <xsl:value-of select=" 'right-triangle' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t8' ">
+ <xsl:value-of select=" 'trapezoid' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t4' ">
+ <xsl:value-of select=" 'diamond' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t9' ">
+ <xsl:value-of select=" 'hexagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t7' ">
+ <xsl:value-of select="'parallelogram' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t56' ">
+ <xsl:value-of select=" 'pentagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t10' ">
+ <xsl:value-of select=" 'octagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t11' ">
+ <xsl:value-of select=" 'cross' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t23' ">
+ <xsl:value-of select=" 'ring' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t95' ">
+ <xsl:value-of select=" 'block-arc' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t22' ">
+ <xsl:value-of select=" 'can' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t16' ">
+ <xsl:value-of select=" 'cube' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t65' ">
+ <xsl:value-of select=" 'paper' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t96' ">
+ <xsl:value-of select=" 'smiley' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t183' ">
+ <xsl:value-of select=" 'sun' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t184' ">
+ <xsl:value-of select=" 'moon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t74' ">
+ <xsl:value-of select=" 'heart' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t57' ">
+ <xsl:value-of select=" 'forbidden' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type ='#_x0000_t85' ">
+ <xsl:value-of select=" 'left-bracket' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t86' ">
+ <xsl:value-of select=" 'right-bracket' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t87' ">
+ <xsl:value-of select=" 'left-brace' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t88' ">
+ <xsl:value-of select=" 'right-brace' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t185' ">
+ <xsl:value-of select=" 'bracket-pair' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t186' ">
+ <xsl:value-of select=" 'brace-pair' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t189' ">
+ <xsl:value-of select=" 'quad-bevel' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t66' ">
+ <xsl:value-of select=" 'left-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t67' ">
+ <xsl:value-of select=" 'down-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t68' ">
+ <xsl:value-of select=" 'up-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t13' ">
+ <xsl:value-of select=" 'right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t69' ">
+ <xsl:value-of select=" 'left-right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t70' ">
+ <xsl:value-of select=" 'up-down-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t89' ">
+ <xsl:value-of select=" 'mso-spt89' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t76' ">
+ <xsl:value-of select=" 'quad-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t94' ">
+ <xsl:value-of select=" 'notched-right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
+ <xsl:value-of select=" 'pentagon-right' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t55' ">
+ <xsl:value-of select=" 'chevron' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t79' ">
+ <xsl:value-of select=" 'up-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t80' ">
+ <xsl:value-of select=" 'down-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t82' ">
+ <xsl:value-of select=" 'up-down-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t103' ">
+ <xsl:value-of select=" 'circular-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t109' ">
+ <xsl:value-of select=" 'flowchart-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
+ <xsl:value-of select=" 'flowchart-alternate-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t110' ">
+ <xsl:value-of select=" 'flowchart-decision' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t111' ">
+ <xsl:value-of select=" 'flowchart-data' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t112' ">
+ <xsl:value-of select=" 'flowchart-predefined-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t113' ">
+ <xsl:value-of select=" 'flowchart-internal-storage' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t114' ">
+ <xsl:value-of select=" 'flowchart-document' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t115' ">
+ <xsl:value-of select=" 'flowchart-multidocument' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
+ <xsl:value-of select=" 'flowchart-terminator' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t117' ">
+ <xsl:value-of select=" 'flowchart-preparation' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t118' ">
+ <xsl:value-of select=" 'flowchart-manual-input' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t119' ">
+ <xsl:value-of select=" 'flowchart-manual-operation' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t120' ">
+ <xsl:value-of select=" 'flowchart-connector' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
+ <xsl:value-of select=" 'flowchart-off-page-connector' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t121' ">
+ <xsl:value-of select=" 'flowchart-card' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t122' ">
+ <xsl:value-of select=" 'flowchart-punched-tape' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t123' ">
+ <xsl:value-of select=" 'flowchart-summing-junction' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t124' ">
+ <xsl:value-of select=" 'flowchart-or' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t125' ">
+ <xsl:value-of select=" 'flowchart-collate' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t126' ">
+ <xsl:value-of select=" 'flowchart-sort' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t127' ">
+ <xsl:value-of select=" 'flowchart-extract' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t128' ">
+ <xsl:value-of select=" 'flowchart-merge' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t130' ">
+ <xsl:value-of select=" 'flowchart-stored-data' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t135' ">
+ <xsl:value-of select=" 'flowchart-delay' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t131' ">
+ <xsl:value-of select=" 'flowchart-sequential-access' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t132' ">
+ <xsl:value-of select=" 'flowchart-magnetic-disk' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t133' ">
+ <xsl:value-of select=" 'flowchart-direct-access-storage' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t134' ">
+ <xsl:value-of select=" 'flowchart-display' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t61' ">
+ <xsl:value-of select=" 'rectangular-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t62' ">
+ <xsl:value-of select=" 'round-rectangular-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t63' ">
+ <xsl:value-of select=" 'round-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t106' ">
+ <xsl:value-of select=" 'cloud-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t50' ">
+ <xsl:value-of select=" 'line-callout-1' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t51' ">
+ <xsl:value-of select=" 'line-callout-2' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t47' ">
+ <xsl:value-of select=" 'line-callout-3' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t72' ">
+ <xsl:value-of select=" 'bang' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t187' ">
+ <xsl:value-of select=" 'star4' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t12' ">
+ <xsl:value-of select=" 'star5' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t58' ">
+ <xsl:value-of select=" 'star8' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t92' ">
+ <xsl:value-of select=" 'star24' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t97' ">
+ <xsl:value-of select=" 'vertical-scroll' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t98' ">
+ <xsl:value-of select=" 'horizontal-scroll' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl
new file mode 100644
index 000000000000..2cd287e59e75
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl
@@ -0,0 +1,2217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_draw.xsl,v $
+
+ $Revision: 1.10 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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:xalan="http://xml.apache.org/xalan" xmlns:oleextracter="MyOleExtracter" xmlns:ole="java:XSLTFilterOLEExtracter" xmlns:java="http://saxon.sf.net/java-type" exclude-result-prefixes="w wx aml o dt v xalan ole oleextracter java" extension-element-prefixes="oleextracter">
+ <xsl:include href="wordml2ooo_custom_draw.xsl"/>
+ <xsl:include href="wordml2ooo_path.xsl"/>
+ <xsl:param name="oleExtractor" as="java:XSLTFilterOLEExtracter" select="ole:new()"/>
+ <xsl:param name="XMultiServiceFactory" as="java:com.sun.star.lang.XMultiServiceFactory" select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+
+
+ <xsl:key name="imagedata" match="w:binData" use="@w:name"/>
+ <xsl:key name="shapetype" match="v:shapetype" use="concat('#', @id)"/>
+ <xsl:template match="v:fill" mode="get-xsl-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="get-xsl-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:template>
+ <xsl:template match="v:fill" mode="office-style">
+ <xsl:choose>
+ <xsl:when test="@type='pattern' or @type='tile' or @type='frame'">
+ <xsl:variable name="fill-src" select="key('imagedata',@src)"/>
+ <xsl:if test="$fill-src">
+ <draw:fill-image>
+ <xsl:if test="string-length(@o:title) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="@o:title"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="translate(@src,'&#9;&#10;&#13;&#32;:/.','' ) "/>
+ </xsl:attribute>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="translate($fill-src/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </xsl:element>
+ </draw:fill-image>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="contains(@type,'gradient')">
+ <draw:gradient>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select=" 'gradient' "/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:style">linear</xsl:attribute>
+ <xsl:if test="string-length(parent::v:*/@fillcolor) &gt; 0">
+ <xsl:attribute name="draw:start-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="parent::v:*/@fillcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length(@color2) &gt; 0">
+ <xsl:attribute name="draw:end-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="@color2"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </draw:gradient>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:pict" mode="style4dash_mark">
+ <xsl:if test="descendant::v:line or descendant::v:rect or descendant::v:oval or descendant::v:arc or descendant::v:shape">
+ <!--Changed-->
+ <xsl:variable name="vchild" select="./v:*"/>
+ <xsl:variable name="def" select="$vchild/v:stroke"/>
+ <xsl:if test="$def">
+ <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> -->
+ <xsl:variable name="wdashstyle" select="$vchild/v:stroke/@dashstyle"/>
+ <xsl:variable name="stroke-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="ptweight">
+ <xsl:choose>
+ <xsl:when test="$vchild/@strokeweight">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ <xsl:with-param name="value" select="$vchild/@strokeweight"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ <xsl:with-param name="value" select="'1pt'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$wdashstyle and not ($wdashstyle = 'solid')">
+ <xsl:variable name="strdashdot">
+ <xsl:call-template name="getstrdashdot">
+ <xsl:with-param name="dashstyle" select="$wdashstyle"/>
+ <!--<xsl:with-param name="weight" select="$vchild/@strokeweight"/>-->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="draw-style">
+ <xsl:variable name="end-cap" select="$vchild/v:stroke/@endcap"/>
+ <xsl:choose>
+ <xsl:when test="$end-cap = 'round'">round</xsl:when>
+ <xsl:otherwise>rect</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot1-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dol:'"/>
+ <xsl:with-param name="suffix" select="';don'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot1n">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'don:'"/>
+ <xsl:with-param name="suffix" select="';dist'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dist-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dist:'"/>
+ <xsl:with-param name="suffix" select="';dtl'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dtl:'"/>
+ <xsl:with-param name="suffix" select="';dtn'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2n">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dtn:'"/>
+ <xsl:with-param name="suffix" select="';eddtn'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="draw:stroke-dash">
+ <!--dol:8;don:1;dist:2;dtl:1;dtn:2;eddtn" />-->
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="concat('Tdash',$stroke-num)"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:style">
+ <xsl:value-of select="$draw-style"/>
+ </xsl:attribute>
+ <xsl:if test="(string-length($dot1n) &gt; 0 ) and not ($dot1n ='-1')">
+ <xsl:attribute name="draw:dots1">
+ <xsl:value-of select="$dot1n"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot2n) &gt; 0 ) and not ($dot2n ='-1')">
+ <xsl:attribute name="draw:dots2">
+ <xsl:value-of select="$dot2n"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot1-length) &gt; 0 ) and not ($dot1-length ='-1')">
+ <xsl:attribute name="draw:dots1-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dot1-length,'pt')"/>
+ </xsl:call-template>in</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot2-length) &gt; 0 ) and not ($dot2-length ='-1')">
+ <xsl:attribute name="draw:dots2-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dot2-length,'pt')"/>
+ </xsl:call-template>in</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dist-length) &gt; 0 ) and not ($dist-length ='-1')">
+ <xsl:variable name="valdistance-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dist-length,'pt')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="draw:distance">
+ <xsl:value-of select="$valdistance-length*$ptweight"/>in</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@startarrow">
+ <xsl:call-template name="CreateArrowStyle">
+ <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@startarrow"/>
+ <xsl:with-param name="namenumber" select="concat('markerstart',$stroke-num)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@endarrow">
+ <xsl:call-template name="CreateArrowStyle">
+ <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@endarrow"/>
+ <xsl:with-param name="namenumber" select="concat('markerend',$stroke-num)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--<v:stroke dashstyle="1 1" startarrow="diamond" startarrowwidth="wide" startarrowlength="long" endarrow="block"
+ endarrowwidth="wide" endarrowlength="long" endcap="round"/>
+ <draw:stroke-dash draw:name="2 2dots 1 dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.0795in"
+ draw:distance="0.102in"/>
+ Hehe,It need to be revised-->
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="CreateArrowStyle">
+ <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> -->
+ <xsl:param name="arrow-name"/>
+ <xsl:param name="namenumber"/>
+ <xsl:param name="arrow-weight"/>
+ <xsl:variable name="svg-box">
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'block' ">0 0 1131 902</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">0 0 10 10</xsl:when>
+ <xsl:when test="$arrow-name = 'open' ">0 0 1122 2243</xsl:when>
+ <xsl:when test="$arrow-name = 'oval' ">0 0 1131 1131</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">0 0 1131 1131</xsl:when>
+ <xsl:when test="$arrow-name = 'classic' ">0 0 1131 1580</xsl:when>
+ <xsl:otherwise>0 0 1122 2243</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svg-d">
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'block' ">m564 0-564 902h1131z</xsl:when>
+ <!--Symmetric Arrow-->
+ <xsl:when test="$arrow-name = 'diamond' ">m0 0h10v10h-10z</xsl:when>
+ <xsl:when test="$arrow-name = 'open' ">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:when>
+ <xsl:when test="$arrow-name = 'oval' ">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">m0 564 564 567 567-567-567-564z</xsl:when>
+ <xsl:when test="$arrow-name = 'classic' ">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:when>
+ <xsl:otherwise>m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="$namenumber"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:display-name">
+ <xsl:value-of select="$namenumber"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$svg-box"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:d">
+ <xsl:value-of select="$svg-d"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <!-- The template MapDashConst Map the const dashstyle to a number manner
+ It calls the template kickblanks to delete the extra blanks in the dash style here is the map
+• Solid (default) • ShortDash "2 2"
+• ShortDot "0 2" • ShortDashDot "2 2 0 2"
+• ShortDashDotDot "2 2 0 2 0 2" • Dot "1 2"
+• Dash "4 2" • LongDash "8 2"
+• DashDot "4 2 1 2"• LongDashDot "8 2 1 2"
+• LongDashDotDot "8 2 1 2 1 2"
+-->
+ <xsl:template name="MapDashConst">
+ <xsl:param name="dashstyle"/>
+ <xsl:choose>
+ <xsl:when test="$dashstyle='shortDash'"> 2 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDot'"> 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDashDot'"> 2 2 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDashDotDot'"> 2 2 0 2 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='dot'"> 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='dash'"> 4 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDash'"> 8 2 </xsl:when>
+ <xsl:when test="$dashstyle='dashDot'"> 4 2 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDashDot'"> 8 2 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDashDotDot'"> 8 2 1 2 1 2 </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="str-style" select="concat(' ',$dashstyle ,' ')"/>
+ <xsl:variable name="cleanstyle">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="translate($str-style,' ','-')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="translate($cleanstyle,'-',' ')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--The template is used to delete the extra blanks from a string.-->
+ <xsl:template name="kickblanks">
+ <xsl:param name="str"/>
+ <xsl:variable name="tmpstr">
+ <xsl:choose>
+ <xsl:when test="contains($str,'--')">
+ <xsl:variable name="str-before">
+ <xsl:value-of select="substring-before($str,'--')"/>
+ </xsl:variable>
+ <xsl:variable name="str-after">
+ <xsl:value-of select="substring-after($str,'--')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($str-before,'-',$str-after)"/>
+ </xsl:when>
+ <xsl:when test="contains($str,' ')">
+ <xsl:variable name="str-before">
+ <xsl:value-of select="substring-before($str,' ')"/>
+ </xsl:variable>
+ <xsl:variable name="str-after">
+ <xsl:value-of select="substring-after($str,' ')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($str-before,' ',$str-after)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not ( string-length($str) = string-length($tmpstr) )">
+ <xsl:variable name="restr">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="$tmpstr"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$restr"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="substrcount">
+ <xsl:param name="str"/>
+ <xsl:param name="substr"/>
+ <xsl:choose>
+ <xsl:when test="$substr and string-length($str) and contains($str,$substr) and string-length(substring-before($str,$substr)) = 0">
+ <xsl:variable name="restr" select="substring-after($str,$substr)"/>
+ <xsl:variable name="num">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$restr"/>
+ <xsl:with-param name="substr" select="$substr"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$num+1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="lastest-substr-after">
+ <xsl:param name="str"/>
+ <xsl:param name="substr"/>
+ <xsl:choose>
+ <xsl:when test="contains($str,$substr) and string-length(substring-before($str,$substr)) = 0">
+ <xsl:variable name="restr" select="substring-after($str,$substr)"/>
+ <xsl:call-template name="lastest-substr-after">
+ <xsl:with-param name="str" select="$restr"/>
+ <xsl:with-param name="substr" select="$substr"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Template get_revised_adj is used to get real adj when adj show two time in the file. -->
+ <xsl:template name="get_remained_adj">
+ <xsl:param name="adj_typeid"/>
+ <xsl:param name="num"/>
+ <xsl:param name="mark"/>
+ <xsl:choose>
+ <xsl:when test="$num &gt; 0 ">
+ <xsl:variable name="new_remained_adj">
+ <xsl:choose>
+ <xsl:when test="string-length($adj_typeid) &gt; 0">
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="substring-after($adj_typeid,$mark)"/>
+ <xsl:with-param name="num" select="$num -1"/>
+ <xsl:with-param name="mark" select="$mark"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$new_remained_adj"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$adj_typeid"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Template get_non_omit_adj is used to get the non-omit adj.(e.g. Adj="10,,11" means modifiers="10 0 11").-->
+ <xsl:template name="get_non_omit_adj">
+ <xsl:param name="adj_typeid"/>
+ <xsl:param name="num"/>
+ <xsl:param name="mark"/>
+ <xsl:choose>
+ <xsl:when test="$num &gt; 0 ">
+ <xsl:variable name="before" select="substring-before($adj_typeid,',')"/>
+ <xsl:variable name="after" select="substring-after($adj_typeid,',')"/>
+ <xsl:variable name="zero_or_itself">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($before, ' ','' ) ) &gt; 0">
+ <xsl:value-of select="$before"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new_non_omit_adj">
+ <xsl:call-template name="get_non_omit_adj">
+ <xsl:with-param name="adj_typeid" select="$after"/>
+ <xsl:with-param name="num" select="$num -1"/>
+ <xsl:with-param name="mark" select="$mark"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($zero_or_itself, ' ',$new_non_omit_adj)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zero_or_itself">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($adj_typeid, ' ','' ) ) &gt; 0">
+ <xsl:value-of select="$adj_typeid"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$zero_or_itself"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="getstrdashdot">
+ <!--Remember the robust!if dashstyle is '2'?What to do!-->
+ <xsl:param name="dashstyle"/>
+ <xsl:variable name="dstyle">
+ <xsl:variable name="tmpstyle">
+ <xsl:call-template name="MapDashConst">
+ <xsl:with-param name="dashstyle" select="$dashstyle"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($tmpstyle,' ')"/>
+ </xsl:variable>
+ <xsl:variable name="dot1" select="substring-before($dstyle,' ')"/>
+ <xsl:variable name="dot1after" select="substring-after($dstyle,' ')"/>
+ <xsl:variable name="dot1distance" select="substring-before($dot1after,' ')"/>
+ <xsl:variable name="modesubstr1" select="concat($dot1,' ',$dot1distance,' ')"/>
+ <xsl:variable name="dot1n">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$dstyle"/>
+ <xsl:with-param name="substr" select="$modesubstr1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2substr">
+ <xsl:call-template name="lastest-substr-after">
+ <xsl:with-param name="str" select="$dstyle"/>
+ <xsl:with-param name="substr" select="$modesubstr1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:value-of select="substring-before($dot2substr,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot2distance">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:variable name="tmpstr" select="substring-after($dot2substr,' ')"/>
+ <xsl:value-of select="substring-before($tmpstr,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="modesubstr2" select="concat($dot2,' ',$dot2distance,' ') "/>
+ <xsl:variable name="dot2n">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$dot2substr"/>
+ <xsl:with-param name="substr" select="$modesubstr2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="valDistance">
+ <!--Over all distance is the larger one!-->
+ <xsl:choose>
+ <xsl:when test="$dot2distance &gt; $dot1distance">
+ <xsl:value-of select="$dot2distance"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dot1distance"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('dol:',$dot1,';don:',$dot1n,';dist:',$valDistance,';dtl:',$dot2,';dtn:',$dot2n,';eddtn')"/>
+ <!--<xsl:choose>
+ <xsl:when test="$dashstyle='1 1' or $dashstyle='Dots'">
+ <xsl:variable name="do"><xsl:value-of select="'1'"/></xsl:variable>
+ <xsl:variable name="dol"><xsl:value-of select="$do * $cmweight"/></xsl:variable>
+ <xsl:variable name="ds"><xsl:value-of select="'1'"/></xsl:variable>
+ <xsl:variable name="dsl"><xsl:value-of select="$ds * $cmweight"/></xsl:variable>
+ <xsl:variable name="dt"><xsl:value-of select="'-1'"/></xsl:variable>
+ <xsl:variable name="dtl"><xsl:value-of select="'-1'"/></xsl:variable>
+ <xsl:value-of select="concat('dsl:',$dsl,'edsl','do:',$do, 'edo;','do')"/>
+ </xsl:when>
+ </xsl:choose>-->
+ </xsl:template>
+ <xsl:template match="w:pict" mode="style">
+ <xsl:apply-templates mode="style" select="v:*"/>
+ </xsl:template>
+ <xsl:template match="v:*" mode="style">
+ <xsl:variable name="vchild" select="."/>
+ <xsl:variable name="style" select="concat($vchild/@style, ';')"/>
+ <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/>
+ <xsl:variable name="right-name" select="not(name($vchild) = 'v:formulas') and not(name($vchild) = 'v:f') and not(name($vchild) = 'v:shapetype')"/>
+ <xsl:variable name="def" select="string-length($style) &gt; 0 or $vchild/@stroke or $vchild/@stroked or $vchild/@strokecolor or $vchild/v:stroke or $vchild/@strokeweight or $vchild/@wrapcoords or $vchild/@fillcolor"/>
+ <xsl:choose>
+ <xsl:when test="$right-name and ($def or (number($z-index) &lt; 0))">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:variable name="stroke-num">
+ <xsl:if test="$vchild/v:stroke">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="draw-stroke">
+ <xsl:variable name="dashstyle" select="$vchild/v:stroke/@dashstyle"/>
+ <xsl:choose>
+ <xsl:when test="$vchild/@stroked and $vchild/@stroked='f'">none</xsl:when>
+ <xsl:when test="$dashstyle and not ($dashstyle = 'solid')">
+ <xsl:value-of select="concat('Tdash',$stroke-num)"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="style:graphic-properties">
+ <xsl:variable name="style-str" select="concat(@style,';')"/>
+ <xsl:choose>
+ <xsl:when test="number($z-index) &lt; 0 or (name($vchild) = 'v:group' and $vchild/@editas ='canvas' )">
+ <xsl:attribute name="style:wrap">run-through</xsl:attribute>
+ <xsl:attribute name="style:run-through">background</xsl:attribute>
+ <xsl:attribute name="style:flow-with-text">false</xsl:attribute>
+ <xsl:attribute name="fo:border">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:wrap">run-through</xsl:attribute>
+ <xsl:attribute name="style:run-through">foreground</xsl:attribute>
+ <xsl:attribute name="style:flow-with-text">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains($style-str,'mso-position-horizontal:')">
+ <xsl:attribute name="style:horizontal-pos">
+ <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-horizontal:') , ';')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="v:imagedata or v:textbox">
+ <xsl:attribute name="style:horizontal-pos">from-left</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="parent::w:pict/o:OLEObject">
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:attribute name="draw:visible-area-left">0cm</xsl:attribute>
+ <xsl:attribute name="draw:visible-area-top">0cm</xsl:attribute>
+ <xsl:attribute name="draw:visible-area-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:visible-area-height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:ole-draw-aspect">
+ <!-- DVASPECT_CONTENT = 1,
+ DVASPECT_THUMBNAIL = 2,
+ DVASPECT_ICON = 4,
+ DVASPECT_DOCPRINT = 8 -->
+ <xsl:variable name="ms-aspect" select="parent::w:pict/o:OLEObject/@DrawAspect"/>
+ <xsl:choose>
+ <xsl:when test="$ms-aspect = 'Content'">1</xsl:when>
+ <xsl:when test="$ms-aspect = 'Thumbnail'">2</xsl:when>
+ <xsl:when test="$ms-aspect = 'Icon'">4</xsl:when>
+ <xsl:when test="$ms-aspect = 'Docprint'">8</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="parent::w:pict/o:OLEObject">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">baseline</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($style-str,'mso-position-vertical:')">
+ <xsl:attribute name="style:vertical-pos">
+ <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-vertical:') , ';')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="v:imagedata or v:textbox">
+ <xsl:attribute name="style:vertical-pos">from-top</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="string-length($draw-stroke) &gt; 0">
+ <!--draw:stroke="dash" draw:stroke-dash="Ohon!Ultrafine dashed" -->
+ <xsl:choose>
+ <xsl:when test="not ($draw-stroke = 'none')">
+ <xsl:attribute name="draw:stroke">
+ <xsl:value-of select="'dash'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash">
+ <xsl:value-of select="$draw-stroke"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:stroke">
+ <xsl:value-of select="'none'"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@startarrow">
+ <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/-->
+ <xsl:attribute name="draw:marker-start">
+ <xsl:value-of select="concat('markerstart',$stroke-num)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@endarrow">
+ <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/-->
+ <xsl:attribute name="draw:marker-end">
+ <xsl:value-of select="concat('markerend',$stroke-num)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@strokeweight">
+ <xsl:attribute name="svg:stroke-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$vchild/@strokeweight"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@strokecolor">
+ <xsl:attribute name="svg:stroke-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="$vchild/@strokecolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@fillcolor">
+ <xsl:attribute name="draw:fill-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="$vchild/@fillcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not($vchild/@fillcolor)">
+ <xsl:choose>
+ <xsl:when test="ancestor::v:group | v:shadow">
+ <xsl:attribute name="draw:fill-color">#ffffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not($vchild/v:fill) and not(v:shadow)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@opacity">
+ <xsl:attribute name="draw:opacity">
+ <xsl:call-template name="convert2percent">
+ <xsl:with-param name="value" select="$vchild/v:fill/@opacity"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@type = 'pattern' or $vchild/v:fill/@type = 'tile' or $vchild/v:fill/@type = 'frame'">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name">
+ <xsl:value-of select="translate($vchild/v:fill/@src,'&#9;&#10;&#13;&#32;:/.','' ) "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@type = 'gradient'">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name">
+ <xsl:value-of select=" 'gradient' "/>
+ <xsl:apply-templates mode="get-xsl-number" select="$vchild/v:fill"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="style" select="v:shadow"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--Default style which will surely be removed during imported from a .flat file to SO-->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" style:wrap="none" draw:fill="none"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="name() = 'v:group'">
+ <xsl:apply-templates mode="style" select="v:*"/>
+ </xsl:if>
+ <xsl:apply-templates mode="style" select="v:textpath"/>
+ </xsl:template>
+ <xsl:template match="v:shadow" mode="style">
+ <!-- v:shadow on="t" color="aqua" opacity=".5" offset="13pt,11pt" offset2="14pt,10pt" -->
+ <xsl:attribute name="draw:shadow">
+ <xsl:choose>
+ <xsl:when test="contains(@on,'f')">hidden</xsl:when>
+ <xsl:otherwise>visible</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="@color"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="string-length(@opacity) &gt;0">
+ <xsl:attribute name="draw:shadow-opacity">
+ <xsl:call-template name="convert2percent">
+ <xsl:with-param name="value" select="@opacity"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="contains(@offset,',')">
+ <xsl:attribute name="draw:shadow-offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(@offset,',')"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-offset-y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after(@offset,',')"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:shadow-offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="@offset"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-offset-y">0.062cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@type='perspective' and @offset='0,0'">
+ <xsl:message>This kind of shadow does not support yet.</xsl:message>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="convert2percent">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value,'%')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="contains($value,'f')">
+ <xsl:variable name="num-value" select="round(substring-before($value,'f') div 6.5536) div 100"/>
+ <xsl:value-of select="concat(100 - $num-value ,'%')"/>
+ </xsl:when>
+ <xsl:when test="string-length($value) = 0">
+ <xsl:value-of select="'1%'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($value * 100 ,'%')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:pict">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:apply-templates>
+ <xsl:with-param name="x-scale" select="$x-scale"/>
+ <xsl:with-param name="y-scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-left" select="$group-left"/>
+ <xsl:with-param name="group-top" select="$group-top"/>
+ <xsl:with-param name="coord-left" select="$coord-left"/>
+ <xsl:with-param name="coord-top" select="$coord-top"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template name="get-middle-substring">
+ <xsl:param name="string"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:if test="contains($string, $prefix)">
+ <xsl:choose>
+ <xsl:when test="contains(substring-after( $string, $prefix), $suffix)">
+ <xsl:value-of select="substring-before(substring-after( $string, $prefix), $suffix)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after( $string, $prefix)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:binData">
+ </xsl:template>
+ <xsl:template match="v:group">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="left">
+ <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/>
+ <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-left"/>
+ <xsl:with-param name="value2" select="$direct-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="top">
+ <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/>
+ <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-top"/>
+ <xsl:with-param name="value2" select="$direct-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:variable name="Current-coord-left">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-before(@coordorigin, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-top">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-after(@coordorigin, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-width">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-before(@coordsize, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-height">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-after(@coordsize, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="string-length($MeasureMark) &gt; 0">
+ <xsl:value-of select="$MeasureMark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="left-value">
+ <xsl:variable name="adjusted-left">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="top-value">
+ <xsl:variable name="adjusted-top">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width-value">
+ <xsl:variable name="adjusted-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height-value">
+ <xsl:variable name="adjusted-height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-x-scale" select="( $Current-coord-width div $width-value ) * $x-scale"/>
+ <xsl:variable name="Current-y-scale" select="( $Current-coord-height div $height-value ) * $y-scale"/>
+ <xsl:choose>
+ <xsl:when test="@editas='canvas' ">
+ <!-- frame -->
+ <xsl:variable name="style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="frame-name">frame<xsl:number from="/w:wordDocument/w:body" level="any" count="v:group" format="1"/>
+ </xsl:variable>
+ <draw:frame draw:style-name="{$style-name}" draw:name="{$frame-name}" text:anchor-type="as-char" svg:x="{$left-value}{$Current-MeasureMark}" svg:y="{$top-value}{$Current-MeasureMark}" svg:width="{$width-value}{$Current-MeasureMark}" svg:height="{$height-value}{$Current-MeasureMark}" draw:z-index="0">
+ <draw:text-box>
+ <text:p text:style-name="Drawing">
+ <xsl:apply-templates select="w:r/w:pict | v:*">
+ <xsl:with-param name="x-scale" select="$Current-x-scale"/>
+ <xsl:with-param name="y-scale" select="$Current-y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-left" select="$left-value"/>
+ <xsl:with-param name="group-top" select="$top-value"/>
+ <xsl:with-param name="coord-left" select="$Current-coord-left"/>
+ <xsl:with-param name="coord-top" select="$Current-coord-top"/>
+ </xsl:apply-templates>
+ </text:p>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="draw:g">
+ <xsl:apply-templates select="w:r/w:pict | v:*">
+ <xsl:with-param name="x-scale" select="$Current-x-scale"/>
+ <xsl:with-param name="y-scale" select="$Current-y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-left" select="$left-value"/>
+ <xsl:with-param name="group-top" select="$top-value"/>
+ <xsl:with-param name="coord-left" select="$Current-coord-left"/>
+ <xsl:with-param name="coord-top" select="$Current-coord-top"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="v:*">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:if test="not (name() = 'v:shapetype' )">
+ <xsl:call-template name="DrawElements">
+ <xsl:with-param name="x-scale" select="$x-scale"/>
+ <xsl:with-param name="y-scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-left" select="$group-left"/>
+ <xsl:with-param name="group-top" select="$group-top"/>
+ <xsl:with-param name="coord-left" select="$coord-left"/>
+ <xsl:with-param name="coord-top" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="DrawElements">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:param name="force-draw" select="'false'"/>
+ <xsl:param name="shape-type"/>
+ <xsl:variable name="wordshapename" select="substring-after(name(),':')"/>
+ <xsl:variable name="custom_shapename">
+ <xsl:if test="$wordshapename='roundrect' ">round-rectangle</xsl:if>
+ <xsl:if test="$wordshapename='shape' and not (v:imagedata) and not (v:textbox) and @type">
+ <xsl:call-template name="ms_word_draw_map2ooo_custom_draw">
+ <xsl:with-param name="ms_word_draw_type" select="@type"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="is-image" select="$wordshapename='shape' and v:imagedata"/>
+ <xsl:variable name="element-name">
+ <xsl:choose>
+ <xsl:when test="$wordshapename='line'">draw:line</xsl:when>
+ <xsl:when test="$wordshapename='rect'">draw:rect</xsl:when>
+ <xsl:when test="$wordshapename='oval'">draw:ellipse</xsl:when>
+ <xsl:when test="$wordshapename='arc'">draw:ellipse</xsl:when>
+ <xsl:when test="$wordshapename='polyline'">draw:polyline</xsl:when>
+ <xsl:when test="$wordshapename='roundrect' ">draw:custom-shape</xsl:when>
+ <xsl:when test="$wordshapename='shape' and v:imagedata">draw:frame</xsl:when>
+ <xsl:when test="$wordshapename='shape' and not (v:imagedata) and @type">
+ <xsl:choose>
+ <xsl:when test="string-length($custom_shapename) &gt; 0">draw:custom-shape</xsl:when>
+ <xsl:when test=" string-length(@type) &gt; 0 and key('shapetype',@type)">draw:custom-shape</xsl:when>
+ <xsl:otherwise>draw:rect</xsl:otherwise>
+ <!--if nothing match it, we prefer rect-->
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$wordshapename='shape' and v:textbox">draw:frame</xsl:when>
+ <!--changed here!-->
+ <xsl:otherwise>draw:path</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="wfill" select="@fill"/>
+ <xsl:variable name="draw-kind">
+ <xsl:if test="$wordshapename='arc' and string-length($wfill) &gt; 0">arc</xsl:if>
+ <!--Means this is a Segment of Circle-->
+ </xsl:variable>
+ <!--Get the position,left,top,width,height,z-index,flip from Style-->
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="position" select="substring-before(substring-after($style,'position:'),';')"/>
+ <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/>
+ <xsl:variable name="left">
+ <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-left"/>
+ <xsl:with-param name="value2" select="$direct-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/>
+ <xsl:variable name="top">
+ <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-top"/>
+ <xsl:with-param name="value2" select="$direct-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:variable name="flip" select="substring-before(substring-after($style,'flip:'),';')"/>
+ <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/>
+ <!--these are used for wrap margins get from style-->
+ <xsl:variable name="mso-wrap-distance-lefttmp" select="substring-after($style,'mso-wrap-distance-left:')"/>
+ <xsl:variable name="mso-wrap-distance-left" select="substring-before($mso-wrap-distance-lefttmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-toptmp" select="substring-after($style,'mso-wrap-distance-top:')"/>
+ <xsl:variable name="mso-wrap-distance-top" select="substring-before($mso-wrap-distance-toptmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-righttmp" select="substring-after($style,'mso-wrap-distance-right:')"/>
+ <xsl:variable name="mso-wrap-distance-right" select="substring-before($mso-wrap-distance-righttmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-bottomtmp" select="substring-after($style,'mso-wrap-distance-bottom:')"/>
+ <xsl:variable name="mso-wrap-distance-bottom" select="substring-before($mso-wrap-distance-bottomtmp,';')"/>
+ <xsl:variable name="mso-position-horizontal-relativetmp" select="substring-after($style,'mso-position-horizontal-relative:')"/>
+ <xsl:variable name="mso-position-horizontal-relative" select="substring-before($mso-position-horizontal-relativetmp,';')"/>
+ <xsl:variable name="mso-position-vertical-relativetmp" select="substring-after($style,'mso-position-vertical-relative:')"/>
+ <xsl:variable name="mso-position-vertical-relative" select="substring-before($mso-position-vertical-relativetmp,';')"/>
+ <xsl:variable name="anchor-type">
+ <xsl:choose>
+ <xsl:when test="$mso-position-vertical-relative='page' or $mso-position-horizontal-relative = 'page'">page</xsl:when>
+ <xsl:when test="$position='absolute'">paragraph</xsl:when>
+ <xsl:otherwise>as-char</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="text-style-name">
+ <xsl:choose>
+ <xsl:when test="descendant::v:textbox">P1</xsl:when>
+ <xsl:when test="v:textpath">textpath<xsl:apply-templates mode="get-xsl-number" select="v:textpath"/>
+ </xsl:when>
+ <!--Should get the real style late-->
+ <xsl:otherwise>P1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$element-name}">
+ <xsl:if test="$element-name = 'draw:frame'">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="'frame'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$element-name ='draw:path'">
+ <xsl:choose>
+ <xsl:when test="string-length(@path) = 0">
+ <xsl:attribute name="svg:d">M 0,0 L 0,0</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="svg:d">
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$element-name ='draw:path' or $wordshapename='polyline'">
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="'0 0'"/>
+ <xsl:value-of select="' '"/>
+ <xsl:if test="string-length(@coordsize) = 0">
+ <xsl:value-of select="'1000 1000'"/>
+ </xsl:if>
+ <xsl:if test="not(string-length(@coordsize) = 0)">
+ <xsl:value-of select="translate(@coordsize,',',' ')"/>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($style,'rotation:')">
+ <xsl:attribute name="draw:transform">
+ <xsl:variable name="rotate">
+ <xsl:call-template name="convert2redian">
+ <xsl:with-param name="x" select="substring-before(substring-after($style,'rotation:') , ';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( 'rotate(' , $rotate * -1 , ')' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:anchor-type">
+ <xsl:value-of select="$anchor-type"/>
+ <!--This need to be checkout and built!-->
+ </xsl:attribute>
+ <xsl:if test="string-length($z-index) &gt; 0">
+ <xsl:if test="number($z-index) &lt; 0">
+ <xsl:attribute name="draw:z-index">
+ <xsl:value-of select="'0'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(number($z-index) &lt; 0)">
+ <xsl:attribute name="draw:z-index">
+ <xsl:value-of select="$z-index"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:attribute name="draw:style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-style-name">
+ <xsl:value-of select="$text-style-name"/>
+ <!--This is difficult!!-->
+ </xsl:attribute>
+ <xsl:if test="$wordshapename='line'">
+ <xsl:variable name="fromx" select="substring-before(@from,',')"/>
+ <xsl:variable name="fromy" select="substring-after(@from,',')"/>
+ <xsl:variable name="tox" select="substring-before(@to,',')"/>
+ <xsl:variable name="toy" select="substring-after(@to,',')"/>
+ <xsl:variable name="valfromx"> </xsl:variable>
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:attribute name="svg:x1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromx"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$tox"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$toy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <xsl:attribute name="svg:x1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromx"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$toy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$tox"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$wordshapename='rect' or $wordshapename='oval' or $wordshapename='arc' or $wordshapename='shape' or $wordshapename='polyline' or ($wordshapename='shape' and v:textbox) or ($wordshapename='roundrect' and v:textbox) ">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:attribute name="svg:width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:attribute name="svg:width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$element-name='draw:ellipse' and string-length($draw-kind) &gt; 0">
+ <xsl:attribute name="draw:kind">
+ <xsl:value-of select="$draw-kind"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--<draw:area-polygon … svg:x="0" svg:y="0" svg:width="2.0cm" svg:height="2.0cm" svg:viewBox="0 0 2000 2000" svg:points="400,1500 1600,1500 1000,400"/>
+ The element shown in the following example defines a triangle that is located in the middle of a 2cm by 2cm image. The bounding box covers an area of 2cm by 1.5cm. One view box unit corresponds to 0.01mm.-->
+ <xsl:if test="$wordshapename='polyline'">
+ <xsl:variable name="MeasureMark_Here" select="'cm'"/>
+ <!--MeasureMarkHere is cm because One view box unit corresponds to 0.01mm-->
+ <xsl:variable name="width_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="widthval">
+ <xsl:if test="contains($width_cm,'cm')">
+ <xsl:value-of select="round(substring-before($width_cm,'cm')*1000)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="heightval">
+ <xsl:if test="contains($height_cm,'cm')">
+ <xsl:value-of select="round(substring-before($height_cm,'cm')*1000)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="viewBoxstr" select="concat('0 0 ',$widthval,' ',$heightval)"/>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$viewBoxstr"/>
+ </xsl:attribute>
+ <xsl:variable name="inputx_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inputy_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inputx_val">
+ <xsl:choose>
+ <xsl:when test="contains($inputx_cm,'cm')">
+ <xsl:value-of select="substring-before($inputx_cm,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="inputy_val">
+ <xsl:choose>
+ <xsl:when test="contains($inputy_cm,'cm')">
+ <xsl:value-of select="substring-before($inputy_cm,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="inputboxwidth" select="$widthval"/>
+ <xsl:variable name="oopoints">
+ <xsl:call-template name="wordpoints2oopoints">
+ <xsl:with-param name="input_x" select="$inputx_val"/>
+ <xsl:with-param name="input_y" select="$inputy_val"/>
+ <xsl:with-param name="input_width" select="$width"/>
+ <xsl:with-param name="input_height" select="$height"/>
+ <xsl:with-param name="input_boxwidth" select="$widthval"/>
+ <xsl:with-param name="input_boxheight" select="$heightval"/>
+ <xsl:with-param name="input_points" select="concat(@points,',')"/>
+ <!-- add a space to the end of input_points -->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($oopoints) &gt; 0">
+ <xsl:attribute name="draw:points">
+ <xsl:value-of select="$oopoints"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$is-image">
+ <xsl:variable name="the-image" select="key('imagedata',v:imagedata/@src)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(v:imagedata/@o:title) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="v:imagedata/@o:title"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string-length(parent::w:pict/o:OLEObject/@ObjectID) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="parent::w:pict/o:OLEObject/@ObjectID"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="parent::w:pict/o:OLEObject" mode="output"/>
+ <draw:image>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="translate($the-image/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </xsl:element>
+ </draw:image>
+ </xsl:if>
+ <xsl:if test="$element-name = 'draw:custom-shape'">
+ <xsl:apply-templates select="v:textpath" mode="text-p">
+ <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/>
+ </xsl:apply-templates>
+ <xsl:element name="draw:enhanced-geometry">
+ <xsl:variable name="enhanced_path">
+ <!--enhanced_path call a template to get the enhanced-path-->
+ <xsl:choose>
+ <xsl:when test="string-length($custom_shapename) = 0">
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <!--####notice that:there is some drawing elements that don't have the shapetype so that can not have a viewbox
+ It is a ****problem**** now-so be sure to check it out.-->
+ <xsl:if test="$wordshapename='roundrect' ">
+ <xsl:variable name="tmp_MeasueMark">
+ <xsl:value-of select="'cm'"/>
+ </xsl:variable>
+ <xsl:variable name="svg_viewwidth">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="svg_viewheight">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="svg_viewBox">
+ <xsl:value-of select="concat( '0 0 ',substring-before($svg_viewwidth,$tmp_MeasueMark)*10000,' ',substring-before($svg_viewheight,$tmp_MeasueMark)*10000)"/>
+ </xsl:variable>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$svg_viewBox"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($custom_shapename) &gt; 0">
+ <xsl:attribute name="draw:type">
+ <xsl:value-of select="$custom_shapename"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($enhanced_path) &gt; 0">
+ <xsl:attribute name="draw:enhanced-path">
+ <xsl:value-of select="$enhanced_path"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="typeid_adj">
+ <!--for fix the bug of version 1.63: the following discription: adj="-11796480,,5400" in OOo should be: modifier =" -11796480 0 5400"-->
+ <xsl:variable name="tmp_adj">
+ <xsl:value-of select="key('shapetype',@type)/@adj"/>
+ </xsl:variable>
+ <xsl:if test="contains($tmp_adj, ',') ">
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate($tmp_adj,'+-0123456789 ','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_non_omit_adj">
+ <xsl:with-param name="adj_typeid" select="$tmp_adj"/>
+ <xsl:with-param name="num" select="$number"/>
+ <xsl:with-param name="mark" select="',' "/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains($tmp_adj, ',') )">
+ <xsl:value-of select="$tmp_adj"/>
+ </xsl:if>
+ </xsl:variable>
+ <!--the following choose statement code will process the revised modifier
+ It happens that if a drawing elements has more than 2 modifier, the modifier (or say adj
+ in wordml) can be adjusted and only the modified adj is recorded.
+ what makes it more compicated is that adj support both comma and blanks.
+ so you have to use kickblanks template to kick the blanks and change it to comma version.
+ <key('shapetype',@type)/v:textpath[1]-->
+ <xsl:choose>
+ <xsl:when test="string-length($typeid_adj) = 0">
+ <xsl:if test="contains(@adj,',')">
+ <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient.
+ -####Note that comma cann't be recognized by OOo's modifiers
+ <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/>
+ <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/>
+ <xsl:variable name="adjuststr">
+ <xsl:if test="$adjust-x and $adjust-y">
+ -####Note that comma cann't be recognized by OOo's modifiers->
+ <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/>
+ </xsl:if>
+ </xsl:variable>-->
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(@adj ,',' ,' ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@adj and not(contains(@adj,','))">
+ <!--####Note that comma cann't be recognized by OOo's modifiers.-->
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="@adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--Means that you have to care about 2 adj parameters which is defferent-->
+ <xsl:variable name="mark_used_by_typeid">
+ <xsl:if test="contains($typeid_adj, ',' )">
+ <xsl:value-of select="',' "/>
+ </xsl:if>
+ <xsl:if test="not (contains( $typeid_adj, ',' ) ) ">
+ <xsl:value-of select="' ' "/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@adj">
+ <xsl:variable name="remained_adj">
+ <xsl:if test="contains(@adj,',' ) ">
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate(@adj,'+-0123456789 ','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="$typeid_adj"/>
+ <xsl:with-param name="num" select="$number+1"/>
+ <xsl:with-param name="mark" select="$mark_used_by_typeid"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains(@adj,',' ) ) ">
+ <xsl:variable name="tmp_str_adj">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="concat(' ' ,@adj,' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate($tmp_str_adj,'+-0123456789','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="$typeid_adj"/>
+ <xsl:with-param name="num" select="$number - 1"/>
+ <xsl:with-param name="mark" select="$mark_used_by_typeid "/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(concat(@adj ,',' ,$remained_adj), ',' ,' ' )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="contains($typeid_adj,',')">
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate($typeid_adj ,',' ,' ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(contains($typeid_adj,','))">
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="$typeid_adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@type">
+ <xsl:apply-templates select="v:textpath" mode="output">
+ <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="key('shapetype',@type)" mode="output">
+ <xsl:with-param name="instance" select="."/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$wordshapename='shape' and v:textbox and $element-name='draw:frame' ">
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:element>
+ </xsl:when>
+ <!--It is a case statement for all shapes,so we add v:roundrect here.-->
+ <xsl:when test="$wordshapename='roundrect' and v:textbox and $element-name='draw:frame' ">
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="v:textbox">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:docOleData" mode="init">
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:init')">
+ <oleextracter:init UNOURL="uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="w:binData[@w:name='oledata.mso']" mode="oledata.mso"/>
+ </xsl:template>
+ <xsl:template match="w:docOleData" mode="exit">
+ <oleextracter:exit/>
+ </xsl:template>
+ <xsl:template match="w:binData" mode="oledata.mso">
+ <!-- <xsl:choose>
+ <xsl:when test="element-available('oleextracter:getByName')">
+ <xsl:variable name="tmp" select="oleextracter:insertByName('oledata.mso', translate(text(),'&#10;&#13;&#32;','' ) )"/>
+ </xsl:when>
+ <xsl:otherwise>-->
+ <xsl:variable name="tmp" select="ole:insertByName($oleExtractor,'oledata.mso', translate(text(),'&#10;&#13;&#32;','' ) )"/>
+ <!-- </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:template>
+ <xsl:template match="o:OLEObject " mode="output">
+ <!-- depends on i43230,we can uncomment this code or find another way after i43230 got fixed -->
+ <draw:object-ole>
+ <xsl:element name="office:binary-data">
+ <!--
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:getByName')">
+ <xsl:value-of select="translate(oleextracter:getByName(@ObjectID),'&#13;','')"/>
+ </xsl:when>
+ <xsl:otherwise> -->
+ <xsl:value-of select="translate(ole:getByName($oleExtractor,@ObjectID),'&#13;','')"/>
+ <!--
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:element>
+ </draw:object-ole>
+ </xsl:template>
+ <xsl:template name="get-vml-value">
+ <xsl:param name="node1" select="''"/>
+ <xsl:param name="property-name"/>
+ <xsl:variable name="pn" select="concat(';',$property-name, ':')"/>
+ <xsl:choose>
+ <xsl:when test="string-length(@*[name() = $property-name]) &gt; 0">
+ <xsl:value-of select="@*[name() = $property-name]"/>
+ </xsl:when>
+ <xsl:when test="string-length(@style) &gt; 0 and contains(concat(';',translate(@style,' ','')),$pn)">
+ <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/>
+ </xsl:when>
+ <xsl:when test="$node1 and string-length($node1/@*[name() = $property-name]) &gt; 0">
+ <xsl:value-of select="$node1/@*[name() = $property-name]"/>
+ </xsl:when>
+ <xsl:when test="$node1 and string-length($node1/@style) &gt; 0 and contains(concat(';',translate($node1/@style,' ','')),$pn)">
+ <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="text-p">
+ <xsl:param name="type-textpath" select="''"/>
+ <xsl:variable name="the-string">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'string'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="style-name">
+ <xsl:value-of select="'textpath'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:variable>
+ <text:p text:style-name="{$style-name}">
+ <xsl:value-of select="$the-string"/>
+ </text:p>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="style">
+ <xsl:if test="contains(@style,'font-family:')">
+ <xsl:variable name="style-name">
+ <xsl:value-of select="'textpath'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="font-family">
+ <!-- we need remove the addtional &quot; from font-family -->
+ <xsl:value-of select="translate(substring-before(substring-after(@style,'font-family:'),';'), '&quot;' ,'')"/>
+ </xsl:variable>
+ <xsl:variable name="font-size">
+ <xsl:choose>
+ <xsl:when test="contains(@style,'font-size:')">
+ <xsl:value-of select="substring-before(substring-after(@style,'font-size:'),';')"/>
+ </xsl:when>
+ <xsl:otherwise>36pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <style:style style:name="{$style-name}" style:family="paragraph">
+ <style:paragraph-properties text:enable-numbering="false" style:writing-mode="lr-tb"/>
+ <style:text-properties fo:font-family="{$font-family}" fo:font-size="{$font-size}" style:font-family-generic="roman" style:text-scale="80%"/>
+ </style:style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="output">
+ <xsl:param name="type-textpath" select="''"/>
+ <xsl:variable name="on">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'on'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="starts-with($on,'t')">
+ <xsl:attribute name="draw:text-path">true</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="fitshape">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'fitshape'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="fitpath">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'fitpath'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="draw:type">fontwork-plain-text</xsl:attribute>
+ <xsl:attribute name="draw:text-path-mode">
+ <xsl:choose>
+ <xsl:when test="starts-with($fitpath,'t') ">path</xsl:when>
+ <xsl:when test="starts-with($fitshape,'t') ">shape</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-path-scale">path</xsl:attribute>
+ <!-- xsl:attribute name="draw:text-path-same-letter-heights">false</xsl:attribute -->
+ <!-- xsl:attribute name="draw:text-path-scale-x">false</xsl:attribute -->
+ </xsl:template>
+ <xsl:template match="v:shapetype" mode="output">
+ <xsl:param name="instance" select="''"/>
+ <!--#Dummy after version 1.63 The following test is for the adj attribute of the file. It is Dummy now.
+ <xsl:if test="not($instance/@adj)">
+ <xsl:if test="contains(@adj,',')">-->
+ <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient.
+ -####Note that comma cann't be recognized by OOo's modifiers
+ <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/>
+ <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/>
+ <xsl:variable name="adjuststr">
+ <xsl:if test="$adjust-x and $adjust-y">
+ < -####Note that comma cann't be recognized by OOo's modifiers.->
+ <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/>
+ </xsl:if>
+ </xsl:variable>-->
+ <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(@adj, ',' , ' ' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@adj and not(contains(@adj,','))">-->
+ <!--####Note that comma cann't be recognized by OOo's modifiers.-->
+ <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="@adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>-->
+ <xsl:variable name="viewbox">
+ <xsl:value-of select="'0 0'"/>
+ <xsl:value-of select="' '"/>
+ <xsl:if test="string-length(@coordsize) = 0">
+ <xsl:value-of select="'1000 1000'"/>
+ </xsl:if>
+ <xsl:if test="not(string-length(@coordsize) = 0)">
+ <xsl:value-of select="translate(@coordsize,',',' ')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$viewbox"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-areas">
+ <xsl:value-of select="$viewbox"/>
+ </xsl:attribute>
+ <!-- This path need be output is instance does not have a path-->
+ <xsl:if test="not($instance/@path) and string-length(@path) &gt;0">
+ <xsl:attribute name="draw:enhanced-path">
+ <!--<xsl:call-template name="vmlpath2svgpath">rrrrrrevised-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="v:formulas | v:handles" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:formulas" mode="output">
+ <xsl:apply-templates select="v:f" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:f" mode="output">
+ <xsl:element name="draw:equation">
+ <xsl:attribute name="draw:formula">
+ <xsl:call-template name="v-formula2o-formula">
+ <xsl:with-param name="v-formula" select="@eqn"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="'f'"/>
+ <xsl:variable name="the-number">
+ <xsl:number format="1" level="single"/>
+ </xsl:variable>
+ <xsl:value-of select="$the-number - 1"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="v-formula2o-formula">
+ <xsl:param name="v-formula"/>
+ <xsl:variable name="command" select="substring-before(normalize-space($v-formula), ' ')"/>
+ <xsl:variable name="tmp" select="normalize-space(substring-after($v-formula, $command ))"/>
+ <xsl:variable name="step1">
+ <xsl:choose>
+ <xsl:when test="$command ='val'">
+ <xsl:value-of select="$tmp"/>
+ </xsl:when>
+ <!-- (sum a b c) = (a + b - c)-->
+ <xsl:when test="$command = 'sum' ">
+ <xsl:call-template name="replace-space">
+ <xsl:with-param name="value" select="$tmp"/>
+ <xsl:with-param name="replace1" select="'+'"/>
+ <xsl:with-param name="replace2" select="'-'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- (prod a b c) = (a * b / c)-->
+ <xsl:when test="$command = 'prod'">
+ <xsl:call-template name="replace-space">
+ <xsl:with-param name="value" select="$tmp"/>
+ <xsl:with-param name="replace1" select="'*'"/>
+ <xsl:with-param name="replace2" select="'/'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- (mid a b) = ((a + b) / 2)-->
+ <xsl:when test="$command = 'mid'">
+ <xsl:value-of select="concat('(' , translate($tmp,' ', '+') , ') / 2' )"/>
+ </xsl:when>
+ <!-- (if a b c) = (a>0? b : c) Conditional testing. -->
+ <xsl:when test="$command = 'if' ">
+ <xsl:value-of select="concat('if(' , translate($tmp,' ', ',') , ')' )"/>
+ </xsl:when>
+ <!-- (min a b) = (min (a , b) )-->
+ <!-- (max a b) = (max (a , b) )-->
+ <xsl:when test="$command = 'min' or $command = 'max'">
+ <xsl:value-of select="concat($command, '(' , translate($tmp,' ', ',') , ')' )"/>
+ </xsl:when>
+ <xsl:when test="$command = 'abs' or $command = 'sqrt'">
+ <xsl:value-of select="concat($command, '(' , $tmp , ')' )"/>
+ </xsl:when>
+ <!-- sin(a,b) = a*sin(b) -->
+ <xsl:when test="$command = 'sin' or $command = 'cos' or $command = 'tan' ">
+ <!-- atan is not this kind 2 $command = 'atan2' "-->
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( $value1 , ' * ' , $command, '(' , $value2 , ')' )"/>
+ </xsl:when>
+ <!-- -->
+ <xsl:when test="$command = 'atan2' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( $command , '( ' , $value2, ',' , $value1 , ')' )"/>
+ </xsl:when>
+ <!-- -->
+ <!--><xsl:when test="$command = 'atan2' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( 'atan' , '( ' , $value2, '/' , $value1 , ')' )"/>
+ </xsl:when><- -->
+ <!-- ellipse and sumangle are always used by arc commans like this
+ eqn="ellipse @24 @4 height" ; and eqn="sumangle @2 360 0"
+ mod is always used too.-->
+ <!--mod =sqrt( v*v + P1×P1 + P2×P2). ( 3 parameters )-->
+ <xsl:when test="$command='mod' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( 'sqrt( ' , $value3, ' * ',$value3, ' + ' ,$value2, ' * ' ,$value2, ' + ' ,$value1, ' * ', $value1, ' )' )"/>
+ </xsl:when>
+ <!--ellipse= P2* sqrt(1 - v*v /P1*P1) ( 3 parameters )-->
+ <xsl:when test="$command='ellipse' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value3 , ' * sqrt( ' , $value2 , ' * ' , $value2, ' - ',$value1 , ' * ', $value1, ' )' ,'/',$value2 )"/>
+ </xsl:when>
+ <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )-->
+ <!--<xsl:when test="$command='sumangle' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value1 , '+' , $value2 , ' * ' , '65535',' + ', $value2,' - ' ,$value3 , ' * ', '65535', ' - ', $value3)"/>
+ </xsl:when>-->
+ <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )-->
+ <xsl:when test="$command='sumangle' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value1 , '+' , $value2 , '*pi/180',' - ' ,$value3 , '*pi/180' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>Find a unsupported formule:<xsl:value-of select="$v-formula"/>
+ </xsl:message>
+ <!--<xsl:value-of select="'0'"/><-for release use-->
+ <xsl:value-of select="concat('not found this:', $v-formula)"/>
+ <!--for Debug use-->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="step2">
+ <xsl:value-of select="translate($step1,'#','$')"/>
+ </xsl:variable>
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="$step2"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="replace-space">
+ <xsl:param name="value"/>
+ <xsl:param name="replace1"/>
+ <xsl:param name="replace2"/>
+ <xsl:value-of select=" concat( substring-before($value,' ') , $replace1, translate(substring-after($value,' '), ' ', $replace2 ) ) "/>
+ </xsl:template>
+ <xsl:template name="replace-at">
+ <xsl:param name="value"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:choose>
+ <xsl:when test="string-length($value) &lt; $position">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="substring($value,$position,1) = '@'">
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="concat(substring($value,1,$position -1) , '?f' , substring($value,$position+1)) "/>
+ <xsl:with-param name="position" select="$position + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="$value"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test=" substring($value,$position,1) = '@'">
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="v:handles" mode="output">
+ <xsl:apply-templates select="v:h" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:h" mode="output">
+ <xsl:element name="draw:handle">
+ <xsl:if test="@position">
+ <xsl:attribute name="draw:handle-position">
+ <xsl:value-of select="translate(@position,'#,' , '$ ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@switch">
+ <xsl:attribute name="draw:handle-switched">
+ <xsl:value-of select="@switch"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@xrange">
+ <xsl:attribute name="draw:handle-range-x-maximum">
+ <xsl:value-of select="substring-after(@xrange,',')"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:handle-range-x-minimum">
+ <xsl:value-of select="substring-before(@xrange,',')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@yrange">
+ <xsl:attribute name="draw:handle-range-y-maximum">
+ <xsl:value-of select="substring-after(@yrange,',')"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:handle-range-y-minimum">
+ <xsl:value-of select="substring-before(@yrange,',')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!--this template map word's points to svg:viewbox's point they are quite differect because word's use pt but svg's use 0.001cm as a unit-->
+ <xsl:template name="wordpoints2oopoints">
+ <xsl:param name="input_points"/>
+ <xsl:param name="input_x"/>
+ <xsl:param name="input_y"/>
+ <xsl:param name="input_width"/>
+ <xsl:param name="input_height"/>
+ <xsl:param name="input_boxwidth"/>
+ <xsl:param name="input_boxheight"/>
+ <xsl:variable name="ptx" select="substring-before($input_points,',')"/>
+ <xsl:variable name="tempstr" select="substring-after($input_points,',')"/>
+ <xsl:variable name="pty" select="substring-before($tempstr,',')"/>
+ <xsl:variable name="nextinput" select="substring-after ($tempstr,',')"/>
+ <xsl:if test="$ptx and $pty">
+ <xsl:variable name="val_ptx">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$ptx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="val_pty">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$pty"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round( $input_boxwidth - ( $val_ptx - $input_x ) * 1000 )"/>
+ <xsl:value-of select="','"/>
+ <xsl:value-of select="round( ( $val_pty - $input_y ) * 1000 )"/>
+ </xsl:if>
+ <xsl:if test="contains($nextinput,',')">
+ <xsl:value-of select="' '"/>
+ <!--Leave a blank first as mark of points group-->
+ <xsl:call-template name="wordpoints2oopoints">
+ <xsl:with-param name="input_points" select="$nextinput"/>
+ <xsl:with-param name="input_x" select="$input_x"/>
+ <xsl:with-param name="input_y" select="$input_y"/>
+ <xsl:with-param name="input_width" select="$input_width"/>
+ <xsl:with-param name="input_height" select="$input_height"/>
+ <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/>
+ <xsl:with-param name="input_boxheight" select="$input_boxheight"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!--template MapConstColor:input is a color in form of const e.g 'red' or number e.g '#ff0010' output is a number color-->
+ <xsl:template name="MapConstColor">
+ <xsl:param name="color"/>
+ <xsl:choose>
+ <xsl:when test="$color='black'">#000000</xsl:when>
+ <xsl:when test="$color='olive'">#808000</xsl:when>
+ <xsl:when test="$color='red'">#ff0000</xsl:when>
+ <xsl:when test="$color='teal'">#008080</xsl:when>
+ <xsl:when test="$color='green'">#00ff00</xsl:when>
+ <xsl:when test="$color='gray'">#808080</xsl:when>
+ <xsl:when test="$color='blue'">#0000ff</xsl:when>
+ <xsl:when test="$color='navy'">#000080</xsl:when>
+ <xsl:when test="$color='white'">#ffffff</xsl:when>
+ <xsl:when test="$color='lime'">#00ff00</xsl:when>
+ <xsl:when test="$color='yellow'">#ffff00</xsl:when>
+ <xsl:when test="$color='fuchsia'">#ff00ff</xsl:when>
+ <xsl:when test="$color='purple'">#800080</xsl:when>
+ <xsl:when test="$color='aqua'">#00ffff</xsl:when>
+ <xsl:when test="$color='maroon'">#800000</xsl:when>
+ <xsl:when test="$color='silver'">#c0c0c0</xsl:when>
+ <xsl:when test="$color='window'">#ffffff</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="string-length($color) =7">
+ <xsl:value-of select="$color"/>
+ </xsl:when>
+ <xsl:when test="string-length($color) =4">
+ <!--short form representation of color-->
+ <xsl:variable name="valr">
+ <xsl:value-of select="concat(substring($color,2,1),substring($color,2,1))"/>
+ <!--<xsl:call-template name="shortcolorconv"><xsl:with-param name="value" select="substring($color,2,1)"/></xsl:call-template>-->
+ </xsl:variable>
+ <xsl:variable name="valg" select="concat(substring($color,3,1),substring($color,3,1))"/>
+ <xsl:variable name="valb" select="concat(substring($color,4,1),substring($color,4,1))"/>
+ <xsl:value-of select="concat('#',$valr,$valg,$valb)"/>
+ </xsl:when>
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="shortcolorconv">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="$value='1'">11</xsl:when>
+ <xsl:when test="$value='2'">22</xsl:when>
+ <xsl:when test="$value='3'">33</xsl:when>
+ <xsl:when test="$value='4'">44</xsl:when>
+ <xsl:when test="$value='5'">55</xsl:when>
+ <xsl:when test="$value='6'">66</xsl:when>
+ <xsl:when test="$value='7'">77</xsl:when>
+ <xsl:when test="$value='8'">88</xsl:when>
+ <xsl:when test="$value='9'">99</xsl:when>
+ <xsl:when test="$value='a'">aa</xsl:when>
+ <xsl:when test="$value='b'">bb</xsl:when>
+ <xsl:when test="$value='c'">cc</xsl:when>
+ <xsl:when test="$value='d'">dd</xsl:when>
+ <xsl:when test="$value='e'">ee</xsl:when>
+ <xsl:when test="$value='f'">ff</xsl:when>
+ <!--I just guess it, maybe it is not right-->
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="MapArrowStyle">
+ <!--What is a block?normal arrow?-->
+ <xsl:param name="arrow-name"/>
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'Block' ">Arrow</xsl:when>
+ <xsl:when test="$arrow-name = 'Diamond' ">Square</xsl:when>
+ <xsl:when test="$arrow-name = 'Open' ">Line Arrow</xsl:when>
+ <xsl:when test="$arrow-name = 'Oval' ">Circle</xsl:when>
+ <xsl:when test="$arrow-name = 'Diamond' ">Square 45</xsl:when>
+ <xsl:when test="$arrow-name = 'Classic' ">Arrow concave</xsl:when>
+ <xsl:otherwise>Arrow</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Add-with-Measure">
+ <xsl:param name="value1"/>
+ <xsl:param name="value2"/>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($value1 ,'-.0123456789 ','' )) &gt; 0">
+ <xsl:value-of select="translate($value1 ,'-.0123456789 ','' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($value2 ,'-.0123456789 ','' )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-value1">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number-value2">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( $number-value1 + $number-value2 , $Current-MeasureMark)"/>
+ </xsl:template>
+ <xsl:template name="convert-with-scale-and-measure">
+ <xsl:param name="value"/>
+ <xsl:param name="group-value" select="0"/>
+ <xsl:param name="coord-value" select="0"/>
+ <xsl:param name="scale" select="1"/>
+ <xsl:param name="MeasureMark" select="''"/>
+ <xsl:param name="Target-Measure" select="''"/>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="not (translate($value ,'-. 0123456789 ','' ) = '') ">
+ <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/>
+ </xsl:when>
+ <xsl:when test="string-length($MeasureMark) &gt; 0">
+ <xsl:value-of select="$MeasureMark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-value">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="value-string" select="( $number-value - $coord-value) div $scale + $group-value"/>
+ <xsl:choose>
+ <xsl:when test="$value-string = 0">0cm</xsl:when>
+ <xsl:when test="$Target-Measure = $Current-MeasureMark">
+ <xsl:value-of select="concat($value-string , $Current-MeasureMark)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat($value-string , $Current-MeasureMark)"/>
+ </xsl:call-template>
+ <xsl:value-of select=" 'cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') = '' ">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',''))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xalan:component prefix="oleextracter" elements="init exit" functions="getByName insertByName">
+ <xalan:script lang="javaclass" src="xalan://XSLTFilterOLEExtracter"/>
+ </xalan:component>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_field.xsl b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl
new file mode 100644
index 000000000000..ca26a0cb54bc
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl
@@ -0,0 +1,1591 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_field.xsl,v $
+
+ $Revision: 1.7 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt fo v">
+ <!--Generally, The MS fields can be represented in two forms, simple field w:fldsimple or complicated field
+ w:fldChar, so when importing we have to take care of two possible forms of the same type field -->
+ <xsl:template match="w:instrText">
+ <!-- ===this template is to process the w:fldChar fields ====== -->
+ <xsl:choose>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'PAGEREF' ">
+ <xsl:variable name="bookmarkname">
+ <xsl:value-of select="normalize-space(substring-before (substring-after( . , 'PAGEREF' ), '\*')) "/>
+ </xsl:variable>
+ <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(.),1,9) = 'HYPERLINK' ">
+ <xsl:variable name="hyper-str" select="normalize-space(.)"/>
+ <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '&quot;')"/>
+ <xsl:variable name="hyper-bookmark">
+ <xsl:if test="contains( $hyper-str, ' \l ')">
+ <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '&quot;'), '&quot;') )"/>
+ </xsl:if>
+ </xsl:variable>
+ <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:a>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(.),1,3) = 'REF' ">
+ <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(text(), 'REF') , '\') )}">
+
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' ">
+ <text:date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,9) = 'PRINTDATE' ">
+ <text:print-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:print-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,10) = 'CREATEDATE' ">
+ <text:creation-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:creation-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'SAVEDATE' ">
+ <text:modification-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:modification-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'PAGE' ">
+ <text:page-number text:select-page="current">
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMPAGES' ">
+ <text:page-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMWORDS' ">
+ <text:word-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:word-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMCHARS' ">
+ <text:character-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:character-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'REVNUM' ">
+ <text:editing-cycles>
+ <xsl:value-of select="w:r"/>
+ </text:editing-cycles>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,3) = 'SEQ' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:variable name="seq_text_name">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(text(), 'SEQ'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name"/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'AUTHOR' ">
+ <text:initial-creator>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:initial-creator>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,5) = 'TITLE' ">
+ <text:title>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:title>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'SUBJECT' ">
+ <text:subject>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:subject>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'KEYWORDS' ">
+ <text:keywords>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:keywords>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'FILLIN' ">
+ <text:text-input>
+ <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(text(), 'FILLIN'), '\*')"/></xsl:attribute>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:text-input>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,11) = 'DOCPROPERTY' ">
+ <xsl:variable name="instr_command">
+ <xsl:value-of select="normalize-space (substring-after(text(), 'DOCPROPERTY' ))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($instr_command, 'Author' ) ">
+ <text:user-field-get text:name="Author">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Bytes' ) ">
+ <text:user-field-get text:name="Bytes">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) ">
+ <text:user-field-get text:name="CharactersWithSpaces">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Category' ) ">
+ <text:user-field-get text:name="Category">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Characters' ) ">
+ <text:user-field-get text:name="Characters">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Comments' ) ">
+ <text:user-field-get text:name="Comments">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Company' ) ">
+ <text:user-field-get text:name="Company">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CreateTime' ) ">
+ <text:user-field-get text:name="CreateTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'HyperlinkBase' ) ">
+ <text:user-field-get text:name="HyperlinkBase">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Keywords' ) ">
+ <text:user-field-get text:name="Keywords">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastPrinted' ) ">
+ <text:user-field-get text:name="LastPrinted">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedBy' ) ">
+ <text:user-field-get text:name="LastSavedBy">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedTime' ) ">
+ <text:user-field-get text:name="LastSavedTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Lines' ) ">
+ <text:user-field-get text:name="Lines">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Manager' ) ">
+ <text:user-field-get text:name="Manager">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'NameofApplication' ) ">
+ <text:user-field-get text:name="NameofApplication">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'ODMADocId' ) ">
+ <text:user-field-get text:name="ODMADocId">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Pages' ) ">
+ <text:user-field-get text:name="Pages">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Paragraphs' ) ">
+ <text:user-field-get text:name="Paragraphs">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'RevisionNumber' ) ">
+ <text:user-field-get text:name="RevisionNumber">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Security' ) ">
+ <text:user-field-get text:name="Security">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Subject' ) ">
+ <text:user-field-get text:name="Subject">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Template' ) ">
+ <text:user-field-get text:name="Template">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Title' ) ">
+ <text:user-field-get text:name="Title">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'TotalEditingTime' ) ">
+ <text:user-field-get text:name="TotalEditingTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Words' ) ">
+ <text:user-field-get text:name="Words">
+ </text:user-field-get>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,10) = 'MERGEFIELD' ">
+ <text:database-display text:database-name="" text:table-name="" text:table-type="table">
+ <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:database-display>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'MERGEREC' ">
+ <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:database-row-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'NEXT' ">
+ <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition="">
+ </text:database-next>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:fldChar">
+ <!-- for complicated field w:fldChar, we only process the w:instrText, please see the template processing w:instrText -->
+ </xsl:template>
+ <xsl:template name="get-fldchar-content">
+ <!-- this template is to get the content of fldchar in-between w:instrText and w:fldChar/@w:fldCharType ='end' -->
+ <xsl:param name="next_node"/>
+ <xsl:param name="sibling_number"/>
+ <xsl:if test="not ($next_node/w:fldChar/@w:fldCharType ='end' ) and $next_node ">
+ <xsl:if test="$next_node/w:br">
+ <xsl:text>&#x0A;</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="$next_node//w:t"/>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[$sibling_number + 1]"/>
+ <xsl:with-param name="sibling_number" select="$sibling_number + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- ====== this template is to process the w:fldsimple fields ======= -->
+ <xsl:template match="w:fldSimple">
+ <xsl:choose>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'PAGEREF' ">
+ <xsl:variable name="bookmarkname">
+ <xsl:value-of select="normalize-space(substring-before (substring-after( @w:instr , 'PAGEREF' ), '\*')) "/>
+ </xsl:variable>
+ <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}">
+ <xsl:value-of select=" .//w:t"/>
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(@w:instr),1,9) = 'HYPERLINK' ">
+ <xsl:variable name="hyper-str" select="normalize-space(@w:instr)"/>
+ <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '&quot;')"/>
+ <xsl:variable name="hyper-bookmark">
+ <xsl:if test="contains( $hyper-str, ' \l ')">
+ <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '&quot;'), '&quot;') )"/>
+ </xsl:if>
+ </xsl:variable>
+ <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}">
+ <xsl:value-of select=" .//w:t"/>
+ </text:a>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(@w:instr),1,3) = 'REF' ">
+ <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(@w:instr, 'REF') , '\') )}">
+
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' ">
+ <text:date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' ">
+ <text:print-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:print-date>
+ </xsl:when>
+ <xsl:when test=" substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' ">
+ <text:creation-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:creation-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' ">
+ <text:modification-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:modification-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'PAGE' ">
+ <text:page-number text:select-page="current">
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMPAGES' ">
+ <text:page-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMWORDS' ">
+ <text:word-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:word-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMCHARS' ">
+ <text:character-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:character-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'REVNUM' ">
+ <text:editing-cycles>
+ <xsl:value-of select="w:r"/>
+ </text:editing-cycles>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'AUTONUM' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMLGL' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMOUT' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,3) = 'SEQ' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:variable name="seq_text_name">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(@w:instr, 'SEQ'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'AUTHOR' ">
+ <text:initial-creator>
+ <xsl:value-of select=" .//w:t"/>
+ </text:initial-creator>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,5) = 'TITLE' ">
+ <text:title>
+ <xsl:value-of select=" .//w:t"/>
+ </text:title>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'SUBJECT' ">
+ <text:subject>
+ <xsl:value-of select=" .//w:t"/>
+ </text:subject>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'KEYWORDS' ">
+ <text:keywords>
+ <xsl:value-of select=" .//w:t"/>
+ </text:keywords>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'FILLIN' ">
+ <text:text-input>
+ <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(@w:instr, '&quot;'), '&quot;')"/></xsl:attribute>
+ <xsl:value-of select=" .//w:t"/>
+ </text:text-input>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ">
+ <xsl:variable name="instr_command">
+ <xsl:value-of select="normalize-space (substring-after(@w:instr, 'DOCPROPERTY' ))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($instr_command, 'Author' ) ">
+ <text:user-field-get text:name="Author">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Bytes' ) ">
+ <text:user-field-get text:name="Bytes">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Category' ) ">
+ <text:user-field-get text:name="Category">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) ">
+ <text:user-field-get text:name="CharactersWithSpaces">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Characters' ) ">
+ <text:user-field-get text:name="Characters">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Comments' ) ">
+ <text:user-field-get text:name="Comments">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Company' ) ">
+ <text:user-field-get text:name="Company">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CreateTime' ) ">
+ <text:user-field-get text:name="CreateTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'HyperlinkBase' ) ">
+ <text:user-field-get text:name="HyperlinkBase">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Keywords' ) ">
+ <text:user-field-get text:name="Keywords">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastPrinted' ) ">
+ <text:user-field-get text:name="LastPrinted">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedBy' ) ">
+ <text:user-field-get text:name="LastSavedBy">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedTime' ) ">
+ <text:user-field-get text:name="LastSavedTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Lines' ) ">
+ <text:user-field-get text:name="Lines">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Manager' ) ">
+ <text:user-field-get text:name="Manager">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'NameofApplication' ) ">
+ <text:user-field-get text:name="NameofApplication">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'ODMADocId' ) ">
+ <text:user-field-get text:name="ODMADocId">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Pages' ) ">
+ <text:user-field-get text:name="Pages">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Paragraphs' ) ">
+ <text:user-field-get text:name="Paragraphs">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'RevisionNumber' ) ">
+ <text:user-field-get text:name="RevisionNumber">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Security' ) ">
+ <text:user-field-get text:name="Security">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Subject' ) ">
+ <text:user-field-get text:name="Subject">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Template' ) ">
+ <text:user-field-get text:name="Template">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Title' ) ">
+ <text:user-field-get text:name="Title">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'TotalEditingTime' ) ">
+ <text:user-field-get text:name="TotalEditingTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Words' ) ">
+ <text:user-field-get text:name="Words">
+ </text:user-field-get>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,10) = 'MERGEFIELD' ">
+ <text:database-display text:database-name="" text:table-name="" text:table-type="table">
+ <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute>
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-display>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'MERGEREC' ">
+ <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0">
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-row-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'NEXT' ">
+ <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition="">
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-next>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- for MS simple fields that can not map to OOo writer fields, we just import the content of these fields -->
+ <xsl:value-of select="w:r"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get_seq_name">
+ <!-- this template is to get the identifier from the input MS seq string -->
+ <xsl:param name="input_seq_string"/>
+ <xsl:choose>
+ <xsl:when test="contains( $input_seq_string, ' ' )">
+ <xsl:value-of select="substring-before($input_seq_string, ' ' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$input_seq_string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="default_seqence_declaration">
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="AutoNr">
+ </text:sequence-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="sequence_declare">
+ <text:sequence-decl text:display-outline-level="0">
+ <xsl:variable name="seq_variable_name">
+ <xsl:choose>
+ <xsl:when test=" name() = 'w:instrText' ">
+ <xsl:if test="substring(normalize-space(text()),1,3) = 'SEQ' ">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(text(), 'SEQ' ))"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test=" name() = 'w:fldSimple' ">
+ <xsl:if test="substring(normalize-space(@w:instr),1,3) = 'SEQ' ">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(@w:instr, 'SEQ' ))"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_variable_name"/></xsl:attribute>
+ </text:sequence-decl>
+ </xsl:template>
+ <!-- ===== the following templates are to generate the user fields declarations for MS word DocProperty field importing == -->
+ <xsl:template name="user_fields_declare_docproperty">
+ <xsl:variable name="document-field-root" select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,11) = 'DOCPROPERTY' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ] "/>
+ <xsl:variable name="field_Author_nodeset" select="$document-field-root[contains(text(), 'Author')] | $document-field-root[contains(@w:instr, 'Author')]"/>
+ <xsl:variable name="field_Bytes_nodeset" select="$document-field-root[contains(text(), 'Bytes')] | $document-field-root[contains(@w:instr, 'Bytes')]"/>
+ <xsl:variable name="field_Category_nodeset" select="$document-field-root[contains(text(), 'Category')] | $document-field-root[contains(@w:instr, 'Category')]"/>
+ <xsl:variable name="field_Characters_nodeset" select="$document-field-root[contains(text(), 'Characters')] | $document-field-root[contains(@w:instr, 'Characters')]"/>
+ <xsl:variable name="field_CharactersWithSpaces_nodeset" select="$document-field-root[contains(text(), 'CharactersWithSpaces')] | $document-field-root[contains(@w:instr, 'CharactersWithSpaces')]"/>
+ <xsl:variable name="field_Comments_nodeset" select="$document-field-root[contains(text(), 'Comments')] | $document-field-root[contains(@w:instr, 'Comments')]"/>
+ <xsl:variable name="field_Company_nodeset" select="$document-field-root[contains(text(), 'Company')] | $document-field-root[contains(@w:instr, 'Company')]"/>
+ <xsl:variable name="field_CreateTime_nodeset" select="$document-field-root[contains(text(), 'CreateTime')] | $document-field-root[contains(@w:instr, 'CreateTime')]"/>
+ <xsl:variable name="field_HyperlinkBase_nodeset" select="$document-field-root[contains(text(), 'HyperlinkBase')] | $document-field-root[contains(@w:instr, 'HyperlinkBase')]"/>
+ <xsl:variable name="field_Keywords_nodeset" select="$document-field-root[contains(text(), 'Keywords')] | $document-field-root[contains(@w:instr, 'Keywords')]"/>
+ <xsl:variable name="field_LastPrinted_nodeset" select="$document-field-root[contains(text(), 'LastPrinted')] | $document-field-root[contains(@w:instr, 'LastPrinted')]"/>
+ <xsl:variable name="field_LastSavedBy_nodeset" select="$document-field-root[contains(text(), 'LastSavedBy')] | $document-field-root[contains(@w:instr, 'LastSavedBy')]"/>
+ <xsl:variable name="field_LastSavedTime_nodeset" select="$document-field-root[contains(text(), 'LastSavedTime')] | $document-field-root[contains(@w:instr, 'LastSavedTime')]"/>
+ <xsl:variable name="field_Lines_nodeset" select="$document-field-root[contains(text(), 'Lines')] | $document-field-root[contains(@w:instr, 'Lines')]"/>
+ <xsl:variable name="field_Manager_nodeset" select="$document-field-root[contains(text(), 'Manager')] | $document-field-root[contains(@w:instr, 'Manager')]"/>
+ <xsl:variable name="field_NameofApplication_nodeset" select="$document-field-root[contains(text(), 'NameofApplication')] | $document-field-root[contains(@w:instr, 'NameofApplication')]"/>
+ <xsl:variable name="field_ODMADocId_nodeset" select="$document-field-root[contains(text(), 'ODMADocId')] | $document-field-root[contains(@w:instr, 'ODMADocId')]"/>
+ <xsl:variable name="field_Pages_nodeset" select="$document-field-root[contains(text(), 'Pages')] | $document-field-root[contains(@w:instr, 'Pages')]"/>
+ <xsl:variable name="field_Paragraphs_nodeset" select="$document-field-root[contains(text(), 'Paragraphs')] | $document-field-root[contains(@w:instr, 'Paragraphs')]"/>
+ <xsl:variable name="field_RevisionNumber_nodeset" select="$document-field-root[contains(text(), 'RevisionNumber')] | $document-field-root[contains(@w:instr, 'RevisionNumber')]"/>
+ <xsl:variable name="field_Security_nodeset" select="$document-field-root[contains(text(), 'Security')] | $document-field-root[contains(@w:instr, 'Security')]"/>
+ <xsl:variable name="field_Subject_nodeset" select="$document-field-root[contains(text(), 'Subject')] | $document-field-root[contains(@w:instr, 'Subject')]"/>
+ <xsl:variable name="field_Template_nodeset" select="$document-field-root[contains(text(), 'Template')] | $document-field-root[contains(@w:instr, 'Template')]"/>
+ <xsl:variable name="field_Title_nodeset" select="$document-field-root[contains(text(), 'Title')] | $document-field-root[contains(@w:instr, 'Title')]"/>
+ <xsl:variable name="field_TotalEditingTime_nodeset" select="$document-field-root[contains(text(), 'TotalEditingTime')] | $document-field-root[contains(@w:instr, 'TotalEditingTime')]"/>
+ <xsl:variable name="field_Words_nodeset" select="$document-field-root[contains(text(), 'Words')] | $document-field-root[contains(@w:instr, 'Words')]"/>
+ <xsl:apply-templates select="$field_Author_nodeset[1]" mode="user_field_Author_declare"/>
+ <xsl:apply-templates select="$field_Bytes_nodeset[1]" mode="user_field_Bytes_declare"/>
+ <xsl:apply-templates select="$field_Category_nodeset[1]" mode="user_field_Category_declare"/>
+ <xsl:apply-templates select="$field_Characters_nodeset[1]" mode="user_field_Characters_declare"/>
+ <xsl:apply-templates select="$field_CharactersWithSpaces_nodeset[1]" mode="user_field_CharactersWithSpaces_declare"/>
+ <xsl:apply-templates select="$field_Comments_nodeset[1]" mode="user_field_Comments_declare"/>
+ <xsl:apply-templates select="$field_Company_nodeset[1]" mode="user_field_Company_declare"/>
+ <xsl:apply-templates select="$field_CreateTime_nodeset[1]" mode="user_field_CreateTime_declare"/>
+ <xsl:apply-templates select="$field_HyperlinkBase_nodeset[1]" mode="user_field_HyperlinkBase_declare"/>
+ <xsl:apply-templates select="$field_Keywords_nodeset[1]" mode="user_field_Keywords_declare"/>
+ <xsl:apply-templates select="$field_LastPrinted_nodeset[1]" mode="user_field_LastPrinted_declare"/>
+ <xsl:apply-templates select="$field_LastSavedBy_nodeset[1]" mode="user_field_LastSavedBy_declare"/>
+ <xsl:apply-templates select="$field_LastSavedTime_nodeset[1]" mode="user_field_LastSavedTime_declare"/>
+ <xsl:apply-templates select="$field_Lines_nodeset[1]" mode="user_field_Lines_declare"/>
+ <xsl:apply-templates select="$field_Manager_nodeset[1]" mode="user_field_Manager_declare"/>
+ <xsl:apply-templates select="$field_NameofApplication_nodeset[1]" mode="user_field_NameofApplication_declare"/>
+ <xsl:apply-templates select="$field_ODMADocId_nodeset[1]" mode="user_field_ODMADocId_declare"/>
+ <xsl:apply-templates select="$field_Pages_nodeset[1]" mode="user_field_Pages_declare"/>
+ <xsl:apply-templates select="$field_Paragraphs_nodeset[1]" mode="user_field_Paragraphs_declare"/>
+ <xsl:apply-templates select="$field_RevisionNumber_nodeset[1]" mode="user_field_RevisionNumber_declare"/>
+ <xsl:apply-templates select="$field_Security_nodeset[1]" mode="user_field_Security_declare"/>
+ <xsl:apply-templates select="$field_Subject_nodeset[1]" mode="user_field_Subject_declare"/>
+ <xsl:apply-templates select="$field_Template_nodeset[1]" mode="user_field_Template_declare"/>
+ <xsl:apply-templates select="$field_Title_nodeset[1]" mode="user_field_Title_declare"/>
+ <xsl:apply-templates select="$field_TotalEditingTime_nodeset[1]" mode="user_field_TotalEditingTime_declare"/>
+ <xsl:apply-templates select="$field_Words_nodeset[1]" mode="user_field_Words_declare"/>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Author_declare">
+ <text:user-field-decl office:value-type="string" text:name="Author">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Bytes_declare">
+ <text:user-field-decl office:value-type="string" text:name="Bytes">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Category_declare">
+ <text:user-field-decl office:value-type="string" text:name="Category">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Characters_declare">
+ <text:user-field-decl office:value-type="string" text:name="Characters">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CharactersWithSpaces_declare">
+ <text:user-field-decl office:value-type="string" text:name="CharactersWithSpaces">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Comments_declare">
+ <text:user-field-decl office:value-type="string" text:name="Comments">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Company_declare">
+ <text:user-field-decl office:value-type="string" text:name="Company">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CreateTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="CreateTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_HyperlinkBase_declare">
+ <text:user-field-decl office:value-type="string" text:name="HyperlinkBase">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Keywords_declare">
+ <text:user-field-decl office:value-type="string" text:name="Keywords">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastPrinted_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastPrinted">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedBy_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastSavedBy">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastSavedTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Lines_declare">
+ <text:user-field-decl office:value-type="string" text:name="Lines">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Manager_declare">
+ <text:user-field-decl office:value-type="string" text:name="Manager">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_NameofApplication_declare">
+ <text:user-field-decl office:value-type="string" text:name="NameofApplication">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_ODMADocId_declare">
+ <text:user-field-decl office:value-type="string" text:name="ODMADocId">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Pages_declare">
+ <text:user-field-decl office:value-type="string" text:name="Pages">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Paragraphs_declare">
+ <text:user-field-decl office:value-type="string" text:name="Paragraphs">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_RevisionNumber_declare">
+ <text:user-field-decl office:value-type="string" text:name="RevisionNumber">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Security_declare">
+ <text:user-field-decl office:value-type="string" text:name="Security">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Subject_declare">
+ <text:user-field-decl office:value-type="string" text:name="Subject">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Template_declare">
+ <text:user-field-decl office:value-type="string" text:name="Template">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Title_declare">
+ <text:user-field-decl office:value-type="string" text:name="Title">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_TotalEditingTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="TotalEditingTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Words_declare">
+ <text:user-field-decl office:value-type="string" text:name="Words">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <!-- =========this following template to convert the ms number format to OOo wirter format === -->
+ <xsl:template name="get_field_num_format">
+ <xsl:param name="input_MS_num_format"/>
+ <xsl:choose>
+ <xsl:when test="contains($input_MS_num_format, 'Arabic' ) ">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'roman' ) ">
+ <xsl:text>i</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) ">
+ <xsl:text>I</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) ">
+ <xsl:text>a</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) ">
+ <xsl:text>A</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--xsl:template name="get_field_num_format">
+ <xsl:param name="input_MS_num_format"/>
+ <xsl:choose>
+ <xsl:when test="contains($input_MS_num_format, 'Arabic' ) ">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains ($input_MS_num_format, 'CircleNum' )">
+ <xsl:text>①, ②, ③, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'roman' ) ">
+ <xsl:text>i</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) ">
+ <xsl:text>I</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'CHINESENUM3' )">
+ <xsl:text>一, 二, 三, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'CHINESENUM2' )">
+ <xsl:text>壹, 貳, 參, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'DBNUM3' ) ">
+ <xsl:text>壱, 弐, 参, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ZODIAC2' ) ">
+ <xsl:text>子, 丑, 寅, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ZODIAC1' ) ">
+ <xsl:text>甲, 乙, 丙, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Iroha' ) ">
+ <xsl:text>イ, ロ, ハ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) ">
+ <xsl:text>ア, イ, ウ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) ">
+ <xsl:text>a</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) ">
+ <xsl:text>A</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'hebrew2' ) ">
+ <xsl:text>א, ב, ג, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ArabicAlpha' ) ">
+ <xsl:text>أ, ب, ت, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ThaiLetter' ) ">
+ <xsl:text>ก, ข, ฃ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Chosung' ) ">
+ <xsl:text>ㄱ, ㄴ, ㄷ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Ganada' ) ">
+ <xsl:text>가, 나, 다, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) ">
+ <xsl:text>ア, イ, ウ, ...</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+ <!-- ========= the following code is to generate the date styles for date/time fields ============ -->
+ <!--the default date styel content -->
+ <xsl:template name="default_date_style_content">
+ <number:year number:style="long">
+ </number:year>
+ <number:text>/</number:text>
+ <number:month>
+ </number:month>
+ <number:text>/</number:text>
+ <number:day>
+ </number:day>
+ <number:text> </number:text>
+ <number:hours>
+ </number:hours>
+ <number:text>:</number:text>
+ <number:minutes number:style="long">
+ </number:minutes>
+ <number:text>:</number:text>
+ <number:seconds number:style="long">
+ </number:seconds>
+ <number:am-pm>
+ </number:am-pm>
+ </xsl:template>
+ <!--the default date styel -->
+ <xsl:template name="default_date_style">
+ <number:date-style style:name="NDF1">
+ <xsl:call-template name="default_date_style_content"/>
+ </number:date-style>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="style">
+ <!-- this template is to generate the date, time styles according to the content of DateFormatString ( the string after \@ ) in w:instrText | w:fldSimple/@w:instr -->
+ <xsl:choose>
+ <xsl:when test=" name() = 'w:instrText' ">
+ <xsl:if test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' ">
+ <number:date-style>
+ <xsl:attribute name="style:name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@' )">
+ <!-- if has the date format string then call the template parse_field_date_format to produce the style-->
+ <xsl:variable name="MS_date_format">
+ <xsl:value-of select="normalize-space(substring-before(substring-after(normalize-space(substring-after(text(), '\@')), '&#x22;'), '&#x22;'))"/>
+ </xsl:variable>
+ <xsl:if test="string-length($MS_date_format) &gt;=1">
+ <xsl:call-template name="parse_field_date_format">
+ <xsl:with-param name="input_MS_date_format" select="$MS_date_format"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="string-length($MS_date_format) &lt;1">
+ <xsl:call-template name="default_date_style_content"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if doesn't have date format string so we use the following default format -->
+ <xsl:call-template name="default_date_style_content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </number:date-style>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:if test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' or substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' or substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' or substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' ">
+ <!-- we use the default date/time style for w:fldsimple -->
+ <number:date-style>
+ <xsl:attribute name="style:name">NDF1</xsl:attribute>
+ <xsl:call-template name="default_date_style_content"/>
+ </number:date-style>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="parse_field_date_format">
+ <!--this template is to parse and generate the content of the date-time style base on the content of input_MS_date_format -->
+ <xsl:param name="input_MS_date_format"/>
+ <xsl:if test="string-length($input_MS_date_format) &gt;= 1">
+ <xsl:variable name="date_token_start_position">
+ <!-- to find the start position of the token ' d, M, yy, YY,m etc. -->
+ <xsl:call-template name="find_token_startposition">
+ <xsl:with-param name="input_string" select="$input_MS_date_format"/>
+ <xsl:with-param name="token_start_position" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="date_token">
+ <!-- get the matched the token such as MM, YYYY, yy,MMMM etc. -->
+ <xsl:call-template name="get_date_token">
+ <xsl:with-param name="input_string2" select="substring($input_MS_date_format,$date_token_start_position)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($date_token_start_position) &gt; 1">
+ <!-- print the text between the tokens -->
+ <number:text>
+ <xsl:value-of select="substring($input_MS_date_format,1, number($date_token_start_position - 1) )"/>
+ </number:text>
+ </xsl:if>
+ <xsl:call-template name="map_date_format_pattern">
+ <xsl:with-param name="input_date_format_pattern" select="$date_token"/>
+ </xsl:call-template>
+ <xsl:variable name="unparsed_string">
+ <xsl:value-of select="substring($input_MS_date_format,$date_token_start_position + string-length($date_token))"/>
+ </xsl:variable>
+ <xsl:call-template name="parse_field_date_format">
+ <xsl:with-param name="input_MS_date_format" select="$unparsed_string"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="find_token_startposition">
+ <xsl:param name="input_string"/>
+ <xsl:param name="token_start_position"/>
+ <xsl:choose>
+ <xsl:when test="starts-with( $input_string,'yy') or starts-with($input_string,'YY') or starts-with($input_string,'HH') or starts-with($input_string,'hh') or starts-with($input_string,'ss') or starts-with($input_string,'SS')">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string, 'M') or starts-with($input_string,'d') or starts-with($input_string, 'm') or starts-with($input_string,'D') or starts-with($input_string,'h') or starts-with($input_string,'H') or starts-with($input_string,'s') or starts-with($input_string,'S')">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string, 'am/pm') or starts-with($input_string, 'AM/PM') ">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new_string">
+ <xsl:value-of select="substring($input_string, 2)"/>
+ </xsl:variable>
+ <xsl:call-template name="find_token_startposition">
+ <xsl:with-param name="input_string" select="$new_string"/>
+ <xsl:with-param name="token_start_position" select="$token_start_position +1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get_date_token">
+ <xsl:param name="input_string2"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($input_string2, 'am/pm') or starts-with($input_string2, 'AM/PM') ">
+ <xsl:value-of select=" 'am/pm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'yyyy') or starts-with($input_string2, 'YYYY')">
+ <xsl:value-of select=" 'yyyy' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'yy') or starts-with($input_string2, 'YY')">
+ <xsl:value-of select=" 'yy' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MMMM') ">
+ <xsl:value-of select=" 'MMMM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MMM')">
+ <xsl:value-of select=" 'MMM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MM')">
+ <xsl:value-of select=" 'MM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'M') ">
+ <xsl:value-of select=" 'M' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'dddd') or starts-with($input_string2, 'DDDD')">
+ <xsl:value-of select=" 'dddd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'ddd') or starts-with($input_string2, 'DDD')">
+ <xsl:value-of select=" 'ddd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'dd') or starts-with($input_string2, 'dd')">
+ <xsl:value-of select=" 'dd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'd') or starts-with($input_string2, 'D')">
+ <xsl:value-of select=" 'd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'mm')">
+ <xsl:value-of select=" 'mm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'm')">
+ <xsl:value-of select=" 'm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'hh') or starts-with($input_string2, 'HH')">
+ <xsl:value-of select=" 'hh' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'h') or starts-with($input_string2, 'H')">
+ <xsl:value-of select=" 'h' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'ss') or starts-with($input_string2, 'SS')">
+ <xsl:value-of select=" 'ss' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 's') or starts-with($input_string2, 'S')">
+ <xsl:value-of select=" 's' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="map_date_format_pattern">
+ <!-- this template map the MS date time format to OOo date time format -->
+ <xsl:param name="input_date_format_pattern"/>
+ <xsl:choose>
+ <xsl:when test="$input_date_format_pattern = 'am/pm' ">
+ <number:am-pm>
+ </number:am-pm>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'yyyy' ">
+ <number:year number:style="long">
+ </number:year>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'yy' ">
+ <number:year>
+ </number:year>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MMMM' ">
+ <number:month number:style="long" number:textual="true">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MMM' ">
+ <number:month number:textual="true">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MM' ">
+ <number:month number:style="long">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'M' ">
+ <number:month>
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'dddd' ">
+ <number:day-of-week number:style="long">
+ </number:day-of-week>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'ddd' ">
+ <number:day-of-week>
+ </number:day-of-week>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'dd' ">
+ <number:day number:style="long">
+ </number:day>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'd' ">
+ <number:day>
+ </number:day>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'mm' ">
+ <number:minutes number:style="long">
+ </number:minutes>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'm' ">
+ <number:minutes>
+ </number:minutes>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'hh' ">
+ <number:hours number:style="long">
+ </number:hours>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'h' ">
+ <number:hours>
+ </number:hours>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'ss' ">
+ <number:seconds number:style="long">
+ </number:seconds>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 's' ">
+ <number:seconds>
+ </number:seconds>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_list.xsl b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl
new file mode 100644
index 000000000000..656f0b9b51f0
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl
@@ -0,0 +1,661 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_list.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:listPr" mode="style">
+ <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+ <xsl:variable name="currlist" select="."/>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+ <xsl:if test="not(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[1]/w:ilfo/@w:val= $currlistid) and $rootlist/w:lvl ">
+ <xsl:element name="text:list-style">
+ <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="$rootlist/w:lvl"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:lvl">
+ <xsl:variable name="listtype">
+ <xsl:choose>
+ <xsl:when test="w:nfc/@w:val">
+ <xsl:value-of select="w:nfc/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listtype =23 and w:lvlPicBulletId">
+ <!-- image characters. wym -->
+ <xsl:element name="text:list-level-style-image">
+ <xsl:call-template name="list-styles-image"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$listtype =23">
+ <!-- nfcBullet: Bullet character. glu -->
+ <xsl:element name="text:list-level-style-bullet">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype" select="$listtype"/>
+ <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- all kinds of numbering characters. glu :( -->
+ <xsl:element name="text:list-level-style-number">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype" select="$listtype"/>
+ <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="list-styles-common">
+ <xsl:param name="listtype"/>
+ <xsl:param name="currlevel"/>
+ <xsl:variable name="startval" select="w:start/@w:val"/>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$currlevel"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$listtype = 23">
+ <!-- bullet character. glu -->
+ <xsl:attribute name="text:style-name">Bullet_20_Symbols</xsl:attribute>
+ <xsl:if test="not (contains(w:lvlText/@w:val,'%'))">
+ <xsl:attribute name="text:bullet-char">
+ <xsl:value-of select="w:lvlText/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(w:lvlText/@w:val,'%')">
+ <xsl:attribute name="text:bullet-char">
+ <xsl:value-of select=" '·' "/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="($listtype &gt;= 0) and ($listtype &lt; 60)">
+ <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
+ <xsl:if test="$startval">
+ <xsl:choose>
+ <xsl:when test="$startval &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="$startval"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:attribute name="text:display-levels">
+ <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
+ </xsl:attribute>
+ <xsl:call-template name="nfc2numformat">
+ <xsl:with-param name="nfcvalue" select="$listtype"/>
+ <xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/>
+ <xsl:with-param name="suffix" select="substring-after(w:lvlText/@w:val, concat('%', $currlevel) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
+ <xsl:if test="$startval">
+ <xsl:choose>
+ <xsl:when test="$startval &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="$startval"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:attribute name="text:display-levels">
+ <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
+ </xsl:attribute>
+ <!-- 'none' in Word 2003. wym -->
+ <xsl:attribute name="style:num-format"/>
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="style:list-level-properties">
+ <xsl:choose>
+ <xsl:when test="w:lvlJc/@w:val='right'">
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:lvlJc/@w:val='center'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="labelwidth">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:ind/@w:hanging">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:ind/@w:first-line">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftwidth">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="w:pPr/w:ind/@w:left">
+ <xsl:attribute name="text:space-before">
+ <xsl:choose>
+ <xsl:when test=" ( number($leftwidth)-number($labelwidth) ) &gt; 0">
+ <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" '0cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:min-label-width">
+ <xsl:choose>
+ <xsl:when test="$labelwidth &gt; 0">
+ <xsl:value-of select="concat($labelwidth,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <!-- In binary word translation, text:min-label-distance do not generate. So, the width of number-symbol will not effect the start position of text. But first line always start same position of second line, no indent. If text:min-label-distance generate, the look of list will change because of uncountable number-symbol's width, now use 0.25cm as default width-->
+ <xsl:choose>
+ <xsl:when test="w:suff/@w:val='Space'">
+ <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+ <xsl:variable name="tabpos">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+ <xsl:variable name="min-label-distance">
+ <xsl:choose>
+ <xsl:when test="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25 &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:min-label-distance">
+ <xsl:value-of select="concat($min-label-distance,'cm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used
+ <xsl:variable name="currNode" select="/w:wordDocument/w:body//w:listPr[w:ilvl/@w:val = $currlevel][w:ilfo/@w:val = $currlist/w:ilfo/@w:val]"/>
+ <xsl:choose>
+ <xsl:when test="($currNode/wx:t/@wx:wTabBefore ) and ($currNode/wx:t/@wx:wTabAfter ) and (not($currNode/following-sibling::w:jc) or $currNode/following-sibling::w:jc/@w:val = 'left')">
+ <xsl:attribute name="text:space-before"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabBefore)div 1440) * 2.54"/>cm</xsl:attribute>
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabAfter)div 1440) * 2.54"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:space-before"><xsl:value-of select="((number(w:pPr/w:ind/@w:left) div 1440) * 2.54) "/>cm</xsl:attribute>
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440) * 2.54"/>cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>-->
+ <xsl:if test="w:rPr/w:rFonts">
+ <xsl:if test="w:rPr/w:rFonts/@w:ascii">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- in Oasis format the style:font-name-asian is not allowed to appear here -->
+ <!--xsl:if test="w:rPr/w:rFonts/@w:fareast">
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute>
+ </xsl:if -->
+ <!--
+ <xsl:if test="w:rPr/w:rFonts/@w:cs">
+ <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute>
+ </xsl:if>
+ -->
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="list-styles-image">
+ <xsl:variable name="currlevel" select="number(@w:ilvl)"/>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$currlevel+1"/>
+ </xsl:attribute>
+ <xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/>
+ <office:binary-data>
+ <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/>
+ </office:binary-data>
+ <xsl:element name="style:list-level-properties">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+ <xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/>
+ <xsl:attribute name="fo:text-align">left</xsl:attribute>
+ <xsl:attribute name="fo:width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after($picsize,'height:')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:variable name="labelwidth">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:ind/@w:hanging">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:ind/@w:first-line">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftwidth">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:space-before">
+ <xsl:choose>
+ <xsl:when test="(number($leftwidth)-number($labelwidth)) &gt; 0 ">
+ <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" '0cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="text:min-label-width">
+ <xsl:choose>
+ <xsl:when test="$labelwidth &gt; 0">
+ <xsl:value-of select="concat($labelwidth,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="w:suff/@w:val='Space'">
+ <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+ <xsl:variable name="tabpos">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+ <xsl:attribute name="text:min-label-distance">
+ <xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <!-- avoid listPr in textbox. :( glu -->
+ <xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]">
+ <xsl:call-template name="genlist"/>
+ </xsl:template>
+ <xsl:template name="genlist">
+ <xsl:variable name="currlistid" select="w:pPr/w:listPr/w:ilfo/@w:val"/>
+ <xsl:variable name="currlistlvl" select="w:pPr/w:listPr/w:ilvl/@w:val"/>
+ <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">
+ <xsl:choose>
+ <xsl:when test="string-length($rootlistname) &gt; 0">
+ <xsl:value-of select="translate($rootlistname,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_')"/>
+ </xsl:when>
+ <xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val">
+ <xsl:attribute name="text:continue-numbering">true</xsl:attribute>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$currlistlvl"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$currlistlvl"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="process-common-paragraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$level -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:style" mode="list">
+ <xsl:variable name="listname" select="@w:styleId"/>
+ <xsl:if test="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]">
+ <text:list-style style:name="{$listname}">
+ <xsl:apply-templates select="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]/w:lvl"/>
+ </text:list-style>
+ </xsl:if>
+ </xsl:template>
+ <!-- for create outline style in office:styles -->
+ <xsl:template name="create-outline-style">
+ <xsl:element name="text:outline-style">
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="1"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="2"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="3"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="4"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="5"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="6"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="7"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="8"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="9"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="10"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="outline-level-style">
+ <xsl:param name="level"/>
+ <xsl:element name="text:outline-level-style">
+ <xsl:choose>
+ <xsl:when test="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]">
+ <xsl:apply-templates select="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]" mode="outline">
+ <xsl:with-param name="outlinelevel" select="$level"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$level"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-format"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:listPr" mode="outline">
+ <xsl:param name="outlinelevel"/>
+ <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+ <xsl:variable name="currlistlevel">
+ <xsl:choose>
+ <xsl:when test="w:ilvl">
+ <xsl:value-of select="w:ilvl/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+ <xsl:if test="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
+ <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype">
+ <xsl:choose>
+ <xsl:when test="w:nfc/@w:val">
+ <xsl:value-of select="w:nfc/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="currlevel" select="$outlinelevel"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="not($rootlist/w:lvl[@w:ilvl=$currlistlevel])">
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="'1'"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="nfc2numformat">
+ <xsl:param name="nfcvalue"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=0">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=1">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=2">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=3">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=4">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=26">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="$prefix"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( '.' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=27 or $nfcvalue=29">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="concat( $prefix, '(' )"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( ')' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=57">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="concat( $prefix, '- ' )"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( ' -' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="$prefix"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="$suffix"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- xsl:template name="nfc2numformat">
+ <xsl:param name="nfcvalue"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=0">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=1">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=2">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=3">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=4">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=10 or $nfcvalue=11 or $nfcvalue=17 or $nfcvalue=29 or $nfcvalue=33 or $nfcvalue=35 or $nfcvalue=36 or $nfcvalue=37 or $nfcvalue=39 or $nfcvalue=44">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=12">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=13">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=14 or $nfcvalue=19">
+ <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=16">
+ <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=18 or $nfcvalue=28">
+ <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=20">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=21">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=24">
+ <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=25">
+ <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=30">
+ <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=31">
+ <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=34">
+ <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=38">
+ <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=41 or $nfcvalue=42 or $nfcvalue=43">
+ <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=45 or $nfcvalue=47">
+ <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=46 or $nfcvalue=48">
+ <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=53">
+ <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue!=57 and $nfcvalue &gt; 48 and $nfcvalue &lt; 60">
+ <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=26">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( '.' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=27 or $nfcvalue=29">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '(' )"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ')' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=57">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '- ' )"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ' -' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_page.xsl b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl
new file mode 100644
index 000000000000..8e90a39f42a4
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_page.xsl,v $
+
+ $Revision: 1.11 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:footnotePr" mode="config">
+ <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol">
+ <xsl:if test="w:pos">
+ <xsl:choose>
+ <xsl:when test="w:pos/@w:val = 'beneath-text'">
+ <xsl:attribute name="text:footnotes-position">document</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:footnotes-position">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:numStart">
+ <xsl:choose>
+ <xsl:when test="w:numStart/@w:val - 1 &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="w:numStart/@w:val - 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute-->
+ </xsl:if>
+ <xsl:if test="w:numFmt">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="w:numRestart">
+ <xsl:choose>
+ <xsl:when test="w:numRestart/@w:val = 'continuous'">
+ <xsl:attribute name="text:start-numbering-at">document</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:numRestart/@w:val = 'each-sect'">
+ <xsl:attribute name="text:start-numbering-at">chapter</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-numbering-at">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:footnote[@w:type = 'continuation-separator']">
+ <text:footnote-continuation-notice-backward>
+ <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-separator'])"/>
+ </text:footnote-continuation-notice-backward>
+ </xsl:if>
+ <xsl:if test="w:footnote[@w:type = 'continuation-notice']">
+ <text:footnote-continuation-notice-forward>
+ <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-notice'])"/>
+ </text:footnote-continuation-notice-forward>
+ </xsl:if>
+ -->
+ </text:notes-configuration>
+ </xsl:template>
+ <xsl:template match="w:endnotePr" mode="config">
+ <text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol">
+ <xsl:if test="w:numStart">
+ <xsl:choose>
+ <xsl:when test="(w:numStart/@w:val - 1) &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="w:numStart/@w:val - 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:if test="w:numFmt">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
+ </xsl:call-template>
+ </xsl:if>
+ </text:notes-configuration>
+ </xsl:template>
+ <xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-zero'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">0</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">.</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-paren'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'number-in-dash'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">-</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-letter'">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-letter'">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-roman'">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-roman'">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <!-- ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting -->
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:bgPict">
+ <xsl:if test="w:background/@w:bgcolor">
+ <xsl:attribute name="fo:background-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="w:background/@w:bgcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:background/@w:background">
+ <style:background-image>
+ <office:binary-data>
+ <xsl:variable name="the-image" select="key('imagedata',w:background/@w:background)"/>
+ <xsl:value-of select="translate($the-image/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </office:binary-data>
+ </style:background-image>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:sectPr" mode="page-layout">
+ <style:page-layout>
+ <xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr" format="1"/>
+ </xsl:attribute>
+ <style:page-layout-properties>
+ <xsl:call-template name="page-layout-properties"/>
+ <xsl:apply-templates select="/w:wordDocument/w:bgPict"/>
+ </style:page-layout-properties>
+ <style:header-style>
+ <style:header-footer-properties style:dynamic-spacing="true" fo:margin-bottom="0">
+ <xsl:attribute name="fo:min-height.value"><xsl:value-of select="concat('(.(twips2cm(?(>($0(-[', w:pgMar/@w:top, '](|[', w:pgMar/@w:header, '][720])))[0])($0)[0]))[cm])')"/></xsl:attribute>
+ </style:header-footer-properties>
+ </style:header-style>
+ </style:page-layout>
+ </xsl:template>
+ <xsl:template match="w:sectPr" mode="master-page">
+ <!-- style:page-layout style:style-->
+
+ <xsl:variable name="master-page-number">
+ <xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:variable>
+ <xsl:if test="$master-page-number = '1'">
+ <style:master-page style:next-style-name="Standard-1" style:page-layout-name="pm1" style:display-name="First Page" style:name="First_20_Page">
+ <style:header>
+ <xsl:apply-templates select="w:hdr[@w:type='first']/child::*" mode="dispatch"/>
+ </style:header>
+ <style:footer>
+ <xsl:apply-templates select="w:ftr[@w:type='first']/child::*" mode="dispatch"/>
+ </style:footer>
+ </style:master-page>
+ </xsl:if>
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name">Standard-<xsl:value-of select="$master-page-number"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:page-layout-name">
+ <xsl:value-of select="concat('pm', $master-page-number)"/>
+ </xsl:attribute>
+
+ <style:header>
+ <xsl:apply-templates select="w:hdr[@w:type='odd']/child::*" mode="dispatch"/>
+ </style:header>
+ <style:header-left>
+ <xsl:apply-templates select="w:hdr[@w:type='even']/child::*" mode="dispatch"/>
+ </style:header-left>
+ <style:footer>
+ <xsl:apply-templates select="w:ftr[@w:type='odd']/child::*" mode="dispatch"/>
+ </style:footer>
+ <style:footer-left>
+ <xsl:apply-templates select="w:ftr[@w:type='even']/child::*" mode="dispatch"/>
+ </style:footer-left>
+
+ <!-- Headers and footers-->
+ <!--
+ <style:header-style>
+ <style:header-footer-properties>
+ <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:header,'twip')"/></xsl:call-template>cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+ </style:header-footer-properties>
+ </style:header-style>
+ <style:footer-style>
+ <style:header-footer-properties>
+ <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'twip')"/></xsl:call-template>cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+ </style:header-footer-properties>
+ </style:footer-style>
+ -->
+
+ <!-- any examples for w:titlePg usage? -->
+ <xsl:if test="not(w:titlePg)">
+ <xsl:apply-templates select="w:hdr[@w:type='odd']"/>
+ <xsl:apply-templates select="w:hdr[@w:type='even']"/>
+ <xsl:apply-templates select="w:ftr[@w:type='odd']"/>
+ <xsl:apply-templates select="w:ftr[@w:type='even']"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:hdr">
+ <!--
+ <xsl:choose>
+ <xsl:when test="@w:type = 'odd'">
+ <style:header>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:header>
+ </xsl:when>
+ <xsl:when test="@w:type = 'even'">
+ <style:header>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:header>
+ </xsl:when>
+ </xsl:choose>
+ -->
+ </xsl:template>
+ <xsl:template match="w:ftr">
+ <!--
+ <xsl:choose>
+ <xsl:when test="@w:type = 'odd'">
+ <style:footer>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:footer>
+ </xsl:when>
+ <xsl:when test="@w:type = 'even'">
+ <style:footer-left>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:footer-left>
+ </xsl:when>
+ </xsl:choose>
+ -->
+ </xsl:template>
+ <xsl:template match="wx:pBdrGroup">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <!-- xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-zero'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">0</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">.</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-paren'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'number-in-dash'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">-</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-letter'">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-letter'">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-roman'">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-roman'">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-full-width' or $number-format = 'decimal-full-width2'">
+ <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-circle-chinese' or $number-format = 'decimal-enclosed-circle'">
+ <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-enclosed-circle'">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chinese-counting-thousand' or $number-format = 'ideograph-digital' or $number-format = 'japanese-counting' or $number-format = 'japanese-digital-ten-thousand' or $number-format = 'taiwanese-counting-thousand' or $number-format = 'taiwanese-counting' or $number-format = 'taiwanese-digital' or $number-format = 'chinese-counting' or $number-format = 'korean-digital2' or $number-format = 'chinese-not-impl'">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chinese-legal-simplified'">
+ <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-legal-traditional'">
+ <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-traditional'">
+ <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-zodiac'">
+ <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'japanese-legal'">
+ <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'aiueo-full-width'">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'aiueo'">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'iroha-full-width'">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'iroha'">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'korean-digital' or $number-format = 'korean-counting' or $number-format = 'korean-legal'">
+ <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chosung'">
+ <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ganada'">
+ <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'arabic-alpha' or $number-format = 'arabic-abjad'">
+ <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'thai-letters' or $number-format = 'thai-numbers' or $number-format = 'thai-counting'">
+ <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'hebrew-1' or $number-format = 'hebrew-2'">
+ <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
+ </xsl:when>
+ < ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting >
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_path.xsl b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl
new file mode 100644
index 000000000000..0befedba710e
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl
@@ -0,0 +1,1822 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_path.xsl,v $
+
+ $Revision: 1.6 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:include href="../../common/math.xsl"/>
+ <xsl:template name="dummy">
+ <xsl:call-template name="test"/>
+ </xsl:template>
+ <xsl:template name="test-arc">
+ <xsl:call-template name="svg-arc2vml-arc">
+ <!-- M 125,75 a100,50 0 ?,? 100,50 -->
+ <xsl:with-param name="x0" select="125"/>
+ <xsl:with-param name="y0" select="75"/>
+ <xsl:with-param name="rx" select="100"/>
+ <xsl:with-param name="ry" select="50"/>
+ <xsl:with-param name="x-axis-rotation" select="0"/>
+ <xsl:with-param name="large-arc-flag" select="0"/>
+ <xsl:with-param name="sweep-flag" select="0"/>
+ <xsl:with-param name="x" select="225"/>
+ <xsl:with-param name="y" select="125"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="test">
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="'m,l,4500,3420,2520,6120,4500r2160,l6660,3240,8460,2520,8460,,3960,540r360,720l2700,1260,3240,540,,xe'"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="vmlpath2svgpath">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="svg-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'m'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'm' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' M ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 't' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' m ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'r' ">
+ <!-- relative lineto -->
+ <!-- 'l' command is not supported currently, so we use 'L' -->
+ <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message>
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <!-- 'l' command is not supported currently-->
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $new-x ,' ' , $new-y , ' ') "/>
+ <!-- xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/ -->
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyH' ">
+ <!-- absolute horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyh' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyV' ">
+ <!-- absolute vertical lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyv' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' C ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyS' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummys' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' v ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyQ' ">
+ <!-- absolute quadratic bézier curves -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyq' ">
+ <!-- relative quadratic bézier curves -->
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/>
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/>
+ <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ' , $absolute-number , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'x' ">
+ <!--dummy or $command = 'z' "-->
+ <!-- closepath -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' Z ' ) "/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'e' ">
+ <!-- end path -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' N ' )"/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--Code below is for the support of h-command like ha,hb....hi, maybe still need to revise-->
+ <xsl:when test="$command = 'ha' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hb' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hc' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hd' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'he' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hf' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hg' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hh' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hi' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'nf' or $command = 'ns' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'al' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' W ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$svg-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ **Template vmlpath2enhancedpath**
+ The template is resposible for converting the vml-path to enhanced-path, because the svg:path
+ cann't support command a now.(But heard that will be supported in OOo3.0)
+ And the 2nd reason of using an enhanced-path is that enhanced-path have a perfect maping to
+ vmlpath.(You will find out that often,we even don't need to change the parameters).
+ -->
+ <xsl:template name="vmlpath2enhancedpath">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="enhanced-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'m'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'm' ">
+ <!--####Notice that the "m 0,0,1,1,1,1" means two lines-->
+ <!-- absolute moveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'x' ">
+ <!--dummy or $command = 'z' "-->
+ <!-- closepath -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Z ' ) "/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'e' ">
+ <!-- end path -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' N ' )"/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 't' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/>
+ <!--####maybe this is not crect because t r and v hasn't direct image in enhaced-path-->
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'r' ">
+ <!-- relative lineto -->
+ <!--####maybe this is not crect because 't' 'r' and 'v' hasn't direct image in enhaced-path-->
+ <!-- 'l' command is not supported currently, so we use 'L' -->
+ <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message>
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <!-- 'l' command is not supported currently-->
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , $new-x ,' ' , $new-y , ' ') "/>
+ <!-- xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/ -->
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative curveto -->
+ <!--####maybe this is not crect because 't' 'r' and 'v' hasn't direct image in enhaced-path-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/>
+ <!--<xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>-
+ -->
+ <xsl:variable name="x1">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y1">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x1 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x2">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $y1 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y2">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x2 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $y2 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="val_x1">
+ <xsl:value-of select="substring-before( $x1 , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y1">
+ <xsl:value-of select="substring-before( $y1 , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="val_x2">
+ <xsl:value-of select="substring-before( $x2 , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y2">
+ <xsl:value-of select="substring-before( $y2 , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="val_x">
+ <xsl:value-of select="substring-before( $x , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y">
+ <xsl:value-of select="substring-before( $y , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="control-and-pos">
+ <xsl:value-of select="concat($val_x1, ' ',$val_y1, ' ',$val_x2, ' ',$val_y2, ' ' )"/>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:value-of select="concat($val_x, ' ',$val_y, ' ' )"/>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ',$control-and-pos , ' ' , $num-and-pos , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $y , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $val_x "/>
+ <xsl:with-param name="current-y" select=" $val_y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--Code below is for the support of h-command like ha,hb....hi, maybe still need to revise-->
+ <xsl:when test="$command = 'ha' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hb' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hc' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hd' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'he' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hf' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hg' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hh' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hi' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'nf' ">
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' F ' )"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'ns' ">
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' S ' )"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--The following is 6 command which deal with arcs:
+ ae ->T al -> U
+ at -> A ar -> B
+ wa -> W wr ->V
+ These pairs of commands have shown the perfect mapping from vml-path to enhanced-path-->
+ <xsl:when test="$command = 'ae' ">
+ <!-- arc on the screen with the start and end angles -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' T ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'al' ">
+ <!-- ae command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' U ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'at' ">
+ <!-- arc on the screen with the edge box ,start points and end points(Notice it's counter-clockwise)-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' A ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'ar' ">
+ <!-- at command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' B ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'wa' ">
+ <!-- arc on the screen with the edge box ,start points and end points(Notice it's clockwise)-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' W ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'wr' ">
+ <!-- wa command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' V ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qx' ">
+ <!-- Draw a quarter ellipse retated to the x-axis-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' X ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qy' ">
+ <!-- Draw a quarter ellipse retated to the y-axis-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Y ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qb' ">
+ <!-- quadratic Bezier-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Q ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$enhanced-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-before">
+ <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="-1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="previous-num-and-pos">
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/>
+ </xsl:variable>
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-after">
+ <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="next-num-and-pos">
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/>
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-position">
+ <!-- get the next number start position, direction should be 1 or -1-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="direction" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$direction = 1 and $position &gt; string-length($vml-path) ">0</xsl:when>
+ <xsl:when test="$direction = -1 and not($position &gt; 0)">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char">
+ <xsl:if test="$direction = 1">
+ <xsl:value-of select="substring($vml-path, $position , 1)"/>
+ </xsl:if>
+ <xsl:if test="$direction = -1">
+ <xsl:value-of select="substring($vml-path, $position -1 , 1)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start-->
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:when test="not($curr-char = ' ')">
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position + $direction"/>
+ <xsl:with-param name="direction" select="$direction"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="skip-space">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="skip-comma" select="'yes'"/>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="$curr-char = ',' and $skip-comma = 'yes'">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position+1"/>
+ <xsl:with-param name="skip-comma" select="'no'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$curr-char = ' '">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position+1"/>
+ <xsl:with-param name="skip-comma" select="$skip-comma"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$position"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="format-number-pos">
+ <xsl:param name="number"/>
+ <xsl:param name="position"/>
+ <xsl:choose>
+ <xsl:when test="contains($number,'@')">
+ <xsl:value-of select="concat('?f',translate($number,'@',''),':' , $position ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" concat(round($number) , ':' , $position) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-next-number">
+ <!-- get the next number from current position-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select=" '' "/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) ">
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" $number = '' and $curr-char = ',' ">
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( '0:' , $new-pos )"/>
+ </xsl:when>
+ <xsl:when test=" $number = '' and not($curr-char = ',') ">
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( '0:' , $new-pos)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$new-pos"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-previous-number">
+ <!-- get the previous number from current position-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="not($position &gt; 0)">
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="'0'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position -1 , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="concat($curr-char , $number) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- skip it -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="$number "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) &gt; 0">
+ <!-- finsh it with +/- -->
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-path-command_dummy">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , 'mlcxetrvnfsawqyb' ,'')) = 0 ">
+ <!-- "MmZzLlHhVvCcSsQqTtAa" are all possiable command chars -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ **get-path- command**
+ This function will collect the next command from a string. If the input string should has a start of number character,
+ we here implictly think the command is the last-command
+ All of the command of vml is listed as following:
+ __Basic commands:__
+ m l c x e t r v nf ns ae al at ar wa wr qx qy qb
+ __Edit behavior extensions commands__
+ ha hb hc hd he hf hg hh hi
+
+ So we know the longest command should be four character.The function is implemented on this basis:
+ -->
+ <xsl:template name="get-path-command">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:variable name="curr-2char" select="substring($vml-path, $position - 1 , 2)"/>
+ <xsl:choose>
+ <xsl:when test="$curr-char = 'a' ">
+ <!--process the commands ae al at ar-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='e' ">1</xsl:when>
+ <xsl:when test="$second-char='l' ">1</xsl:when>
+ <xsl:when test="$second-char='t' ">1</xsl:when>
+ <xsl:when test="$second-char='r' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'n' ">
+ <!--process the commands nf ns -->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='f' ">1</xsl:when>
+ <xsl:when test="$second-char='s' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'w' ">
+ <!--process the commands wa wr-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='a' ">1</xsl:when>
+ <xsl:when test="$second-char='r' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'q' ">
+ <!--process the commands qx qy qb-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='x' ">1</xsl:when>
+ <xsl:when test="$second-char='y' ">1</xsl:when>
+ <xsl:when test="$second-char='b' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'h' ">
+ <!--process the edit behavior extensions commands-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($second-char , 'abcdefghi' ,'')) = 0">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , 'mlcxetrv' ,'')) = 0 ">
+ <!--process the single character commands m l c x e t r v -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="$curr-2char=',,' ">
+ <!-- here are two ',' -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="svg-arc2vml-arc">
+ <xsl:param name="x0"/>
+ <xsl:param name="y0"/>
+ <xsl:param name="rx"/>
+ <xsl:param name="ry"/>
+ <xsl:param name="x-axis-rotation" select="0"/>
+ <xsl:param name="large-arc-flag" select="0"/>
+ <xsl:param name="sweep-flag" select="0"/>
+ <xsl:param name="x"/>
+ <xsl:param name="y"/>
+ <!-- Compute 1/2 distance between current and final point -->
+ <xsl:variable name="dx2" select="($x0 - $x) div 2"/>
+ <xsl:variable name="dy2" select="($y0 - $y) div 2"/>
+ <!-- Convert from degrees to radians -->
+ <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/>
+ <!-- Compute (x1, y1). What are x1,y1?-->
+ <xsl:variable name="cos-rotation">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="sin-rotation">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/>
+ <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/>
+ <!-- Make sure radii are large enough -->
+ <xsl:variable name="rx-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$rx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ry-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$ry"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/>
+ <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/>
+ <xsl:variable name="x1-sq" select="$x1 * $x1"/>
+ <xsl:variable name="y1-sq" select="$y1 * $y1"/>
+ <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/>
+ <xsl:variable name="radius-check-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$radius-check"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-rx">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$rx-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$ry-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-ry * $new-ry"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-rx-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-rx * $new-rx"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Step 2: Compute (cx1, cy1) -->
+ <xsl:variable name="sign">
+ <xsl:choose>
+ <xsl:when test="$large-arc-flag = $sweep-flag">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="unchecked-sq" select=" (($new-rx-sq * $new-ry-sq) - ($new-rx-sq * $y1-sq) - ($new-ry-sq * $x1-sq)) div (($new-rx-sq * $y1-sq) + ($new-ry-sq * $x1-sq)) "/>
+ <xsl:variable name="sq">
+ <xsl:choose>
+ <xsl:when test=" $unchecked-sq &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$unchecked-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sq-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$sq"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="coef" select="$sign * $sq-sqrt "/>
+ <xsl:variable name="cx1" select="$coef * $new-rx * $y1 div $new-ry"/>
+ <xsl:variable name="cy1" select=" -1 * $coef * $new-ry * $x1 div $new-rx"/>
+ <!-- Step 3: Compute (cx, cy) from (cx1, cy1) -->
+ <xsl:variable name="sx2" select="($x0 +$x) div 2 "/>
+ <xsl:variable name="sy2" select="($y0 +$y) div 2 "/>
+ <xsl:variable name="tmp1" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="tmp2" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="cx" select=" $sx2 + ( $cos-rotation * $cx1 - $sin-rotation * $cy1 ) "/>
+ <xsl:variable name="cy" select=" $sy2 + ( $sin-rotation * $cx1 + $cos-rotation * $cy1 ) "/>
+ <!-- Step 4: Compute angle start and angle extent -->
+ <xsl:variable name="ux" select="( $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="uy" select="( $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="vx" select="( - 1 * $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="vy" select="(- 1 * $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="n">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select=" ($ux * $ux) + ($uy * $uy) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- 1 * ux + 0 * uy -->
+ <xsl:variable name="p" select="$ux"/>
+ <xsl:variable name="uy-sign">
+ <xsl:choose>
+ <xsl:when test=" $uy &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p div $n"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="theta" select="( $uy-sign * $acos-pn * 180 div $pi ) mod 360 "/>
+ <xsl:variable name="n-delta">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="($ux * $ux + $uy * $uy) * ($vx * $vx + $vy * $vy)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="p-delta" select="$ux * $vx + $uy * $vy"/>
+ <xsl:variable name="vy-sign">
+ <xsl:choose>
+ <xsl:when test="($ux * $vy - $uy * $vx) &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn-delta">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p-delta div $n-delta"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="unchecked-delta" select="$vy-sign * $acos-pn-delta * 180 div $pi "/>
+ <xsl:variable name="delta">
+ <xsl:choose>
+ <xsl:when test=" $sweep-flag = 0 and $unchecked-delta &gt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta - 360) mod 360 "/>
+ </xsl:when>
+ <xsl:when test=" $sweep-flag = 1 and $unchecked-delta &lt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta + 360) mod 360 "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" $unchecked-delta mod 360 "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat ($cx, ' ' , $cy, ' ' , $rx, ' ' , $ry, ' ' , $theta, ' ' , $delta, ' ' , $x-axis-rotation) "/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_props.xsl b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl
new file mode 100644
index 000000000000..76725f217d79
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl
@@ -0,0 +1,107 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v" xmlns:an="urn:flr:annotate">
+
+<an:page-layout-properties
+ context-node-input="w:sectPr"
+ context-node-output="style:page-layout-properties">
+<an:so-supported select="w:pgMar/@w:gutter"/>
+<an:so-supported select="w:pgSz/@w:code"/>
+</an:page-layout-properties>
+
+<xsl:template name="page-layout-properties">
+
+<xsl:attribute name="fo:margin-top.value">
+ <xsl:value-of select="concat('(.(twips2cm(?[',name(w:hdr),'](?(>=($0[',w:pgMar/@w:top,'])($1(|[',w:pgMar/@w:header,'][720])))($1)($0))[',w:pgMar/@w:top,']))[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-bottom.value">
+ <xsl:value-of select="concat('(.(twips2cm(?[',name(w:ftr),'](|[',w:pgMar/@w:footer,'][720])[',w:pgMar/@w:bottom,']))[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-left.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:left,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-right.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:right,'])[cm])')"/>
+</xsl:attribute>
+
+<xsl:attribute name="fo:page-width.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:w,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:page-height.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:h,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:footnote-max-height.value">
+ <xsl:value-of select="'[0cm]'"/>
+</xsl:attribute>
+<xsl:attribute name="style:print-orientation.value">
+ <xsl:value-of select="concat('(|[',w:pgSz/@w:orient,'][portrait])')"/>
+</xsl:attribute>
+<xsl:apply-templates select="//w:bgPict"/>
+<xsl:call-template name="column-properties"/>
+</xsl:template>
+
+
+<an:column-properties
+ context-node-input="w:sectPr"
+ context-node-output="style:page-layout-properties">
+<an:so-supported select="w:cols/@w:sep"/>
+</an:column-properties>
+<xsl:template name="column-properties">
+<style:columns>
+<xsl:attribute name="fo:column-count.value">
+ <xsl:value-of select="concat('(|[',w:cols/@w:num,'][1])')"/>
+</xsl:attribute>
+
+<xsl:if test="not(w:cols/w:col)">
+<!-- bug in the OASIS spec resp. bug in xmloff -->
+<xsl:attribute name="fo:column-gap.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:cols/@w:space,'])[cm])')"/>
+</xsl:attribute>
+</xsl:if>
+
+<xsl:for-each select="w:cols/w:col">
+ <style:column>
+ <xsl:attribute name="style:rel-width.value">
+ <xsl:value-of select="concat('(.[',@w:w,'][*])')"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:start-indent.value">
+ <xsl:value-of select="'[0cm]'"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:end-indent.value">
+ <xsl:value-of select="concat('(.(twips2cm(|[',@w:space,'][0]))[cm])')"/>
+ </xsl:attribute>
+ </style:column>
+</xsl:for-each>
+</style:columns>
+</xsl:template>
+
+<an:text-properties
+ context-node-input="w:rPr"
+ context-node-output="style:text-properties">
+</an:text-properties >
+<xsl:template name="text-properties">
+<xsl:attribute name="fo:font-weight.value">
+ <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-weight-asian.value">
+ <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-weight-complex.value">
+ <xsl:value-of select="concat('(switch(|[',w:b-cs/@val,'][',local-name(w:b-cs),'])[on][bold][off][normal][b-cs][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:font-style.value">
+ <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-style-asian.value">
+ <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-style-complex.value">
+ <xsl:value-of select="concat('(switch(|[',w:i-cs/@val,'][',local-name(w:i-cs),'])[on][italic][off][normal][i-cs][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:text-transform.value">
+ <xsl:value-of select="concat('(switch(|[',w:caps/@val,'][',local-name(w:caps),'])[on][uppercase][off][normal][caps][uppercase][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:font-variant.value">
+ <xsl:value-of select="concat('(switch(|[',w:smallCaps/@val,'][',local-name(w:smallCaps),'])[on][small-caps][off][normal][smallCaps][small-caps][])')"/>
+</xsl:attribute>
+</xsl:template>
+
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl
new file mode 100644
index 000000000000..2f519b1dc516
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_settings.xsl,v $
+
+ $Revision: 1.9 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:docPr">
+ <office:settings>
+ <config:config-item-set config:name="view-settings">
+ <config:config-item config:name="InBrowseMode" config:type="boolean">
+ <xsl:choose>
+ <xsl:when test="w:view/@w:val = 'outline'">true</xsl:when>
+ <xsl:when test="w:view/@w:val = 'print'">false</xsl:when>
+ <!-- others: web, reading, normal, master-pages, none. glu -->
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <xsl:if test="w:zoom">
+ <!-- VisibleRight and VisibleBottom are arbitrary positive numbers. ;) glu -->
+ <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item>
+ <xsl:choose>
+ <xsl:when test="w:zoom/@w:val = 'best-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
+ </xsl:when>
+ <xsl:when test="w:zoom/@w:val = 'full-page'">
+ <config:config-item config:name="ZoomType" config:type="short">2</config:config-item>
+ </xsl:when>
+ <xsl:when test="w:zoom/@w:val = 'text-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">1</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <config:config-item config:name="ZoomFactor" config:type="short">
+ <xsl:value-of select="w:zoom/@w:percent"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ </office:settings>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_table.xsl b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl
new file mode 100644
index 000000000000..f72d758f6ab1
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl
@@ -0,0 +1,1290 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_table.xsl,v $
+
+ $Revision: 1.10 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:style[@w:type='table']" mode="table">
+ <style:style style:family="table">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ <xsl:if test="w:basedOn">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <style:table-properties table:align="margins"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:tblPr" mode="style">
+ <xsl:variable name="table-number">
+ <xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1" />
+ </xsl:variable>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:text>Table</xsl:text>
+ <xsl:value-of select="$table-number"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <xsl:if test="w:tblStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:tblStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/>
+ <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/>
+ <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/>
+ <xsl:variable name="last-next-p-tbl" select="$last-section-property[last()]/following::*[name()='w:p' or name()='w:tbl']"/>
+ <xsl:choose>
+ <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-next-p-tbl[1]) = generate-id(..) and not(ancestor::w:sectPr or ancestor::w:styles)">
+ <xsl:attribute name="style:master-page-name">
+ <xsl:text>Standard</xsl:text>
+ <xsl:value-of select="$section-property-number + 1" />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$table-number = 1 and not(preceding::w:p[ancestor::w:body])">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:element name="style:table-properties">
+ <xsl:choose>
+ <xsl:when test="w:jc/@w:val = 'left' or w:jc/@w:val = 'center' or w:jc/@w:val = 'right'">
+ <xsl:attribute name="table:align">
+ <xsl:value-of select="w:jc/@w:val"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:align">margins</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- adopt the width of table and column corresponding the width of page and margins. . -->
+ <xsl:variable name="sectPr" select="following::w:sectPr[1]"/>
+ <xsl:variable name="total-page-size" select="$sectPr/w:pgSz/@w:w"/>
+ <xsl:variable name="page-left-mar" select="$sectPr/w:pgMar/@w:left"/>
+ <xsl:variable name="page-right-mar" select="$sectPr/w:pgMar/@w:right"/>
+ <xsl:variable name="page-size-value" select="$total-page-size - $page-left-mar - $page-right-mar"/>
+ <xsl:variable name="page-size-inch">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($page-size-value, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="gridcols" select="../w:tblGrid/w:gridCol"/>
+ <xsl:variable name="tblsize" select="sum($gridcols/@w:w)"/>
+ <xsl:variable name="table_indent">
+ <xsl:choose>
+ <xsl:when test="w:tblInd and w:tblInd/@w:w &gt; 0 ">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblInd/@w:w, 'twip') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number( '0') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rel-tblsize">
+ <xsl:choose>
+ <xsl:when test="w:tblW/@w:type = 'pct'">
+ <xsl:value-of select="(number(w:tblW/@w:w ) div 5000) * $page-size-inch"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($tblsize, 'twip')"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:width">
+ <xsl:value-of select="concat($rel-tblsize, 'in' )"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_margin_left">
+ <xsl:choose>
+ <xsl:when test="not(w:tblpPr ) ">
+ <xsl:choose>
+ <xsl:when test="w:bidiVisual">
+ <xsl:choose>
+ <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+ <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$table_indent"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:tblpPr">
+ <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 -->
+ <xsl:text>0</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tbl_margin_right">
+ <xsl:choose>
+ <xsl:when test="not(w:tblpPr ) ">
+ <xsl:choose>
+ <xsl:when test="w:bidiVisual">
+ <xsl:value-of select="$table_indent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+ <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:tblpPr">
+ <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 -->
+ <xsl:text>0</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:value-of select="concat( $tbl_margin_left, 'in')"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:value-of select="concat($tbl_margin_right, 'in')"/>
+ </xsl:attribute>
+ <!-- If previous w:p has a page break, the table must have the page break attribute applied to it May need this for tables starting on new pages -->
+ <!-- <xsl:if test="parent::w:tbl/preceding-sibling::w:p[1][descendant::w:br/@w:type='page']">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute></xsl:if> -->
+ <!-- initial values for tables-->
+ </xsl:element>
+ </xsl:element>
+ <!-- the following style is for conveting Word table text wrapping to SO Writer. Since SO Writer has no table text wrapping feature, so we use the draw:text-box as a container and put the table in draw:text-box -->
+ <xsl:if test="w:tblpPr">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">TableFrame<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select=" 'Frame' "/>
+ </xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="w:tblpPr/@w:leftFromText">
+ <xsl:variable name="left_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:leftFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:value-of select="concat( $left_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:rightFromText">
+ <xsl:variable name="right_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:rightFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:value-of select="concat( $right_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:topFromText">
+ <xsl:variable name="top_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:topFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-top">
+ <xsl:value-of select="concat( $top_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:bottomFromText">
+ <xsl:variable name="bottom_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:bottomFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:value-of select="concat( $bottom_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:number-wrapped-paragraphs">
+ <xsl:text>no-limit</xsl:text>
+ </xsl:attribute>
+ <!--xsl:if test="w:tblpPr/@w:tblpYSpec" to get the vertical alignment-->
+ <xsl:variable name="vertical_alignment">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'top' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'center' ">
+ <xsl:text>middle</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec= 'bottom' ">
+ <xsl:text>bottom</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'inside' ">
+ <xsl:text>from-top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec= 'outside' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>from-top</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-pos">
+ <xsl:value-of select="$vertical_alignment"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:vertAnchor" to get the vertical anchor related area type -->
+ <xsl:variable name="frame_v_anchor">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'text' ">
+ <xsl:value-of select=" 'paragraph' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'margin' ">
+ <xsl:value-of select=" 'paragraph-content' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'page' ">
+ <xsl:value-of select="w:tblpPr/@w:vertAnchor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'page-content' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-rel">
+ <xsl:value-of select="$frame_v_anchor"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:tblpXSpec" to get the horizntal alignment-->
+ <xsl:variable name="horizental_alignment">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'left' ">
+ <xsl:text>left</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'center' ">
+ <xsl:text>center</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'right' ">
+ <xsl:text>right</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'inside' ">
+ <xsl:text>from-left</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'outside' ">
+ <xsl:text>outside</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>left</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:horizontal-pos">
+ <xsl:value-of select="$horizental_alignment"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:horzAnchor" to get the horizental anchor related area type-->
+ <xsl:variable name="frame_h_anchor">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'text' ">
+ <xsl:value-of select=" 'paragraph' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'margin' ">
+ <xsl:value-of select=" 'page-content' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'page' ">
+ <xsl:value-of select="w:tblpPr/@w:horzAnchor"/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor= 'inside' ">
+ <xsl:value-of select=" 'paragraph-start-margin' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor= 'outside' ">
+ <xsl:value-of select=" 'paragraph-end-margin' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'paragraph-content' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:horizontal-rel">
+ <xsl:value-of select="$frame_h_anchor"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <xsl:attribute name="fo:background-color">
+ <xsl:text>#ffffff</xsl:text>
+ </xsl:attribute>
+ <!-- xsl:attribute name="style:background-transparency"><xsl:text>100%</xsl:text></xsl:attribute -->
+ <xsl:attribute name="style:wrap">
+ <xsl:text>parallel</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:gridCol" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:variable name="column_width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(@w:w, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="concat($column_width,'in') "/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:trPr" mode="style">
+ <!-- to generate style:style of table-row height. -->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="w:trHeight/@w:val">
+ <xsl:variable name="tbl_row_height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:trHeight/@w:val, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:min-row-height">
+ <xsl:value-of select="concat($tbl_row_height, 'in' )"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tcPr" mode="style">
+ <style:style>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:variable name="rootStyle" select="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val"/>
+ <xsl:variable name="rootStyleNode" select="/w:wordDocument/w:styles/w:style[@w:styleId = $rootStyle]"/>
+ <xsl:element name="style:table-cell-properties">
+ <!-- cell background color start -->
+ <xsl:variable name="tbl_cell_background_color">
+ <xsl:choose>
+ <xsl:when test="w:shd/@w:fill">
+ <xsl:value-of select="w:shd/@w:fill"/>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblpr/w:shd/@w:fill">
+ <xsl:value-of select="$rootStyleNode/w:tblpr/w:shd/@w:fill"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test=" string-length($tbl_cell_background_color) &gt; 0 and not( $tbl_cell_background_color ='auto' )">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="concat('#',$tbl_cell_background_color)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!--cell background color end -->
+ <!-- table cell vertical alignment start -->
+ <xsl:if test="w:vAlign">
+ <xsl:variable name="tbl_cell_alignment">
+ <xsl:choose>
+ <xsl:when test="w:vAlign/@w:val = 'top' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:vAlign/@w:val = 'center' ">
+ <xsl:text>middle</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:vAlign/@w:val = 'bottom' ">
+ <xsl:text>bottom</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>automatic</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="$tbl_cell_alignment"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--table cell alignment end -->
+ <!-- cell margin start -->
+ <xsl:variable name="tblcell_leftmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:left">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:left/@w:w , w:tcMar/w:left/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:left">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_rightmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:right">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:right/@w:w , w:tcMar/w:right/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:right">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_topmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:top">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:top/@w:w , w:tcMar/w:top/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:top">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_bottommargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:bottom">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:bottom/@w:w , w:tcMar/w:bottom/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:bottom">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="string-length($tblcell_leftmargin) &gt; 0 ">
+ <xsl:attribute name="fo:padding-left">
+ <xsl:value-of select="concat($tblcell_leftmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_rightmargin) &gt; 0">
+ <xsl:attribute name="fo:padding-right">
+ <xsl:value-of select="concat($tblcell_rightmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_topmargin) &gt; 0 ">
+ <xsl:attribute name="fo:padding-top">
+ <xsl:value-of select="concat($tblcell_topmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_bottommargin) &gt; 0">
+ <xsl:attribute name="fo:padding-bottom">
+ <xsl:value-of select="concat($tblcell_bottommargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- cell margin end -->
+ <xsl:variable name="row-position">
+ <xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:variable>
+ <!-- cell borders should be carefully converted. a little complex. glu :( -->
+ <xsl:variable name="Borders" select="ancestor::w:tbl/w:tblPr/w:tblBorders"/>
+ <xsl:choose>
+ <xsl:when test="$row-position &gt; 1">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:top"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:top"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tr/following-sibling::w:tr) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:bottom"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:bottom"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tc/preceding-sibling::w:tc) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:left"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:left"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tc/following-sibling::w:tc) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:right"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:right"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="get-table-border">
+ <xsl:param name="style-pos"/>
+ <xsl:param name="style-position-0"/>
+ <xsl:param name="style-position-1"/>
+ <xsl:param name="style-position-2"/>
+ <xsl:variable name="size-style">
+ <xsl:choose>
+ <xsl:when test="$style-position-0">
+ <xsl:value-of select="$style-position-0/@w:sz"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1">
+ <xsl:value-of select="$style-position-1/@w:sz"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2">
+ <xsl:value-of select="$style-position-2/@w:sz"/>
+ </xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="border-style">
+ <xsl:choose>
+ <xsl:when test="$style-position-0">
+ <xsl:value-of select="$style-position-0/@w:val"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1">
+ <xsl:value-of select="$style-position-1/@w:val"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2">
+ <xsl:value-of select="$style-position-2/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="color-border">
+ <xsl:choose>
+ <xsl:when test="$style-position-0 and string-length($style-position-0/@w:color) = 6">
+ <xsl:value-of select="$style-position-0/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-0 and $style-position-0/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:when test="$style-position-1 and string-length($style-position-1/@w:color) = 6">
+ <xsl:value-of select="$style-position-1/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1 and $style-position-1/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:when test="$style-position-2 and string-length($style-position-2/@w:color) = 6">
+ <xsl:value-of select="$style-position-2/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2 and $style-position-2/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- mapping border line widths. glu -->
+ <xsl:choose>
+ <xsl:when test="$border-style = 'nil' or $border-style = 'none'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">hidden</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$border-style = 'single'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.002cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.035cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.088cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.141cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.176cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'double'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'triple'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 5">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-small-gap' or $border-style = 'thick-thin-small-gap'">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-small-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-small-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-small-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-medium-gap' or $border-style = 'thick-thin-medium-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.212cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-medium-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.212cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-large-gap' or $border-style = 'thick-thin-large-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-large-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 5">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'wave') or $border-style = 'dash-dot-stroked'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'three-d')">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.035cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.088cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.176cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'set')">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:tbl">
+ <xsl:choose>
+ <xsl:when test="w:tblPr/w:tblpPr">
+ <!-- if the table is surrounded by text then put the table into a draw:text-box -->
+ <xsl:element name="text:p">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:style-name">
+ <xsl:text>TableFrame</xsl:text>
+ <xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:name">TableFr<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_anchor_type">
+ <xsl:choose>
+ <xsl:when test="name(..) = 'w:tc' ">
+ <xsl:text>as-char</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>paragraph</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:anchor-type">
+ <xsl:value-of select="$tbl_anchor_type"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_draw_textbox_width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <!-- adjust the width of draw:text-box containing a table with 20dxa + table-width -->
+ <xsl:with-param name="value" select="concat(string(number(sum(w:tblGrid/w:gridCol/@w:w) +20)), 'twip' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:width">
+ <xsl:value-of select="concat ($tbl_draw_textbox_width, 'in') "/>
+ </xsl:attribute>
+ <xsl:if test="w:tblPr/w:tblpPr/@w:tblpX">
+ <xsl:variable name="x_distance_from_anchor">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpX, 'twip' ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:x">
+ <xsl:value-of select="concat ($x_distance_from_anchor, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblPr/w:tblpPr/@w:tblpY">
+ <xsl:variable name="y_distance_from_anchor">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpY, 'twip' ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:y">
+ <xsl:value-of select="concat ($y_distance_from_anchor, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--create table in draw:text-box to produce table wrapping text effect-->
+ <xsl:element name="draw:text-box">
+ <xsl:element name="table:table">
+ <xsl:if test="w:tblPr">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ <!--draw:text-box end -->
+ </xsl:element>
+ <!-- text:p end -->
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if the table is not surrounded by text then put the table into a draw:text-box -->
+ <xsl:element name="table:table">
+ <xsl:if test="w:tblPr">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:tblGrid">
+ <xsl:apply-templates select="w:gridCol"/>
+ </xsl:template>
+ <xsl:template match="w:gridCol">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tr">
+ <xsl:element name="table:table-row">
+ <!-- generate row in table and add attribute of table:style-name if the style:style exists. cp tom chen. -->
+ <xsl:if test="w:trPr/w:trHeight">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tc">
+ <xsl:element name="table:table-cell">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:if test="w:tcPr/w:gridSpan and w:tcPr/w:gridSpan/@w:val &gt; 0">
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:value-of select="w:tcPr/w:gridSpan/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="convert2in_special">
+ <!-- this template is specially to deal with w:type ='dxa' situation -->
+ <xsl:param name="orignal_value"/>
+ <xsl:choose>
+ <xsl:when test="contains($orignal_value, 'dxa') ">
+ <xsl:variable name="table_measurement_new_value">
+ <xsl:value-of select="concat( substring-before($orignal_value,'dxa'), 'twip')"/>
+ </xsl:variable>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="$table_measurement_new_value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_text.xsl b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl
new file mode 100644
index 000000000000..0cd5e0dbe59f
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl
@@ -0,0 +1,1062 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: wordml2ooo_text.xsl,v $
+
+ $Revision: 1.11 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" 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: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="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 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:config="urn:oasis:names:tc:opendocument:xmlns:config: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" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template name="create-default-paragraph-styles">
+ <xsl:variable name="default-paragraph-style" select="w:style[@w:default = 'on' and @w:type = 'paragraph']"/>
+ <xsl:if test="$default-paragraph-style">
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties>
+ <xsl:attribute name="style:tab-stop-distance">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(/w:wordDocument/w:docPr/w:defaultTabStop/@w:val,'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true">
+ <xsl:choose>
+ <xsl:when test="/w:wordDocument/w:fonts/w:defaultFonts">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:fareast"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:cs"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:sz">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:sz-cs">
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <!-- if not defined default font size in Word, make it out as 10pt. glu -->
+ <xsl:if test="not($default-paragraph-style/w:rPr/w:sz or w:rPr/w:sz-cs)">
+ <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">10pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang">
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:val">
+ <xsl:attribute name="fo:language">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/ -->
+ </xsl:attribute>
+ <xsl:attribute name="fo:country">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:fareast">
+ <xsl:attribute name="style:language-asian">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="style:country-asian">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/ -->
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:bidi">
+ <xsl:attribute name="style:language-complex">
+ <xsl:choose>
+ <xsl:when test="contains( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-') ">
+ <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="style:country-complex">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')">
+ <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/ -->
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </style:text-properties>
+ </style:default-style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-default-text-styles">
+ <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
+ <style:style style:name="Numbering_20_Symbols" style:display-name="Numbering Symbols" style:family="text"/>
+ <style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">
+ <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/>
+ </style:style>
+ <style:style style:name="Endnote_20_Symbol" style:display-name="Endnote Symbol" style:family="text"/>
+ <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
+ <style:text-properties style:text-position="super 58%"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:p" mode="style">
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/>
+ <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/>
+ <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/>
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))" />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name">wNormal</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties>
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ <style:text-properties>
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ <xsl:apply-templates select="w:rPr"/>
+ </style:text-properties>
+ </style:style>
+ <xsl:if test="w:r/w:br/@w:type='page'">
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}page-break">
+ <xsl:if test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties fo:break-before="page">
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ </style:style>
+ </xsl:if>
+ <xsl:if test="w:r/w:br/@w:type='column'">
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}column-break">
+ <xsl:if test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties fo:break-before="column">
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ </style:style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:pPr">
+ <xsl:if test="w:ind/@w:left">
+ <xsl:attribute name="fo:margin-left">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:left, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:right">
+ <xsl:attribute name="fo:margin-right">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:right, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:first-line">
+ <xsl:attribute name="fo:text-indent">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:first-line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:hanging">
+ <xsl:attribute name="fo:text-indent">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:ind/@w:hanging, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <!-- bi-directional support-->
+ <xsl:if test="w:bidi">
+ <xsl:choose>
+ <xsl:when test="w:bidi/@w:val = 'off'">
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:jc">
+ <xsl:choose>
+ <xsl:when test="w:jc/@w:val = 'center'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:jc/@w:val = 'left'">
+ <xsl:choose>
+ <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')">
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:jc/@w:val = 'right'">
+ <xsl:choose>
+ <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')">
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">justify</xsl:attribute>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:spacing">
+ <xsl:choose>
+ <xsl:when test="w:spacing/@w:line-rule = 'at-least'">
+ <xsl:attribute name="style:line-height-at-least">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:spacing/@w:line-rule = 'auto'">
+ <xsl:attribute name="fo:line-height">
+ <xsl:value-of select="round(w:spacing/@w:line div 240 * 100)"/>%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:spacing/@w:line-rule = 'exact'">
+ <xsl:attribute name="fo:line-height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="w:spacing/@w:before">
+ <xsl:attribute name="fo:margin-top">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:before, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:spacing/@w:after">
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:after, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:shd">
+ <xsl:variable name="background-color">
+ <xsl:choose>
+ <xsl:when test="string-length(w:shd/@w:fill) = 6">
+ <xsl:value-of select="concat('#', w:shd/@w:fill)"/>
+ </xsl:when>
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="w:shd/@w:val = 'solid'">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="$background-color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- patterns are necessary in the future. glu -->
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pageBreakBefore and not(w:pageBreakBefore/@w:val = 'off')">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pageBreakBefore and w:pageBreakBefore/@w:val = 'off'">
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:keepNext">
+ <xsl:attribute name="fo:keep-with-next">always</xsl:attribute>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:keepLines">
+ <xsl:attribute name="style:break-inside">avoid</xsl:attribute>
+ </xsl:if>
+ -->
+ <xsl:if test="w:widowControl='on'">
+ <xsl:attribute name="fo:widows">2</xsl:attribute>
+ <xsl:attribute name="fo:orphans">2</xsl:attribute>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:suppressAutoHyphens">
+ <xsl:attribute name="fo:hyphenate">false</xsl:attribute>
+ </xsl:if>
+ -->
+ <xsl:if test="w:kinsoku/@w:val='off'">
+ <xsl:attribute name="style:line-break">normal</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:overflowPunct/@w:val='off'">
+ <xsl:attribute name="style:punctuation-wrap">simple</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:autoSpaceDE/@w:val='off' or w:autoSpaceDN/@w:val='off'">
+ <xsl:attribute name="style:text-autospace">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:textAlignment">
+ <xsl:choose>
+ <xsl:when test="w:textAlignment/@w:val='center'">
+ <xsl:attribute name="style:vertical-align">middle</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:textAlignment/@w:val='baseline'">
+ <xsl:attribute name="style:vertical-align">bottom</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="w:textAlignment/@w:val"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pBdr">
+ <xsl:if test="w:pBdr/w:top">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:top"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-top">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:top/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:left">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:left"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-left">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:left/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:right">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:right"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-right">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:right/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:bottom">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:bottom"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-bottom">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:bottom/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/*/@w:shadow='on'">
+ <xsl:attribute name="style:shadow">#000000 0.15cm 0.15cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:snapToGrid/@w:val='off'">
+ <xsl:attribute name="style:snap-to-layout-grid">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tabs">
+ <xsl:element name="style:tab-stops">
+ <xsl:for-each select="w:tabs/w:tab">
+ <xsl:element name="style:tab-stop">
+ <xsl:attribute name="style:position">
+ <xsl:if test="@w:pos &lt; 0">
+ <xsl:message>
+ We meet a negative w:pos:<xsl:value-of select="@w:pos"/>.
+ </xsl:message>
+ <xsl:value-of select="'0cm'"/>
+ </xsl:if>
+ <xsl:if test="not(@w:pos &lt; 0)">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(@w:pos, 'twip')"/>
+ </xsl:call-template>cm</xsl:if>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@w:val = 'decimal'">
+ <xsl:attribute name="style:type">char</xsl:attribute>
+ <xsl:attribute name="style:char">
+ <xsl:value-of select="' '"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:val = 'left' or @w:val = 'right' or @w:val = 'center' ">
+ <xsl:attribute name="style:type">
+ <xsl:value-of select="@w:val"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:type">char</xsl:attribute>
+ <xsl:attribute name="style:char">
+ <xsl:value-of select="' '"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- Detect leader chars in tabs (rp) -->
+ <xsl:choose>
+ <xsl:when test="@w:leader = 'hyphen'">
+ <xsl:attribute name="style:leader-style">solid</xsl:attribute>
+ <xsl:attribute name="style:leader-text">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:leader = 'underscore'">
+ <xsl:attribute name="style:leader-style">solid</xsl:attribute>
+ <xsl:attribute name="style:leader-text">_</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:leader = 'dot'">
+ <xsl:attribute name="style:leader-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:leader-text">.</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- end leader chars (rp) -->
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates select="w:rPr" mode="paragraph-properties"/>
+ </xsl:template>
+ <xsl:template match="w:rPr" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="w:rStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:rStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+
+ <xsl:apply-templates select="current()"/>
+<!-- <xsl:call-template name="text-properties"/> -->
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:rPr">
+ <xsl:if test="w:rFonts">
+ <xsl:if test="w:rFonts/@w:ascii">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:if test="ancestor::w:body">
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="ancestor::w:styles">
+ <xsl:if test="w:rFonts/@w:fareast">
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="w:rFonts/@w:fareast"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:rFonts/@w:cs">
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="w:rFonts/@w:cs"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="parent::w:r">
+ <xsl:if test="w:b">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:b-cs">
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:i">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:i-cs">
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:caps">
+ <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:smallCaps">
+ <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:strike">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:dstrike">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:outline">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:shadow">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:imprint">
+ <xsl:attribute name="style:font-relief">engraved</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:emboss">
+ <xsl:attribute name="style:font-relief">embossed</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:vanish">
+ <xsl:attribute name="text:display">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:color[not(@w:val = 'auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="w:color/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:spacing">
+ <xsl:attribute name="fo:letter-spacing">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:val,'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:w/@w:val">
+ <xsl:attribute name="style:text-scale">
+ <xsl:value-of select="concat(w:w/@w:val, '%')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:vertAlign or w:position">
+ <xsl:variable name="height">
+ <xsl:choose>
+ <xsl:when test="w:vertAlign[@w:val = 'superscript' or @w:val = 'subscript']">58%</xsl:when>
+ <xsl:otherwise>100%</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="w:position">
+ <!-- con't get font height easily, so just set w:val as percentage. glu -->
+ <xsl:value-of select="concat( w:position/@w:val, '%')"/>
+ </xsl:when>
+ <xsl:when test="w:vertAlign[@w:val = 'superscript']">super</xsl:when>
+ <xsl:when test="w:vertAlign[@w:val = 'subscript']">sub</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:text-position">
+ <xsl:value-of select="concat($position, ' ', $height)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:sz">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:sz-cs">
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:highlight">
+ <xsl:choose>
+ <xsl:when test="w:highlight/@w:val='black'">
+ <xsl:attribute name="fo:background-color">#000000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='yellow'">
+ <xsl:attribute name="fo:background-color">#ffff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='green'">
+ <xsl:attribute name="fo:background-color">#00ff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='cyan'">
+ <xsl:attribute name="fo:background-color">#00ffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='magenta'">
+ <xsl:attribute name="fo:background-color">#ff00ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='blue'">
+ <xsl:attribute name="fo:background-color">#0000ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='red'">
+ <xsl:attribute name="fo:background-color">#ff0000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-blue'">
+ <xsl:attribute name="fo:background-color">#000080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-cyan'">
+ <xsl:attribute name="fo:background-color">#008080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-green'">
+ <xsl:attribute name="fo:background-color">#008000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-magenta'">
+ <xsl:attribute name="fo:background-color">#800080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-red'">
+ <xsl:attribute name="fo:background-color">#800000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-yellow'">
+ <xsl:attribute name="fo:background-color">#808000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-gray'">
+ <xsl:attribute name="fo:background-color">#808080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='light-gray'">
+ <xsl:attribute name="fo:background-color">#c0c0c0</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:u">
+ <xsl:if test="w:u/@w:val = 'thick' or contains(w:u/@w:val,'-heavy')">
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:u/@w:val = 'double' or contains(w:u/@w:val,'-double')">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="w:u/@w:val = 'words' or w:u/@w:val = 'single' or w:u/@w:val = 'thick' or w:u/@w:val = 'double'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(w:u/@w:val , 'dotted')">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dashed-heavy' or w:u/@w:val = 'dash'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-long' or w:u/@w:val = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-dot-heavy' or w:u/@w:val = 'dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-dot-dot-heavy' or w:u/@w:val = 'dot-dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'wavy-heavy' or w:u/@w:val = 'wavy-double' or w:u/@w:val = 'wavy'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="string-length(style:text-underline-style) &gt; 0">
+ <xsl:attribute name="style:text-underline-style">
+ <xsl:value-of select="w:u/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="w:u/@w:color and not(w:u/@w:color = 'auto')">
+ <xsl:attribute name="style:text-underline-color">#<xsl:value-of select="w:u/@w:color"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:effect[@w:val = 'blink-background']">
+ <xsl:attribute name="style:text-blinking">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:shd and not(w:highlight)">
+ <xsl:if test="string-length(w:shd/@w:fill) = 6">
+ <xsl:attribute name="fo:background-color">#<xsl:value-of select="w:shd/@w:fill"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:em">
+ <xsl:choose>
+ <xsl:when test="w:em/@w:val = 'comma'">
+ <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:em/@w:val = 'under-dot'">
+ <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:em/@w:val = 'dot' or w:em/@w:val = 'circle' ">
+ <xsl:attribute name="style:text-emphasize">
+ <xsl:value-of select=" concat(w:em/@w:val,' below') "/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-emphasize">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:lang">
+ <xsl:if test="w:lang/@w:val">
+ <xsl:attribute name="fo:language">
+ <xsl:choose>
+ <xsl:when test="contains(w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="fo:country">
+ <xsl:choose>
+ <xsl:when test="contains(w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:rPr" mode="paragraph-properties">
+ <!-- right-to-left support-->
+ <xsl:if test="w:rtl and not(w:rtl/@w:val = 'off')">
+ <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:p">
+ <xsl:choose>
+ <!-- because word treats page breaks as separate tags, we must split some paragraphs up so that we can
+ give the sub para a fo:break-before ="page" or column attribute. -->
+ <xsl:when test="w:r[w:br/@w:type='page' or w:br/@w:type='column']">
+ <xsl:call-template name="process-breaks-in-paragraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="process-common-paragraph"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-breaks-in-paragraph">
+ <xsl:variable name="textruns-with-break" select="w:r[w:br/@w:type='page' or w:br/@w:type='column']"/>
+ <xsl:call-template name="create-sub-paragraph">
+ <xsl:with-param name="textruns" select="$textruns-with-break[1]/preceding-sibling::w:r"/>
+ </xsl:call-template>
+ <xsl:for-each select="$textruns-with-break">
+ <xsl:variable name="break-position" select="position()"/>
+ <xsl:call-template name="create-sub-paragraph">
+ <!-- added following-sibling::w:fldSimple | following-sibling::w:hlink | following-sibling::aml:annotation to enable these elements to be processed when there are breaks happen G.Yang -->
+ <xsl:with-param name="textruns" select="following-sibling::w:r[not(w:br/@w:type='page' or w:br/@w:type='column') and (count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position)] | following-sibling::w:fldSimple[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::w:hlink[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::aml:annotation[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] "/>
+ <xsl:with-param name="textruns-with-break" select="current()"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="create-sub-paragraph">
+ <xsl:param name="textruns"/>
+ <xsl:param name="textruns-with-break"/>
+ <xsl:if test="$textruns or $textruns-with-break">
+ <xsl:variable name="curr-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <text:p>
+ <xsl:choose>
+ <xsl:when test="$textruns-with-break">
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat('P',$curr-num,w:br/@w:type, '-break')"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="$textruns-with-break"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat( 'P', $curr-num)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$textruns">
+ <xsl:apply-templates select="$textruns"/>
+ </xsl:if>
+ </text:p>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="process-common-paragraph">
+ <xsl:variable name="heading-or-paragraph">
+ <xsl:choose>
+ <xsl:when test="key('heading-style', w:pPr/w:pStyle/@w:val)">text:h</xsl:when>
+ <xsl:otherwise>text:p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$heading-or-paragraph}">
+ <xsl:if test="$heading-or-paragraph = 'text:h'">
+ <xsl:attribute name="text:outline-level">
+ <xsl:value-of select="key('heading-style',w:pPr/w:pStyle/@w:val)/w:pPr/w:outlineLvl/@w:val + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="curr-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat( 'P', $curr-num)"/>
+ </xsl:attribute>
+ <xsl:variable name="bookmark-and-paragraph" select="preceding::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)] | preceding::w:p"/>
+ <xsl:if test="count($bookmark-and-paragraph) &gt; 0 and name($bookmark-and-paragraph[last()]) = 'aml:annotation'">
+ <xsl:call-template name="create-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="count($bookmark-and-paragraph)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ <xsl:if test="not(following::w:p)">
+ <xsl:apply-templates select="following::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)]"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-bookmark">
+ <xsl:param name="bookmark-and-paragraph"/>
+ <xsl:param name="position"/>
+ <xsl:choose>
+ <xsl:when test="name($bookmark-and-paragraph[$position]) = 'aml:annotation'">
+ <xsl:if test="$position &gt; 0">
+ <xsl:call-template name="create-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="output-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="output-bookmark">
+ <xsl:param name="bookmark-and-paragraph"/>
+ <xsl:param name="position"/>
+ <xsl:apply-templates select="$bookmark-and-paragraph[$position]"/>
+ <xsl:if test="$position &lt; count($bookmark-and-paragraph)">
+ <xsl:call-template name="output-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- WordML contains multiple w:t within one w:r, so in Star Writer text:span should correspond to w:t glu -->
+ <xsl:template match="w:r">
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::w:r) or (w:rPr)">
+ <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.-->
+ <xsl:if test="not (preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )">
+ <text:span>
+ <xsl:choose>
+ <xsl:when test="w:rPr/w:rStyle">
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat('w', translate(w:rPr/w:rStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:rPr">
+ <xsl:variable name="position">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">T<xsl:value-of select="$position + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:span>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES, etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.-->
+ <xsl:if test="not( preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="aml:annotation">
+ <xsl:choose>
+ <xsl:when test="@w:type = 'Word.Bookmark.Start'">
+ <text:bookmark-start text:name="{@w:name}"/>
+ </xsl:when>
+ <xsl:when test="@w:type = 'Word.Bookmark.End'">
+ <xsl:variable name="id" select="@aml:id"/>
+ <text:bookmark-end text:name="{preceding::aml:annotation[@aml:id = $id]/@w:name}"/>
+ </xsl:when>
+ <xsl:when test="@w:type = 'Word.Comment'">
+ <office:annotation office:display="true">
+ <dc:creator>
+ <xsl:value-of select="@aml:author"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="substring(@aml:createdate,1,10)"/>
+ </dc:date>
+ <xsl:apply-templates select="aml:content/w:p"/>
+ </office:annotation>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:hlink">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@w:dest and @w:bookmark">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="concat( @w:dest, concat('#', @w:bookmark) )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:dest">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@w:dest"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:bookmark">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="concat('#', @w:bookmark)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="@w:target">
+ <xsl:attribute name="office:target-frame-name">
+ <xsl:value-of select="@w:target"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:t">
+ <xsl:choose>
+ <xsl:when test="string(.) = ' ' ">
+ <xsl:element name="text:s"/>
+ </xsl:when>
+ <xsl:when test="contains(.,' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="replace-spaces">
+ <xsl:param name="curr-string"/>
+ <xsl:if test="contains($curr-string,' ')">
+ <xsl:value-of select="substring-before($curr-string,' ')"/>
+ <text:s text:c="2"/>
+ <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-string, ' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="$next-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next-string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:tab">
+ <xsl:element name="text:tab"/>
+ </xsl:template>
+ <xsl:template match="w:br">
+ <xsl:if test="@w:type='text-wrapping' or not(@w:type)">
+ <text:line-break/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:footnote">
+ <xsl:variable name="footnote-position">
+ <xsl:number from="/w:wordDocument/w:body" count="w:footnote" level="any"/>
+ </xsl:variable>
+ <text:note text:note-class="footnote" text:id="ftn{$footnote-position}">
+ <text:note-citation/>
+ <text:note-body>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:note-body>
+ </text:note>
+ </xsl:template>
+ <xsl:template match="w:endnote">
+ <xsl:variable name="endnote-position">
+ <xsl:number from="/w:wordDocument/w:body" count="w:endnote" level="any" format="1"/>
+ </xsl:variable>
+ <text:endnote text:id="edn{$endnote-position}">
+ <text:endnote-body>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:endnote-body>
+ </text:endnote>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/body.xsl b/filter/source/xslt/odf2xhtml/export/common/body.xsl
new file mode 100644
index 000000000000..1efa48718c2d
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/body.xsl
@@ -0,0 +1,426 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: body.xsl,v $
+
+ $Revision: 1.3.14.1 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://xml.apache.org/xslt/java" xmlns:urlencoder="http://www.jclark.com/xt/java/java.net.URLEncoder" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi java urlencoder">
+
+
+ <xsl:include href="table_of_content.xsl"/>
+
+
+ <!-- ****************** -->
+ <!-- *** Whitespace *** -->
+ <!-- ****************** -->
+
+ <xsl:template match="text:s">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace">
+ <xsl:param name="whitespaces"/>
+
+ <!--write two space chars as the normal white space character will be stripped
+ and the other is able to break -->
+ <xsl:text>&#160;</xsl:text>
+ <xsl:if test="$whitespaces >= 2">
+ <xsl:call-template name="write-breakable-whitespace-2">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!--write the number of 'whitespaces' -->
+ <xsl:template name="write-breakable-whitespace-2">
+ <xsl:param name="whitespaces"/>
+ <!--write two space chars as the normal white space character will be stripped
+ and the other is able to break -->
+ <xsl:text> </xsl:text>
+ <xsl:if test="$whitespaces >= 2">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="$whitespaces - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- currentSolution: 8 non-breakable-spaces instead of a TAB is an approximation.
+ Sometimes less spaces than 8 might be needed and the output might be more difficult to read-->
+ <xsl:template match="text:tab">
+ <xsl:param name="globalData"/>
+
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="8"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+
+ <!-- *************** -->
+ <!-- *** Textbox *** -->
+ <!-- *************** -->
+
+ <!-- ID / NAME of text-box -->
+ <xsl:template match="@draw:name">
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(.,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <xsl:template match="text:line-break">
+ <xsl:param name="listIndent"/>
+
+ <xsl:element namespace="{$namespace}" name="br"/>
+
+ <!-- line breaks in lists need an indent similar to the list label -->
+ <xsl:if test="$listIndent">
+ <xsl:element namespace="{$namespace}" name="span">
+ <xsl:attribute name="style">margin-left:<xsl:value-of select="$listIndent"/>cm</xsl:attribute>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- currently there have to be an explicit call of the style attribute nodes, maybe the attributes nodes have no priority only order relevant-->
+ <xsl:template name="apply-styles-and-content">
+ <xsl:param name="globalData"/>
+ <xsl:param name="footnotePrefix" />
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:copy-of select="$footnotePrefix"/>
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <!-- ******************* -->
+ <!-- *** References *** -->
+ <!-- ******************* -->
+
+ <xsl:template match="text:reference-ref | text:sequence-ref">
+ <xsl:param name="globalData"/>
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="href">
+ <xsl:text>#</xsl:text>
+ <xsl:choose>
+ <xsl:when test="number(substring(@text:ref-name,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:apply-templates select="@* | node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@text:name">
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(.,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(., '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="text:sequence">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@*" />
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(@text:ref-name,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@text:ref-name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="text:reference-mark">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@*" />
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="number(substring(@text:name,1,1))">
+ <!-- Heuristic: If the first character is a number a 'a_' will be set
+ as prefix, as id have to be of type NMTOKEN -->
+ <xsl:value-of select="concat('a_',translate(@text:name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________'))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(@text:name, '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:element>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="text:reference-mark-start">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@*" />
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:bibliography-mark">
+ <xsl:param name="globalData"/>
+
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:apply-templates select="@* | node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- @text:title exist only in text:bibliography-mark -->
+ <xsl:template match="@text:title">
+ <xsl:attribute name="title">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- @text:url exist only in text:bibliography-mark -->
+ <xsl:template match="@text:url">
+ <xsl:attribute name="href">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="text:user-defined">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+
+ <xsl:template match="office:annotation">
+ <xsl:element name="span">
+ <xsl:attribute name="title">annotation</xsl:attribute>
+ <xsl:attribute name="class">annotation_style_by_filter</xsl:attribute>
+ <xsl:apply-templates select="@*" />
+ <br/>
+ <xsl:text>[ANNOTATION:</xsl:text>
+ <br/>
+ <xsl:apply-templates select="*" mode="annotation"/>
+ <xsl:text>]</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:p" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:text>NOTE: '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="dc:creator" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:attribute name="title">dc:creator</xsl:attribute>
+ <xsl:text>BY '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="dc:date" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:attribute name="title">dc:date</xsl:attribute>
+ <xsl:text>ON '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="meta:date-string" mode="annotation">
+ <br/>
+ <xsl:element name="span">
+ <xsl:attribute name="title">meta-date-string</xsl:attribute>
+ <xsl:text>META DATE '</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>'</xsl:text>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- *************** -->
+ <!-- *** HELPER *** -->
+ <!-- *************** -->
+
+
+ <xsl:template name="create-href">
+ <xsl:param name="href"/>
+
+ <xsl:choose>
+ <!-- internal OOo URL used in content tables -->
+ <xsl:when test="contains($href, '%7Coutline')">
+ <!-- the simple workaround for content tables in a single document is to create create an anchor from every heading element
+ work-around downside: Multiple identical headings won't refer always to the first.
+ -->
+ <xsl:text>#</xsl:text>
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+
+ <xsl:value-of select="concat('a_', translate(normalize-space($title), '.,;: %()[]/\+', '_____________'))"/>
+ </xsl:when>
+ <xsl:when test="self::draw:image[office:binary-data]">
+ <xsl:text>data:image/*;base64,</xsl:text><xsl:value-of select="office:binary-data"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <!-- in case of packed open office document -->
+ <xsl:when test="starts-with($sourceBaseURL, 'jar:') or $isPackageFormat">
+ <xsl:choose>
+ <!-- for images relative to open office document -->
+ <xsl:when test="starts-with($href, '../')">
+ <!-- creating an absolute http URL to the packed image file (removing the '.')-->
+ <xsl:value-of select="concat(substring-after(substring-before($sourceBaseURL, '!'), 'jar:'), '/', $href, $optionalURLSuffix)"/>
+ </xsl:when>
+ <!-- for absolute URLs & absolute paths -->
+ <xsl:when test="contains($href, ':') or starts-with($href, '/')">
+ <xsl:value-of select="concat($href, $optionalURLSuffix)"/>
+ </xsl:when>
+ <!-- for images jared in open office document -->
+ <xsl:otherwise>
+ <xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <!-- for absolute URLs & Paths -->
+ <xsl:when test="contains($href, ':') or starts-with($href, '/')">
+ <xsl:value-of select="concat($href, $optionalURLSuffix)"/>
+ </xsl:when>
+ <!-- for relative URLs -->
+ <xsl:otherwise>
+ <xsl:value-of select="concat($sourceBaseURL, $href, $optionalURLSuffix)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+ <xsl:template match="text()" mode="concatenate">
+ <xsl:value-of select="."/>
+ </xsl:template>
+ <xsl:template match="*" mode="concatenate">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:template>
+
+
+ <!-- ******************** -->
+ <!-- *** Common Rules *** -->
+ <!-- ******************** -->
+
+ <!-- ignore / neglect the following elements -->
+ <xsl:template match="draw:custom-shape | draw:g | office:forms | text:alphabetical-index-mark | text:alphabetical-index-mark-end | text:alphabetical-index-mark-start | text:bibliography-source | text:number | text:reference-mark-end | text:sequence-decls | text:soft-page-break | text:table-of-content-source | text:tracked-changes | text:user-field-decls"/>
+
+ <!-- default template used by purpose-->
+ <xsl:template match="text:bibliography | text:change-end | text:change-start">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- default template for not recognized elements -->
+ <xsl:template match="*">
+ <xsl:param name="globalData"/>
+ <xsl:message>Using default element rule for ODF element '<xsl:value-of select="name()"/>'.</xsl:message>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="@*"/>
+
+ <!-- allowing all matched text nodes -->
+ <xsl:template match="text()">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
new file mode 100644
index 000000000000..1b42ae73a2ca
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -0,0 +1,832 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: style_collector.xsl,v $
+
+ $Revision: 1.3.14.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
+
+
+
+ <!-- ***************************************** -->
+ <!-- *** Gathering office style properties *** -->
+ <!-- ***************************************** -->
+
+ <!-- REASON FOR STYLESHEET:
+ In the OpenOffice documents styles are represented by a hierarchy.
+ (e.g. most styles are inherited from a default style).
+ Many other languages (as XHTML/CSS) do not support inherited styles.
+ The style inheritance have to be made flat/absolute for each style.
+
+ A further reason was, that the earlier style collection mechanism
+ had problems with CSS inline, which do not inherit from XML office defaults
+ nor font:family defaults as the style header does
+ (cp. stylesheet 'style_collector.xsl' and the 'write-default-styles' template)
+
+ RESULT OF STYLESHEET:
+ All styles will be returned in a variable containing styles with their inherited *:
+
+ <all-styles>
+ <style style:family="foo" style:name="x1">
+ <* fo:padding-left="0cm" fo:margin-right="0cm" />
+ </style>
+ <style style:family="muh" style:name="x2" >
+ <* fo:padding-left="3cm" ... />
+ </style>
+ ...
+
+ </all-styles>
+ -->
+
+
+ <xsl:template name="collect-global-odf-properties">
+ <!-- to access the variable as a node-set by XPATH expressions, it is necessary to convert it
+ from a result-tree-fragment (RTF) to a node set by a in a XSLT 1.0 non standarized function -->
+ <xsl:variable name="globalDataRTF">
+ <xsl:call-template name="collect-document-links-RTF" />
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-style-properties">
+ <xsl:with-param name="globalData" select="common:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-style-properties">
+ <xsl:with-param name="globalData" select="xalan:nodeset($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-style-properties">
+ <xsl:with-param name="globalData" select="xt:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <xsl:template name="collect-style-properties">
+ <xsl:param name="globalData" />
+
+ <!-- Add the input file references to the new collected style properties -->
+ <xsl:variable name="globalDataRTF">
+ <xsl:copy-of select="$globalData" />
+ <xsl:call-template name="collect-style-properties-RTF">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="map-odf-style-properties">
+ <xsl:with-param name="globalData" select="common:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="map-odf-style-properties">
+ <xsl:with-param name="globalData" select="xalan:nodeset($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="map-odf-style-properties">
+ <xsl:with-param name="globalData" select="xt:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="collect-document-links-RTF">
+ <!-- works for zipped office files, unzipped office files as for flat filter single office file format as well -->
+ <xsl:variable name="documentLinksRTF">
+ <xsl:choose>
+ <xsl:when test="office:document-content">
+ <xsl:element name="styles-file" namespace="">
+ <xsl:copy-of select="document(concat($sourceBaseURL, 'styles.xml'))" />
+ </xsl:element>
+ <xsl:element name="meta-file" namespace="">
+ <xsl:copy-of select="document(concat($sourceBaseURL, 'meta.xml'))" />
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="styles-file" namespace="">
+ <xsl:copy-of select="/" />
+ </xsl:element>
+ <xsl:element name="meta-file" namespace="">
+ <xsl:copy-of select="/" />
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-document-links">
+ <xsl:with-param name="documentLinks" select="common:node-set($documentLinksRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-document-links">
+ <xsl:with-param name="documentLinks" select="xalan:nodeset($documentLinksRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-document-links">
+ <xsl:with-param name="documentLinks" select="xt:node-set($documentLinksRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:template>
+
+
+ <xsl:template name="collect-document-links">
+ <xsl:param name="documentLinks" />
+
+ <xsl:element name="styles-file" namespace="">
+ <xsl:copy-of select="$documentLinks/styles-file/*" />
+ </xsl:element>
+
+ <xsl:element name="meta-file" namespace="">
+ <xsl:copy-of select="$documentLinks/meta-file/*" />
+ </xsl:element>
+
+ <xsl:copy-of select="$documentLinks/styles-file/*/office:styles" />
+ <xsl:copy-of select="$documentLinks/styles-file/*/office:font-face-decls" />
+
+ <!-- office:automatic-styles may be containted in two files (i.e. content.xml and styles.xml).
+ Wild card necessary as top level element differs from flat office files ("SampleName.fsxw") -->
+ <xsl:copy-of select="/*/office:automatic-styles" />
+
+ </xsl:template>
+
+
+ <xsl:template name="collect-style-properties-RTF">
+ <xsl:param name="globalData" />
+
+ <!--** DEFAULT STYLES: First adding some office defaults unwritten in XML -->
+ <xsl:variable name="defaultOfficeStyle-RTF">
+ <xsl:element name="style" namespace="">
+ <xsl:element name="style:properties" />
+ </xsl:element>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-properties-defaults">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="common:node-set($defaultOfficeStyle-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-properties-defaults">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="xalan:nodeset($defaultOfficeStyle-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-properties-defaults">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="xt:node-set($defaultOfficeStyle-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: 'Nodeset'</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="collect-properties-defaults">
+ <xsl:param name="globalData" />
+ <xsl:param name="defaultOfficeStyle" />
+
+ <!--** DEFAULT STYLES: Adding the default styles of a style:family, by adding each office:styles/style:default-style element **-->
+ <xsl:variable name="defaultFamilyStyles-RTF">
+ <xsl:for-each select="$globalData/office:styles/style:default-style">
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:call-template name="create-inherited-style-properties">
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultOfficeStyle/style/*" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="collect-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="$defaultOfficeStyle" />
+ <xsl:with-param name="defaultFamilyStyles" select="common:node-set($defaultFamilyStyles-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="collect-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="$defaultOfficeStyle" />
+ <xsl:with-param name="defaultFamilyStyles" select="xalan:nodeset($defaultFamilyStyles-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="collect-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="defaultOfficeStyle" select="$defaultOfficeStyle" />
+ <xsl:with-param name="defaultFamilyStyles" select="xt:node-set($defaultFamilyStyles-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="collect-properties">
+ <xsl:param name="globalData" />
+ <xsl:param name="defaultOfficeStyle" />
+ <xsl:param name="defaultFamilyStyles" />
+
+ <!--** traversee all style trees - branch after branch - collecting style properties **-->
+ <xsl:element name="all-doc-styles" namespace="">
+
+ <!-- Background Information:
+
+ There are two different types of styles in the Office:
+ 1) The office:styles from the user pre-defined style templates
+ 2) The automatic:styles, which are created whenever a user uses explicit style formatting.
+
+ The office:styles only have parent styles in the office:styles,
+ but automatic:styles may inherit from both office:styles and themself.
+ -->
+
+ <!--** traversee all office:styles trees beginning with the top-level styles **-->
+ <xsl:for-each select="$globalData/office:styles/style:style[not(@style:parent-style-name)]">
+ <!-- Looking for parents from style:family
+ <xsl:for-each select="$globalData/office:styles/style:style[@style:family=current()/@style:family][not(@style:parent-style-name)]"> -->
+ <xsl:choose>
+ <xsl:when test="$defaultFamilyStyles/style[@style:family=current()/@style:family]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultFamilyStyles/style[@style:family=current()/@style:family]/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultOfficeStyle/style/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--** creates a style element with style:name and style:family attribute and
+ an element representing the absolute style properties style:property ** -->
+ </xsl:for-each>
+
+ <!--** traversee all office:automatic-styles trees beginning with the top-level styles **-->
+ <xsl:for-each select="$globalData/office:automatic-styles/style:style[not(@style:parent-style-name)]">
+ <!--** creates a style element with style:name and style:family attribute and
+ an element representing the absolute style properties style:property ** -->
+ <xsl:choose>
+ <xsl:when test="$defaultFamilyStyles/style[@style:family=current()/@style:family]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultFamilyStyles/style[@style:family=current()/@style:family]/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$defaultOfficeStyle/style/*" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:for-each>
+
+ </xsl:element>
+ <!-- debug output in case only styles should be given out (regression test) -->
+ <xsl:if test="$onlyStyleOutputEnabled">
+ <xsl:element name="defaultOfficeStyle" namespace="">
+ <xsl:copy-of select="$defaultOfficeStyle" />
+ </xsl:element>
+ <xsl:element name="defaultFamilyStyles" namespace="">
+ <xsl:copy-of select="$defaultFamilyStyles" />
+ </xsl:element>
+ </xsl:if>
+
+ </xsl:template>
+
+
+ <xsl:template name="inherit-style-for-self-and-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="inheritedStyleProperties" />
+ <xsl:param name="searchOnlyInAutomaticStyles" />
+
+ <!--** create an absolute style by inherting properties from the given parent properties **-->
+ <xsl:variable name="newStyleProperties-RTF">
+ <xsl:call-template name="create-inherited-style-properties">
+ <xsl:with-param name="inheritedStyleProperties" select="$inheritedStyleProperties" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:variable name="newStyleProperties" select="common:node-set($newStyleProperties-RTF)" />
+
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:copy-of select="@style:name" />
+ <xsl:copy-of select="$newStyleProperties" />
+ </xsl:element>
+
+ <xsl:choose>
+ <xsl:when test="$searchOnlyInAutomaticStyles">
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--** for all automatic-children of the current office:styles **-->
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:variable name="newStyleProperties" select="xalan:nodeset($newStyleProperties-RTF)" />
+
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:copy-of select="@style:name" />
+ <xsl:copy-of select="$newStyleProperties" />
+ </xsl:element>
+
+ <xsl:choose>
+ <xsl:when test="$searchOnlyInAutomaticStyles">
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--** for all automatic-children of the current office:styles **-->
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:variable name="newStyleProperties" select="xt:node-set($newStyleProperties-RTF)" />
+
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="@style:family" />
+ <xsl:copy-of select="@style:name" />
+ <xsl:copy-of select="$newStyleProperties" />
+ </xsl:element>
+
+ <xsl:choose>
+ <xsl:when test="$searchOnlyInAutomaticStyles">
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="true()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--** for all automatic-children of the current office:styles **-->
+ <xsl:call-template name="get-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="false()" />
+ <xsl:with-param name="inheritedStyleProperties" select="$newStyleProperties/*" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="get-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="searchOnlyInAutomaticStyles" />
+ <xsl:param name="inheritedStyleProperties" select="*" />
+
+<!-- QUESTION: Parent style is only unique by name and family, but what about cross family inheritance? -->
+ <!-- For each child style (that is every style which has the given parentStyleName as style:parent-style-name and the same style:family -->
+ <xsl:variable name="parentStyleFamily" select="@style:family" />
+ <xsl:variable name="parentStyleName" select="@style:name" />
+ <xsl:if test="not($searchOnlyInAutomaticStyles)">
+ <xsl:for-each select="$globalData/office:styles/style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$inheritedStyleProperties" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="$searchOnlyInAutomaticStyles" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:for-each select="$globalData/office:automatic-styles/style:style[@style:family=$parentStyleFamily and @style:parent-style-name=$parentStyleName]">
+ <xsl:call-template name="inherit-style-for-self-and-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="inheritedStyleProperties" select="$inheritedStyleProperties" />
+ <xsl:with-param name="searchOnlyInAutomaticStyles" select="$searchOnlyInAutomaticStyles" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+
+
+ <xsl:template name="create-inherited-style-properties">
+ <xsl:param name="inheritedStyleProperties" />
+
+ <xsl:element name="style:properties">
+ <!-- Writing all inherited style properties -->
+ <xsl:for-each select="$inheritedStyleProperties/@*">
+ <xsl:sort select="name()" />
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+
+ <!--All current attributes will override already inserted attributes of the same name
+ XSLT Spec: "Adding an attribute to an element replaces any existing attribute of that element with the same expanded-name." -->
+ <xsl:for-each select="*/@*[name() != 'style:font-size-rel']">
+ <xsl:copy-of select="." />
+ </xsl:for-each>
+
+ <xsl:if test="*/@style:font-size-rel">
+<!--
+ The intheritedStyleProperties should include a absolute Font Size, but
+ <style:properties
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ style:font-name="Courier New"
+ fo:language="en"
+ fo:country="US"
+ style:font-name-asian=Courier New"
+ style:font-name-complex="Courier New"/>
+-->
+ <xsl:variable name="fontSizeAbsolute">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$inheritedStyleProperties/@fo:font-size" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="fontSizeRelative">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="*/@style:font-size-rel" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="$fontSizeAbsolute + $fontSizeRelative"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+
+ <!-- providing tabulator indentation -->
+ <xsl:copy-of select="$inheritedStyleProperties/style:tab-stops"/>
+ <xsl:copy-of select="*/style:tab-stops"/>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- debugging & testing purpose -->
+ <xsl:template name="write-collected-styles">
+ <xsl:param name="globalData" />
+
+ <xsl:message>&lt;all-doc-styles&gt;</xsl:message>
+ <xsl:for-each select="$globalData/all-doc-styles/style">
+ <xsl:message>&lt;style</xsl:message>
+ <xsl:message>style:family="<xsl:value-of select="current()/@style:family" />"&gt;</xsl:message>
+ <xsl:message>style:name="<xsl:value-of select="current()/@style:name" />" </xsl:message>
+ <xsl:message> &lt;*</xsl:message>
+ <xsl:for-each select="*/@*">
+ <xsl:message>
+ <xsl:text></xsl:text>
+ <xsl:value-of select="name()" />="<xsl:value-of select="." />"</xsl:message>
+ </xsl:for-each>
+ <xsl:message>/&gt;</xsl:message>
+ <xsl:message>&lt;/style&gt;</xsl:message>
+ </xsl:for-each>
+ <xsl:message>&lt;/all-doc-styles&gt;</xsl:message>
+ </xsl:template>
+
+ <xsl:template name="map-odf-style-properties">
+ <xsl:param name="globalData" />
+
+ <xsl:choose>
+ <!--+++++ DEBUG STYLE OUTPUT FOR REGRESSION TEST +++++-->
+ <!-- create styles file from the style variable (testing switch) -->
+ <xsl:when test="$onlyStyleOutputEnabled">
+
+ <xsl:element name="debug-output" namespace="">
+ <xsl:copy-of select="$globalData" />
+ <xsl:call-template name="map-odf-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+
+ <!-- create XHTML file -->
+ <xsl:otherwise>
+ <!-- to access the variable like a node-set it is necessary to convert it
+ from a result-tree-fragment (RTF) to a node set using the James Clark extension -->
+ <xsl:variable name="globalDataRTF">
+ <!-- raw properties still needed for table width attribute creation -->
+ <xsl:copy-of select="$globalData" />
+ <xsl:call-template name="map-odf-properties">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="start-main">
+ <xsl:with-param name="globalData" select="common:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="start-main">
+ <xsl:with-param name="globalData" select="xalan:nodeset($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="start-main">
+ <xsl:with-param name="globalData" select="xt:node-set($globalDataRTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- REASON FOR TEMPLATE:
+ The OpenOffice style properities gathered in the variable 'globalData' have to be mapped to the CSS style format
+ -->
+ <xsl:template name="map-odf-properties">
+ <xsl:param name="globalData" />
+ <xsl:element name="all-styles" namespace="">
+ <xsl:for-each select="$globalData/all-doc-styles/style">
+ <xsl:sort select="@style:family" />
+ <xsl:sort select="@style:name" />
+
+ <xsl:call-template name="writeUsedStyles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="."/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:key name="elementUsingStyle" match="/*/office:body//*" use="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name | @table:default-cell-style-name"/>
+ <xsl:key name="listLabelStyleInStyles" match="/*/office:styles/text:list-style/* |
+ /*/office:styles/style:graphic-properties/text:list-style/*" use="@text:style-name"/>
+
+ <xsl:key name="listLabelStyleInContent" match="/*/office:automatic-styles/text:list-style/* | /*/office:automatic-styles/style:graphic-properties/text:list-style/*" use="@text:style-name"/>
+
+
+ <xsl:variable name="documentRoot" select="/" />
+ <xsl:template name="writeUsedStyles">
+ <xsl:param name="globalData" />
+ <xsl:param name="style"/>
+
+ <!-- for-each changes the key environment from the previously globalData back to the document root -->
+ <xsl:for-each select="$documentRoot">
+ <!-- only styles, which are used in the content are written as CSS styles -->
+ <xsl:choose>
+ <xsl:when test="key('elementUsingStyle', $style/@style:name)/@* or key('listLabelStyleInContent', $style/@style:name)/@*">
+ <xsl:call-template name="writeUsedStyles2">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="$style" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="not(office:document-content)">
+ <xsl:if test="key('listLabelStyleInStyles', $style/@style:name)/@* or /*/office:styles/text:notes-configuration[@text:citation-style-name = $style/@style:name or /*/office:styles/@text:citation-body-style-name=$style/@style:name]">
+ <!-- if there are consecutive paragraphs with borders (OR background AND margin ), only the first and the last have the top/bottom border
+ unless style:join-border="false" -->
+ <xsl:call-template name="writeUsedStyles2">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="$style" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="document($stylesFileURL)">
+ <xsl:if test="key('listLabelStyleInStyles', $style/@style:name)/@* or /*/office:styles/text:notes-configuration[@text:citation-style-name = $style/@style:name or /*/office:styles/@text:citation-body-style-name=$style/@style:name]">
+ <!-- if there are consecutive paragraphs with borders (OR background AND margin ), only the first and the last have the top/bottom border
+ unless style:join-border="false" -->
+ <xsl:call-template name="writeUsedStyles2">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="style" select="$style" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="writeUsedStyles2">
+ <xsl:param name="globalData" />
+ <xsl:param name="style"/>
+ <xsl:choose>
+ <xsl:when test="
+ $style/@style:family='paragraph'
+ and((
+ (
+ $style/*/@fo:border-top
+ or $style/*/@fo:border-bottom
+ or $style/*/@fo:border
+ )
+ and
+ (
+ not($style/*/@style:join-border)
+ or $style/*/@style:join-border = 'true'
+ )
+ )
+ or
+ (
+ (
+ $style/*/@fo:margin-top
+ or $style/*/@fo:margin-bottom
+ or $style/*/@fo:margin
+ )
+ and
+ ( $style/*/@fo:background-color
+ and
+ not($style/*/fo:background-color='transparent')
+ )
+ )
+ )">
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderStart')" /></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-bottom')][not(name() = 'fo:padding-bottom')][not(name() = 'fo:margin-bottom')][not(name() = 'fo:margin')]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:apply-templates mode="paragraphMerge" select="$style/*/@*[name() = 'fo:margin-bottom' or name() = 'fo:margin']">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:text> border-bottom-style:none; </xsl:text>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:copy-of select="$style/@style:name" />
+ <xsl:attribute name="mergedBorders"><xsl:value-of select="true()" /></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-top') and not(name() = 'fo:border-bottom')][not(name() = 'fo:padding-top') and not(name() = 'fo:padding-bottom')][not(name() = 'fo:margin-top') and not(name() = 'fo:margin-bottom')][not(name() = 'fo:margin')]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:apply-templates mode="paragraphMerge" select="$style/*/@*[name() = 'fo:margin-top' or name() = 'fo:margin-bottom' or name() = 'fo:margin']">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:text> border-top-style:none; border-bottom-style:none; </xsl:text>
+ </xsl:element>
+ </xsl:element>
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderEnd')" /></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-top')][not(name() = 'fo:padding-top')][not(name() = 'fo:margin-top')][not(name() = 'fo:margin')]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:apply-templates mode="paragraphMerge" select="$style/*/@*[name() = 'fo:margin-top' or name() = 'fo:margin']">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <xsl:text> border-top-style:none;</xsl:text>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="not(key('listLabelStyleInStyles', $style/@style:name)/@*)">
+ <xsl:element name="style" namespace="">
+ <xsl:copy-of select="$style/@style:family" />
+ <xsl:copy-of select="$style/@style:name" />
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style" namespace="">
+ <xsl:attribute name="style:family">none</xsl:attribute>
+ <xsl:attribute name="style:name"><xsl:value-of select="$style/@style:name"/></xsl:attribute>
+ <xsl:element name="final-properties" namespace="">
+ <xsl:apply-templates select="$style/*/@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template mode="paragraphMerge" match="@fo:margin | @fo:margin-top | @fo:margin-bottom | @fo:margin-left | @fo:margin-right">
+ <xsl:text>padding</xsl:text>
+ <xsl:value-of select="substring-after(name(), 'fo:margin')"/>
+ <xsl:text>:</xsl:text>
+ <!-- Map once erroneusly used inch shortage 'inch' to CSS shortage 'in' -->
+ <xsl:choose>
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
new file mode 100644
index 000000000000..8f5aa99e0cd8
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_mapping_css.xsl
@@ -0,0 +1,359 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: style_mapping_css.xsl,v $
+
+ $Revision: 1.3.14.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
+
+
+ <!-- *** Properties with a 'fo:' prefix *** -->
+ <xsl:template match="@fo:background-color">
+ <xsl:text>background-color:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@fo:border | @fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right">
+ <xsl:variable name="borderType" select="substring-after(name(), ':')"/>
+ <xsl:choose>
+ <xsl:when test=". = 'none'">
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-style:none; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="borderWidth" select="substring-before(., ' ')"/>
+ <xsl:variable name="borderStyle" select="substring-before(substring-after(., ' '), ' ')"/>
+ <xsl:variable name="borderColor" select="substring-after(substring-after(., ' '), ' ')"/>
+
+ <!-- More information at template 'round-up-border-width' -->
+ <xsl:variable name="borderWidthFixed">
+ <xsl:call-template name="round-up-border-width">
+ <xsl:with-param name="borderWidth" select="$borderWidth"/>
+ <xsl:with-param name="multiplier">
+ <xsl:choose>
+ <xsl:when test="$borderStyle = 'double'">3</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-width:</xsl:text>
+ <xsl:value-of select="$borderWidthFixed"/>
+ <xsl:text>; </xsl:text>
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-style:</xsl:text>
+ <xsl:value-of select="$borderStyle"/>
+ <xsl:text>; </xsl:text>
+ <xsl:value-of select="$borderType"/>
+ <xsl:text>-color:</xsl:text>
+ <xsl:value-of select="$borderColor"/>
+ <xsl:text>; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- NOTE: Still there have to be placed a <br clear='all' /> to disable the flow!!!!-->
+ <xsl:template match="@fo:clear">
+ <xsl:text>clear:both; </xsl:text>
+ </xsl:template>
+
+ <!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
+ <xsl:template match="@fo:color |@svg:font-family |@fo:font-size |@fo:font-style |@fo:font-weight |@fo:text-indent |@fo:text-shadow">
+ <xsl:value-of select="substring-after(name(), ':')"/>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <!-- Maps fo:margin as well fo:margin-top, fo:margin-bottom, fo:padding-left, fo:margin-right -->
+ <!-- Maps fo:padding as well fo:padding-top, fo:padding-bottom, fo:padding-left, fo:padding-right -->
+ <xsl:template match="@fo:letter-spacing | @fo:line-height | @fo:width |@fo:margin | @fo:margin-top | @fo:margin-bottom | @fo:margin-left | @fo:margin-right | @fo:padding | @fo:padding-top | @fo:padding-bottom | @fo:padding-left | @fo:padding-right">
+ <xsl:value-of select="substring-after(name(), ':')"/>
+ <xsl:text>:</xsl:text>
+ <!-- Map once erroneusly used inch shortage 'inch' to CSS shortage 'in' -->
+ <xsl:choose>
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@fo:text-align">
+ <!-- 'important' is necessary as table cell value alignment is decided by runtime over the valuetype
+ Otherwise a table cell style-class would always be outnumbered by the run-time alignment value -->
+ <xsl:choose>
+ <xsl:when test="contains(., 'start')">
+ <xsl:choose>
+ <xsl:when test="parent::*/@style:writing-mode and contains(parent::*/@style:writing-mode, 'rl')">
+ <xsl:text>text-align:right ! important; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:left ! important; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains(., 'end')">
+ <xsl:choose>
+ <xsl:when test="parent::*/@style:writing-mode and contains(parent::*/@style:writing-mode, 'rl')">
+ <xsl:text>text-align:left ! important;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:right ! important; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>text-align:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text> ! important; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@style:vertical-align">
+ <xsl:choose>
+ <xsl:when test="contains(., 'bottom')">
+ <xsl:text>vertical-align:bottom; </xsl:text>
+ </xsl:when>
+ <xsl:when test="contains(., 'middle')">
+ <xsl:text>vertical-align:middle; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>vertical-align:top; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- *** Properties with a 'style:' prefix *** -->
+ <!-- NOTE: Can 'inside' | 'from-inside' better be handled:
+ <!ATTLIST * style:horizontal-pos (from-left|left|center|right|from-inside|inside|outside)#IMPLIED>-->
+ <xsl:template match="@style:horizontal-pos">
+ <xsl:choose>
+ <xsl:when test=".='left'">
+ <xsl:text>text-align:left; </xsl:text>
+ </xsl:when>
+ <xsl:when test=". = 'right'">
+ <xsl:text>text-align:right; </xsl:text>
+ </xsl:when>
+ <xsl:when test=".='center'">
+ <xsl:text>text-align:center; </xsl:text>
+ </xsl:when>
+ <!-- NOTE: currently other values are not used.
+ If the property value is from-left or from-inside,
+ the svg:x attribute associated with the frame element specifies
+ the horizontal position of the frame.
+ Otherwise the svg:x attribute is ignored for text documents.
+ -->
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@style:column-width">
+ <xsl:text>width:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@style:text-underline-style">
+ <xsl:text>text-decoration:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test=".='none'">
+ <xsl:text>none ! important</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>underline</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@style:font-name">
+ <xsl:param name="globalData" />
+
+ <xsl:text>font-family:</xsl:text>
+ <xsl:variable name="content" select="."/>
+ <xsl:variable name="quote">'</xsl:variable>
+ <xsl:variable name="fontName" select="$globalData/office:font-face-decls/style:font-face[@style:name=$content]/@svg:font-family" />
+ <xsl:value-of select="translate($fontName, $quote, '')"/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@style:row-height">
+ <xsl:text>height:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@svg:strikethrough-position">
+ <xsl:if test="not(.='none')">
+ <xsl:text>text-decoration:line-through; </xsl:text>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="@style:text-position">
+ <xsl:if test="contains(., 'sub')">
+ <xsl:text>vertical-align:sub; </xsl:text>
+ <xsl:if test="contains(., '%')">
+ <xsl:text>font-size:</xsl:text>
+ <xsl:value-of select="substring-after(., 'sub ')"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="contains(., 'super')">
+ <xsl:text>vertical-align:super; </xsl:text>
+ <xsl:if test="contains(., '%')">
+ <xsl:text>font-size:</xsl:text>
+ <xsl:value-of select="substring-after(., 'super ')"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="@style:vertical-pos">
+ <xsl:choose>
+ <xsl:when test=".='from-top'">
+ <xsl:text>vertical-align:top; </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>vertical-align:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@style:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(., 'inch')">
+ <xsl:value-of select="substring-before(.,'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+ <xsl:template match="@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:template>
+ <xsl:template match="@style:writing-mode">
+ <xsl:text>writing-mode:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:template>
+ <!-- *** Properties with a no 'fo:' or 'style:' prefix *** -->
+ <xsl:template match="@table:align">
+ <xsl:choose>
+ <xsl:when test=".='left'">
+ <!-- Note: problems with meeting minutes example
+ <xsl:text>float:right; </xsl:text> --></xsl:when>
+ <xsl:when test=".='right'">
+ <!-- Note: problems with meeting minutes example
+ <xsl:text>float:left; </xsl:text> --></xsl:when>
+ <xsl:otherwise>
+ <xsl:text>float:none; </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="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:template>
+
+ <!-- Changing border width measure to cm and enlarging border-width to the Mozilla browser(1.7)
+ visible minimum width
+ - 0.0133cm for solid style
+ - 0.0399cm for double style
+ as there are three border lines painted -->
+ <xsl:template name="round-up-border-width">
+ <xsl:param name="borderWidth"/>
+ <xsl:param name="multiplier"/>
+
+ <xsl:variable name="borderWidthByCentimeter">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$borderWidth"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="minimalBorderWidth" select="0.0133 * $multiplier"/>
+ <xsl:choose>
+ <xsl:when test="number($borderWidthByCentimeter) &lt; $minimalBorderWidth">
+ <xsl:value-of select="$minimalBorderWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$borderWidthByCentimeter"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
+
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
new file mode 100644
index 000000000000..4c4d1b246c6a
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: table.xsl,v $
+
+ $Revision: 1.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
+
+
+ <!-- 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" />
+
+ <xsl:param name="tableElement" select="'table'" />
+
+ <!-- ******************* -->
+ <!-- *** main table *** -->
+ <!-- ******************* -->
+
+
+ <xsl:template match="table:table" name="table:table">
+ <xsl:param name="globalData" />
+
+ <!-- The table will only be created if the table:scenario is active -->
+ <xsl:if test="not(table:scenario) or table:scenario/@table:is-active">
+ <xsl:call-template name="create-table">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+
+
+ <xsl:template name="create-table">
+ <xsl:param name="globalData" />
+
+ <!-- by default '1', for each new sub/inner/nested table the number counts one up -->
+ <xsl:variable name="tableLevel" select="count(ancestor-or-self::table:table)" />
+ <!-- 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')][count(ancestor-or-self::table:table) = $tableLevel] |
+ table:table-header-rows/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel] |
+ table:table-row-group/descendant::table:table-row[not(@table:visibility = 'collapse' or @table:visibility = 'filter')][count(ancestor-or-self::table:table) = $tableLevel]" />
+ <!-- As the alignment of a table is by 'align' attribut is deprecated and as the CSS 'float' attribute not well displayed,
+ we do a trick by encapsulating the table with a aligned 'div' element-->
+ <xsl:variable name="table-alignment" select="key('styles', @style:name = current()/@table:style-name)/*/@table:align" />
+ <xsl:choose>
+ <xsl:when test="string-length($table-alignment) != 0">
+ <xsl:element namespace="{$namespace}" name="div">
+ <xsl:attribute name="style">
+ <xsl:choose>
+ <xsl:when test='$table-alignment="left" or $table-alignment="margins"'>
+ <xsl:text>text-align:left</xsl:text>
+ </xsl:when>
+ <xsl:when test='$table-alignment="right"'>
+ <xsl:text>text-align:right</xsl:text>
+ </xsl:when>
+ <xsl:when test='$table-alignment="center"'>
+ <xsl:text>text-align:center</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:call-template name="create-table-element">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-table-element">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="create-table-element">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+
+ <xsl:element namespace="{$namespace}" name="{$tableElement}">
+ <xsl:attribute name="border">0</xsl:attribute>
+ <xsl:attribute name="cellspacing">0</xsl:attribute>
+ <xsl:attribute name="cellpadding">0</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test='name()="table:table"'>
+ <xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:rel-width" />
+ <xsl:if test="$value">
+ <xsl:attribute name="width">
+ <xsl:value-of select="$value" />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="width">100%</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:apply-templates select="@table:style-name">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+
+ <xsl:call-template name="create-column-style-variable">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl
new file mode 100644
index 000000000000..bf7019247700
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_cells.xsl
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: table_cells.xsl,v $
+
+ $Revision: 1.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
+
+
+ <!-- *********************************** -->
+ <!-- *** 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="globalData" />
+ <!-- position of the current input cell to get the correct colum style (hidden are also counted)-->
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="tableDataType" />
+
+
+ <!-- The column position of the current cell has to be determined
+ to get the adequate column styles during later cell creation,
+ or hiding the cell when @table:visibility is not set to 'visible'.
+
+ The position is archieved by adding up all table:number-columns-repeated of the preceding cells.
+ Step1: creating '$precedingCells/quantity/@table:number-columns-repeated').
+ Step2: sum(xxx:nodeset($precedingCells)/quantity) + 1 -->
+ <xsl:variable name="precedingCells">
+ <xsl:for-each select="preceding-sibling::*">
+ <xsl:choose>
+ <!-- maybe a parser is used, which reads the DTD files (e.g. Xerces),
+ then '1' is the default for 'table:number-columns-repeated' -->
+ <xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
+ <xsl:element name="quantity" namespace="">
+ <xsl:text>1</xsl:text>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="quantity" namespace="">
+ <xsl:value-of select="@table:number-columns-repeated" />
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+
+
+
+ <xsl:choose>
+ <xsl:when test="function-available('common: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="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="precedingColumns" select="sum(common:node-set($precedingCells)/*)" />
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </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="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="precedingColumns" select="sum(xalan:nodeset($precedingCells)/*)" />
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <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="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="precedingColumns" select="sum(xt:node-set($precedingCells)/*)" />
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- current node is a table:table-cell -->
+ <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="allTableColumns" />
+ <xsl:param name="globalData" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="precedingColumns" select="0" />
+ <xsl:param name="tableDataType" />
+
+ <xsl:variable name="columnPosition" select="$precedingColumns + 1" />
+
+ <xsl:if test="$debugEnabled">
+ <xsl:message>
+ <xsl:text>
+ table:table-cell #</xsl:text>
+ <xsl:value-of select="$columnPosition" />
+ <xsl:text> has been entered with node value: </xsl:text>
+ <xsl:value-of select="." />
+ <xsl:text>
+ table:number-columns-repeated: </xsl:text>
+ <xsl:value-of select="@table:number-columns-repeated" />
+ <xsl:text>
+ maxRowLength: </xsl:text>
+ <xsl:value-of select="$maxRowLength" />
+ </xsl:message>
+ </xsl:if>
+
+ <!-- only non hidden column will be given out -->
+ <xsl:variable name="currentTableColumn" select="$allTableColumns/table:table-column[position() = $columnPosition]" />
+ <xsl:if test="$currentTableColumn[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]">
+ <xsl:choose>
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:when test="@table:number-columns-repeated > 1">
+ <!-- writes multiple entries of a cell -->
+ <xsl:call-template name="repeat-write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a cell -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="repeat-write-cell">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="columnPosition" />
+ <xsl:param name="currentTableColumn" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="numberColumnsRepeated" />
+ <xsl:param name="tableDataType" />
+
+ <xsl:choose>
+ <!-- This is the current workaround for the flood of cells, simulation background by repeating cell -->
+ <xsl:when test="$numberColumnsRepeated > 1 and $maxRowLength > $columnPosition">
+
+ <!-- writes an entry of a cell -->
+ <xsl:call-template name="write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:if test="$debugEnabled">
+ <xsl:message>+++++++++ cell repetition +++++++++</xsl:message>
+ </xsl:if>
+ <xsl:call-template name="repeat-write-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition + 1" />
+ <xsl:with-param name="currentTableColumn" select="$allTableColumns/table:table-column[position() = ($columnPosition + 1)]" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- This is the current workaround for the flood of cells, simulation background by 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="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="write-cell">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="columnPosition" />
+ <xsl:param name="currentTableColumn" />
+ <xsl:param name="tableDataType" />
+
+ <!-- a non hidden column will be give out -->
+ <xsl:choose>
+ <xsl:when test="$currentTableColumn[not(@table:visibility = 'collapse' or @table:visibility = 'filter')]">
+ <xsl:call-template name="create-table-cell-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="columnPosition" select="$columnPosition" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- a hidden column -->
+ <xsl:otherwise>
+ <xsl:if test="$debugEnabled">
+ <xsl:message>table column is hidden!</xsl:message>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl
new file mode 100644
index 000000000000..f462f0bccd8e
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_columns.xsl
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: table_columns.xsl,v $
+
+ $Revision: 1.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:common="http://exslt.org/common"
+ xmlns:xalan="http://xml.apache.org/xalan"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan">
+
+ <xsl:param name="tableColumnElement" select="'col'" />
+
+ <!-- ******************************************** -->
+ <!-- *** Create table columns style variable *** -->
+ <!-- ******************************************** -->
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-column-style-variable">
+ <xsl:param name="globalData" />
+ <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" />
+ <!-- allTableColumns: Containing all columns of the table, hidden and viewed.
+ - if a column is hidden, if table:visibility has the value 'collapse' or 'filter', otherwise the value is 'visible'
+ - 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="allTableColumns-RTF">
+ <xsl:for-each select="$allTableColumns">
+ <xsl:call-template name="adding-column-styles-entries">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-table-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="common:node-set($allTableColumns-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-table-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="xalan:nodeset($allTableColumns-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-table-children">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="xt:node-set($allTableColumns-RTF)" />
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-table-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+ <xsl:param name="allTableColumns" />
+
+
+ <xsl:for-each select="$allTableColumns/table:table-column">
+ <xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
+
+ <xsl:call-template name="create-column-element">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+
+ <xsl:call-template name="create-table-rows">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- To be OVERWRITTEN -->
+ <xsl:template name="create-column-element" />
+
+ <!-- current node is a table:table-column -->
+ <xsl:template name="adding-column-styles-entries">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+
+ <xsl:choose>
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:when test="not(@table:number-columns-repeated and @table:number-columns-repeated > 1)">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:when>
+ <!-- No higher repetition of cells greater than 99 for the last and second last column.
+ This is a workaround for some sample document (Waehrungsumrechner.sxc),
+ having 230 repeated columns in the second last column to emulate background -->
+ <!-- NOTE: Testcase with a table containing table:table-column-group and/or table:table-header-columns -->
+ <xsl:when test="(last() or (last() - 1)) and @table:number-columns-repeated &gt; 99">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- repeated colums will be written explicit several times in the variable-->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="@table:number-columns-repeated" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- WRITES THE REPEATED COLUMN STYLE EXPLICIT AS AN ELEMENT IN THE COLUMNS-VARIABLE -->
+ <!-- current node is a table:table-column -->
+ <xsl:template name="repeat-adding-table-column">
+ <xsl:param name="table:table-column" />
+ <xsl:param name="numberColumnsRepeated" />
+
+
+ <xsl:choose>
+ <xsl:when test="$numberColumnsRepeated > 1">
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ <!-- repeat calling this method until all elements written out -->
+ <xsl:call-template name="repeat-adding-table-column">
+ <xsl:with-param name="numberColumnsRepeated" select="$numberColumnsRepeated - 1" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- writes an entry of a column in the columns-variable -->
+ <xsl:copy-of select="." />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!--debugEnabled-START-->
+ <!-- giving out the 'allColumnStyle' variable:
+ For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
+ In case of 'column-hidden-flag' attribute the text 'Column is hidden is given out.-->
+ <!-- current node is a table:table -->
+ <xsl:template name="table-debug-allTableColumns">
+ <xsl:param name="allTableColumns" />
+
+ <!-- debug output as table summary attribut in html -->
+ <xsl:attribute name="summary">
+ <xsl:call-template name="table-debug-column-out">
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:attribute>
+ <!-- debug output to console -->
+ <xsl:message>
+ <xsl:call-template name="table-debug-column-out">
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:message>
+ </xsl:template>
+
+ <!-- current node is a table:table -->
+ <xsl:template name="table-debug-column-out">
+ <xsl:param name="allTableColumns" />
+ <xsl:text>
+ DebugInformation: For each 'table:table-column' of the 'allTableColumns' variable the style-name is given out.
+ In case of table:visibility attribute unequal 'visible' the 'column is hidden' no text is given out.
+ </xsl:text>
+ <xsl:for-each select="$allTableColumns/table:table-column">
+ <xsl:choose>
+ <xsl:when test="@table:visibility = 'collapse' or @table:visibility = 'filter' ">
+ <xsl:text> </xsl:text><xsl:value-of select="@table: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="@table:style-name" /><xsl:text> </xsl:text><xsl:value-of select="@table:default-cell-style-name" /><xsl:text>
+ </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+ <!--debugEnabled-END-->
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl
new file mode 100644
index 000000000000..6d76f17c54c6
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table_rows.xsl
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: table_rows.xsl,v $
+
+ $Revision: 1.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi">
+
+
+ <xsl:param name="rowElement" select="'tr'" />
+
+ <!-- ********************************** -->
+ <!-- *** write repeating table rows *** -->
+ <!-- ********************************** -->
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-table-rows">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+ <xsl:param name="allTableColumns" />
+
+ <!-- Some Office Calc documents simulate a background by repeating one of the later cells until end of used space
+ (The value of "table:number-columns-repeated" is enourmous). Writing out all these cells would be fatal in time
+ and output size. Therefore, this global variable shows us the longest row with content. -->
+ <xsl:variable name="maxRowLength" select="count($allTableColumns/table:table-column)" />
+ <xsl:if test="$debugEnabled">
+ <xsl:message>maxRowLength: <xsl:value-of select="$maxRowLength" /></xsl:message>
+ <xsl:call-template name="table-debug-allTableColumns">
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- 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>
+
+ <!-- removes repetition of rows, most probably done for background emulating -->
+ <xsl:for-each select="$allVisibleTableRows">
+ <xsl:choose>
+ <xsl:when test="(last() or (last() - 1)) and @table:number-rows-repeated &gt; 99">
+ <xsl:call-template name="repeat-write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="numberRowsRepeated" select="1" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="repeat-write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="numberRowsRepeated" select="@table:number-rows-repeated" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+
+ <xsl:template name="repeat-write-row">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="numberRowsRepeated" select="1" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="tableDataType" />
+
+ <xsl:choose>
+ <!-- write an entry of a row and repeat calling this method until all elements are written out -->
+ <xsl:when test="$numberRowsRepeated > 1 and table:table-cell">
+ <xsl:call-template name="write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+
+ <!-- NOTE: 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="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="numberRowsRepeated" select="$numberRowsRepeated - 1" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- write a single entry of a row -->
+ <xsl:otherwise>
+ <xsl:call-template name="write-row">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="add-table-row-attributes">
+ <xsl:param name="globalData" />
+
+ <!-- writing the style of the row -->
+ <xsl:if test="@table:style-name">
+ <xsl:call-template name='add-style-properties'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="write-row">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="maxRowLength" />
+ <xsl:param name="tableDataType" />
+
+
+ <xsl:element namespace="{$namespace}" name="{$rowElement}">
+ <xsl:call-template name='add-table-row-attributes'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+
+ <xsl:if test="$debugEnabled">
+ <xsl:message>'tr' element has been added!</xsl:message>
+ </xsl:if>
+
+ <xsl:apply-templates select="table:table-cell">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ <xsl:with-param name="maxRowLength" select="$maxRowLength" />
+ <xsl:with-param name="tableDataType" select="$tableDataType" />
+ </xsl:apply-templates>
+
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- **************************** -->
+ <!-- *** HELPER: table styles *** -->
+ <!-- **************************** -->
+
+ <xsl:template name="add-style-properties">
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="node-position" />
+
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@table:style-name, '. %()/\+', '')" />
+ </xsl:attribute>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl b/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl
new file mode 100644
index 000000000000..bac22f2edb0d
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/common/table_of_content.xsl
@@ -0,0 +1,558 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: table_of_content.xsl,v $
+
+ $Revision: 1.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://xml.apache.org/xslt/java" xmlns:sxg="http://www.jclark.com/xt/java/org.openoffice.xslt.OOoMasterDocument" xmlns:common="http://exslt.org/common" xmlns:xt="http://www.jclark.com/xt" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi java sxg xt common xalan">
+
+ <!-- ****************************** -->
+ <!-- *** Table of Content *** -->
+ <!-- ****************************** -->
+
+ <xsl:param name="currentChildContentRef" />
+ <xsl:param name="contentTableHeadings" />
+ <xsl:param name="contentTableURL" />
+ <xsl:template match="text:table-of-content">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="text:index-body">
+ <xsl:param name="globalData"/>
+
+ <xsl:choose>
+ <xsl:when test="*/text:tab[1] or */*/text:tab[1]">
+ <xsl:call-template name="createIndexBodyTable">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="text:index-title" mode="content-table">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template name="createIndexBodyTable">
+ <xsl:param name="globalData"/>
+ <xsl:variable name="allStyleTabStops-RTF">
+ <xsl:element name="style:tab-stops">
+ <xsl:call-template name="get-tab-stops">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="styleName" select="current()/@text:style-name"/>
+
+ <!--
+ Currently only the style of text:index-body is recognized, but not of a paragraph child containing the text:tab element!
+ <xsl:with-param name="styleName" select="descendant-or-self::*/@text:style-name"/>
+
+ The column width needs to be tabstop plus fo:margin-left paragraph-properties
+ -->
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:variable>
+ <xsl:element namespace="{$namespace}" name="table">
+
+ <xsl:attribute name="border">0</xsl:attribute>
+ <xsl:attribute name="cellspacing">0</xsl:attribute>
+ <xsl:attribute name="cellpadding">0</xsl:attribute>
+ <xsl:if test="parent::*/@text:style-name">
+ <!-- parent as index:body has no style -->
+ <xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/parent::*/@text:style-name]/*/@style:rel-width"/>
+ <xsl:if test="$value">
+ <xsl:attribute name="width">
+ <xsl:value-of select="$value"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(parent::*/@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+
+ <xsl:element namespace="{$namespace}" name="colgroup">
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-col-element">
+ <xsl:with-param name="lastNodePosition" select="count(common:node-set($allStyleTabStops-RTF)/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="allStyleTabStops" select="common:node-set($allStyleTabStops-RTF)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-col-element">
+ <xsl:with-param name="lastNodePosition" select="count(xalan:nodeset($allStyleTabStops-RTF)/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="allStyleTabStops" select="xalan:nodeset($allStyleTabStops-RTF)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-col-element">
+ <xsl:with-param name="lastNodePosition" select="count(xt:node-set($allStyleTabStops-RTF)/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="allStyleTabStops" select="xt:node-set($allStyleTabStops-RTF)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+
+ <!-- add table data -->
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="allStyleTabStops" select="common:node-set($allStyleTabStops-RTF)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="allStyleTabStops" select="xalan:nodeset($allStyleTabStops-RTF)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="allStyleTabStops" select="xt:node-set($allStyleTabStops-RTF)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- ************************************************ -->
+ <!-- *** Create Table for Content Table Paragraph *** -->
+ <!-- ************************************************ -->
+
+ <!-- Usually the paragraph in a content-table are ordered by tab-stops, which can not be displayed correctly by XHTML/CSS
+ Therefore they will be simulated by a table -->
+ <xsl:template match="text:p" mode="content-table">
+ <xsl:param name="globalData"/>
+ <xsl:param name="allStyleTabStops"/>
+
+ <!-- all elements before the first tabStop -->
+ <xsl:variable name="testNo-RTF">
+ <xsl:apply-templates select="node()" mode="cell-content"/>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:variable name="tabNodePositions" select="common:node-set($testNo-RTF)"/>
+ <xsl:element namespace="{$namespace}" name="tr">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="lastNodePosition" select="count($allStyleTabStops/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="position" select="1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:variable name="tabNodePositions" select="xalan:nodeset($testNo-RTF)"/>
+ <xsl:element namespace="{$namespace}" name="tr">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="lastNodePosition" select="count($allStyleTabStops/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="position" select="1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:variable name="tabNodePositions" select="xt:node-set($testNo-RTF)"/>
+ <xsl:element namespace="{$namespace}" name="tr">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="lastNodePosition" select="count($allStyleTabStops/style:tab-stops/style:tab-stop)"/>
+ <xsl:with-param name="position" select="1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">ERROR: Function not found: nodeset</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Gathering all style:tab-stops from a style-hierarchy as siblings -->
+ <xsl:template name="get-tab-stops">
+ <xsl:param name="globalData"/>
+ <xsl:param name="styleName"/>
+ <xsl:variable name="tabStyle" select="key('styles', $styleName)"/>
+
+ <xsl:if test="$tabStyle/*/style:tab-stops/style:tab-stop/@style:position">
+ <xsl:for-each select="$tabStyle/*/style:tab-stops/style:tab-stop">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <xsl:if test="$tabStyle/@style:parent-style-name">
+ <xsl:call-template name="get-tab-stops">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="styleName" select="$tabStyle/@style:parent-style-name"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="create-col-element">
+ <xsl:param name="lastNodePosition"/>
+ <xsl:param name="allStyleTabStops"/>
+
+ <xsl:for-each select="$allStyleTabStops/style:tab-stops/style:tab-stop">
+ <xsl:element namespace="{$namespace}" name="col">
+ <xsl:attribute name="style">
+ <xsl:text>width: </xsl:text>
+ <xsl:choose>
+ <xsl:when test="contains(@style:position, 'cm')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'cm'))"/>
+ <xsl:with-param name="unit" select="'cm'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(@style:position, 'in')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'in'))"/>
+ <xsl:with-param name="unit" select="'in'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(@style:position, 'ch')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'ch'))"/>
+ <xsl:with-param name="unit" select="'ch'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains(@style:position, 'pt')">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="number(substring-before(@style:position,'pt'))"/>
+ <xsl:with-param name="unit" select="'pt'"/>
+ <xsl:with-param name="position" select="position() - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:for-each>
+
+ </xsl:template>
+<!--
+Scenarios tabstops
+
+1) style:type of style:tab-stop is 'right' and earlier tabStop is not right
+ -> Earlier text-nodes and following text-nodes, will be put into an inner table, with two TD first aligned left, with proceding textnodes, the latter aligned right.
+
+2) style:type is 'right' and earlier tabStop is right
+ -> following text-nodes, will be put into a right aligned TD
+
+3) style:type is 'non-right' and earlier tabStop 'non-right' as well
+ -> put the preceding tab stops into a TD (left aligned is default)
+
+4) first style:type would have no right preceding tabStop
+ -> works well with first sceanrios 1 and 3
+
+5) last style:type would be a special case, if it would be left aligned, but this won't happen in our case.. :D
+
+Scenarios unmatched:
+- text:styleposition 'center' will not be matched in our case (effort for nothing), there will be only 'right' and not 'right'
+- If the last tabStop is not from text:stylepostion 'right', the length of the last cell is undefined and a document length must be found.
+ Not happens in our master document case. Also the algorithm below would have to be expanded (cp. scenario 5).
+
+-->
+ <xsl:template name="create-td-elements">
+ <xsl:param name="globalData"/>
+ <xsl:param name="lastNodePosition"/>
+ <xsl:param name="position"/>
+ <xsl:param name="allStyleTabStops"/>
+ <xsl:param name="tabNodePositions"/>
+
+ <xsl:variable name="currentTabStop" select="$allStyleTabStops/style:tab-stops/style:tab-stop[$position]"/>
+ <xsl:variable name="earlierTabStop" select="$allStyleTabStops/style:tab-stops/style:tab-stop[$position - 1]"/>
+ <xsl:choose>
+ <xsl:when test="not($currentTabStop/@style:position) and not($earlierTabStop/@style:position)">
+ <!-- in case no TAB STOP is being set -->
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$currentTabStop/@style:type = 'right'">
+ <xsl:choose>
+ <xsl:when test="$earlierTabStop/@style:type = 'right'">
+ <!--
+ 2) style:type is 'right' and earlier tabStop is right
+ -> following text-nodes, will be put into a right aligned TD -->
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:attribute name="style">
+ <xsl:text>align: right</xsl:text>
+ </xsl:attribute>
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="grab-cell-content-before-tab-stop">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="endingTabStopPosition" select="$position + 1"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="grab-cell-content-before-tab-stop">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="endingTabStopPosition" select="$position"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$earlierTabStop/@style:type = 'right'"></xsl:when>
+ <xsl:otherwise>
+ <!--
+ 3) style:type is 'non-right' and earlier tabStop 'non-right' as well
+ -> put the preceding tab stops into a TD (left aligned is default) -->
+ <xsl:element namespace="{$namespace}" name="p">
+ <xsl:if test="$position = 1">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:element namespace="{$namespace}" name="td">
+ <xsl:call-template name="grab-cell-content-before-tab-stop">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="endingTabStopPosition" select="$position"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="$position != $lastNodePosition">
+ <xsl:call-template name="create-td-elements">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="lastNodePosition" select="$lastNodePosition"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ <xsl:with-param name="tabNodePositions" select="$tabNodePositions"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="grab-cell-content-before-tab-stop">
+ <xsl:param name="globalData"/>
+ <xsl:param name="endingTabStopPosition"/>
+ <xsl:param name="tabNodePositions"/>
+ <xsl:param name="lastNodePosition"/>
+
+ <xsl:choose>
+ <xsl:when test="$endingTabStopPosition = 1">
+ <xsl:apply-templates mode="content-table" select="node()[position() &lt; $tabNodePositions/tab-stop-node-position[$endingTabStopPosition]]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$endingTabStopPosition > $lastNodePosition">
+ <xsl:apply-templates mode="content-table" select="node()[position() > $tabNodePositions/tab-stop-node-position[$endingTabStopPosition - 1]]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="nodesOfNextColumn" select="node()[position() &lt; $tabNodePositions/tab-stop-node-position[$endingTabStopPosition]][position() &gt; $tabNodePositions/tab-stop-node-position[$endingTabStopPosition - 1]]"/>
+ <xsl:choose>
+ <xsl:when test="$nodesOfNextColumn != ''">
+ <xsl:apply-templates mode="content-table" select="$nodesOfNextColumn">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="content-table">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- As the span width will be mapped to column width, the preceding span widths have to be substracted -->
+ <xsl:template name="create-cell-width">
+ <xsl:param name="width"/>
+ <xsl:param name="unit"/>
+ <xsl:param name="position"/>
+ <xsl:param name="allStyleTabStops"/>
+
+ <xsl:choose>
+ <!-- beyond second width -->
+ <xsl:when test="$position > 1">
+ <xsl:call-template name="create-cell-width">
+ <xsl:with-param name="width" select="$width - number(substring-before($allStyleTabStops/style:tab-stops/style:tab-stop[$position]/@style:position,$unit))"/>
+ <xsl:with-param name="unit" select="$unit"/>
+ <xsl:with-param name="position" select="$position - 1"/>
+ <xsl:with-param name="allStyleTabStops" select="$allStyleTabStops"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- second width -->
+ <xsl:when test="$position = 1">
+ <xsl:value-of select="concat($width - number(substring-before($allStyleTabStops/style:tab-stops/style:tab-stop[$position]/@style:position,$unit)), $unit)"/>
+ </xsl:when>
+ <!-- first width -->
+ <xsl:otherwise>
+ <xsl:value-of select="concat($width, $unit)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- ************************************** -->
+ <!-- CREATION OF A CONTENT TABLE LINK -->
+ <!-- ************************************** -->
+
+
+ <!-- content table link -->
+ <xsl:template match="text:a" mode="content-table">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="text">
+ <xsl:choose>
+ <!-- heuristic assumption that first in a content table row, there is numbering (if at all) and than the text,
+ furthermore that a tab will separate the to be neglected page number -->
+ <xsl:when test="text:tab">
+ <xsl:value-of select="text()[1]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="text()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- REFERENCE HANDLING - HREF -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="href">
+ <xsl:text>#</xsl:text>
+ <xsl:value-of select='concat("a_", translate(normalize-space($text), "&#xA;&amp;&lt;&gt;.,;: %()[]/\+", "_______________________________"))'/>
+ </xsl:attribute>
+ <xsl:value-of select="$text"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="text:s" mode="content-table">
+ <xsl:call-template name="write-breakable-whitespace">
+ <xsl:with-param name="whitespaces" select="@text:c"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************** -->
+ <!-- *** Common Rules *** -->
+ <!-- ******************** -->
+
+ <xsl:template match="*" mode="content-table">
+ <xsl:param name="globalData"/>
+
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="*" mode="cell-content">
+ <xsl:if test="name() = 'text:tab' or *[name() = 'text:tab']">
+ <xsl:element name="tab-stop-node-position" namespace="">
+ <xsl:value-of select="position()"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text()" mode="content-table">
+ <!-- Heuristic to remove page numbers (useless in HTML) in the content table
+ usually after a tab -->
+ <xsl:if test="name(preceding-sibling::*[1]) != 'text:tab' and not(number() &gt; -1)">
+ <xsl:value-of select="."/>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
new file mode 100644
index 000000000000..c731cb13b780
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -0,0 +1,2841 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: body.xsl,v $
+
+ $Revision: 1.3.14.6 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.jclark.com/xt" xmlns:common="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xt common xalan" xmlns="http://www.w3.org/1999/xhtml">
+
+
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+
+ <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
+ <xsl:import href="../../common/measure_conversion.xsl"/>
+
+ <!-- common office body element handling -->
+ <xsl:import href="../common/body.xsl"/>
+
+ <!-- common table handling -->
+ <xsl:import href="../common/table/table.xsl"/>
+
+ <!-- xhtml table handling -->
+ <xsl:include href="table.xsl"/>
+
+ <!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key name="styles" match="/*/office:styles/style:style | /*/office:automatic-styles/style:style" use="@style:name"/>
+
+
+ <!-- ************ -->
+ <!-- *** body *** -->
+ <!-- ************ -->
+
+ <xsl:key match="style:style/@style:master-page-name" name="masterPage" use="'count'"/>
+ <xsl:key match="style:master-page" name="masterPageElements" use="@style:name"/>
+ <xsl:key match="style:page-layout" name="pageLayoutElements" use="@style:name"/>
+ <xsl:key name="writingModeStyles" match="/*/office:styles/style:style/style:paragraph-properties/@style:writing-mode | /*/office:automatic-styles/style:style/style:paragraph-properties/@style:writing-mode" use="'test'"/>
+ <xsl:template name="create-body">
+ <xsl:param name="globalData"/>
+
+ <!-- approximation to find the correct master page style (with page dimensions) -->
+ <xsl:variable name="masterPageNames">
+ <!-- Loop over every style:style containing a @style:master-page-name attribute -->
+ <xsl:for-each select="key('masterPage','count')">
+ <!-- Check if this style is being used in the body -->
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
+ <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <xsl:variable name="pageProperties">
+ <xsl:choose>
+ <xsl:when test="not($pageLayoutName) or $pageLayoutName = ''">
+ <xsl:copy-of select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Find the according style:page-layout and store the properties in a variable -->
+ <xsl:copy-of select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="body">
+ <!-- direction of text flow -->
+ <xsl:variable name="writingMode" select="$pageProperties/style:page-layout-properties/@style:writing-mode"/>
+ <xsl:choose>
+ <xsl:when test="$writingMode">
+ <xsl:choose>
+ <xsl:when test="contains($writingMode, 'lr')">
+ <xsl:attribute name="dir">ltr</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($writingMode, 'rl')">
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- As CSS writing-mode is not implemented by all browsers, a heuristic is done -->
+ <xsl:variable name="writingMode" select="key('writingModeStyles', 'test')"/>
+ <xsl:if test="contains($writingMode, 'rl')">
+ <xsl:attribute name="dir">rtl</xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- adapt page size -->
+ <xsl:variable name="pageWidth" select="$pageProperties/style:page-layout-properties/@fo:page-width"/>
+
+ <!-- multiple backgroundimages for different page styles (never used in html) -->
+ <xsl:variable name="backgroundImage" select="$pageProperties/style:page-layout-properties/style:background-image"/>
+ <!-- page margins & background image -->
+ <xsl:if test="$pageWidth or $pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
+ <xsl:attribute name="style">
+ <xsl:if test="$pageWidth">
+ <xsl:text>max-width:</xsl:text>
+ <xsl:value-of select="$pageWidth"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ <xsl:if test="$pageProperties/style:page-layout-properties/@fo:* or $backgroundImage/@xlink:href">
+ <xsl:apply-templates select="$pageProperties/style:page-layout-properties/@fo:*"/>
+ <xsl:if test="$backgroundImage/@xlink:href">
+ <xsl:text>background-image:url(</xsl:text>
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="$backgroundImage/@xlink:href"/>
+ </xsl:call-template>
+ <xsl:text>);</xsl:text>
+
+ <xsl:if test="$backgroundImage/@style:repeat">
+ <xsl:choose>
+ <xsl:when test="$backgroundImage/@style:repeat = 'no-repeat'">
+ <xsl:text>background-repeat:no-repeat;</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>background-repeat:repeat;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$backgroundImage/@style:position">
+ <xsl:text>background-position:</xsl:text>
+ <xsl:value-of select="$backgroundImage/@style:position"/>
+ <xsl:text>;</xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- processing the content of the OpenDocument content file -->
+ <xsl:apply-templates select="/*/office:body/*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ </xsl:element>
+ </xsl:template>
+
+ <!-- processing the content of the OpenDocument content file -->
+ <xsl:template match="office:body/*">
+ <xsl:param name="globalData"/>
+
+ <!-- not using of 'apply-styles-and-content' as the content table information migth have been added to 'globalData' variable -->
+ <xsl:apply-templates select="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name -->
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <!-- writing the footer- and endnotes beyond the body -->
+ <xsl:call-template name="write-text-nodes">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ******************************* -->
+ <!-- *** User Field Declarations *** -->
+ <!-- ******************************* -->
+
+ <xsl:template match="text:user-field-get | text:user-field-input">
+ <xsl:param name="globalData"/>
+
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <xsl:template match="text:conditional-text">
+ <xsl:param name="globalData"/>
+
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <!-- ODF text fields -->
+ <xsl:template match="text:author-initials | text:author-name | text:chapter | text:character-count | text:creation-date | text:creation-time | text:creator | text:date | text:description | text:editing-cycles | text:editing-duration | text:file-name | text:image-count | text:initial-creator | text:keywords | text:modification-date | text:modification-time | text:object-count | text:page-continuation | text:page-count | text:page-number | text:paragraph-count | text:print-date | text:print-time | text:printed-by | text:sender-city | text:sender-company | text:sender-country | text:sender-email | text:sender-fax | text:sender-firstname | text:sender-initials | text:sender-lastname | text:sender-phone-private | text:sender-phone-work | text:sender-position | text:sender-postal-code | text:sender-state-or-province | text:sender-street | text:sender-title | text:sheet-name | text:subject | text:table-count | text:time | text:title | text:user-defined | text:word-count">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="span">
+ <xsl:attribute name="title">
+ <xsl:value-of select="local-name()"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+
+
+ <!-- *************** -->
+ <!-- *** Textbox *** -->
+ <!-- *************** -->
+
+ <xsl:template match="draw:text-box">
+ <xsl:param name="globalData"/>
+
+ <xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:variable name="dimension">
+ <xsl:apply-templates select="@fo:min-width"/>
+ <xsl:apply-templates select="@fo:max-width"/>
+ <xsl:apply-templates select="@fo:min-height"/>
+ <xsl:apply-templates select="@fo:max-height"/>
+ </xsl:variable>
+ <xsl:if test="$dimension">
+ <xsl:attribute name="style">
+ <xsl:value-of select="$dimension"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="@draw:name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@fo:min-width">
+ <xsl:text>min-width:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:max-width">
+ <xsl:text>max-width:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:min-height">
+ <xsl:text>min-height:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+ <xsl:template match="@fo:max-height">
+ <xsl:text>max-height:</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+
+ <!-- inline style helper for the 'div' boxes -->
+ <xsl:template name="svg:height">
+ <xsl:text>height:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(@svg:height, 'inch')">
+ <xsl:value-of select="substring-before(@svg:height, 'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:height"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+ <!-- inline style helper for the 'div' boxes -->
+ <xsl:template name="svg:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:choose>
+ <!-- changing the distance measure: inch to in -->
+ <xsl:when test="contains(@svg:width, 'inch')">
+ <xsl:value-of select="substring-before(@svg:width, 'ch')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+
+
+ <!-- ****************** -->
+ <!-- *** Paragraphs *** -->
+ <!-- ****************** -->
+
+ <xsl:template match="text:p | draw:page">
+ <xsl:param name="globalData"/>
+ <!-- The footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:param name="footnotePrefix"/>
+ <!-- 1) In ODF sometimes the followig children are nested
+ <text:p>
+ <draw:frame>
+ <draw:text-box>
+ <text:p>
+ Which results in a paragraphs (the last text:p) having a paragraph as its anchestor.
+ In HTML a 'p' can only have inline documents (no other 'p' as children'),
+ a 'div' will be given for the ancestors instead.
+ 2) ODF images are embedded in a paragraph, but CSS is not able to express a horizontal alignment for an HTML image (text:align is only valid for block elements).
+ A surrounding 'div' element taking over the image style solves that problem, but the div is invalid as child of a paragraph
+ Therefore the paragraph has to be exchanged with a HTML div element
+ -->
+ <!-- 2DO page alignment fix - PART1 -->
+ <xsl:choose>
+ <xsl:when test="draw:frame and ((normalize-space(text()) != '') or (count(*) &gt; 1 and (not(text:soft-page-break) and count(*) = 2)))">
+ <!-- Create a div, if there is a 'draw:frame' child with either text (not being whitespace alone) and more than the draw:frame alone and
+ not the draw:frame and a soft-page-break alone (which is quite often) -->
+
+ <!-- If there is a frame within the text:p or draw:page, its siblings are surrounded as well by a div and are floating (CSS float) -->
+ <!-- But it makes no sense to create floating if the frame is alone or only together with a soft-page-break not usable for HTML -->
+ <!-- The paragraph is written as DIV as there might be nested paragraphs (see above choose block) -->
+ <xsl:choose>
+ <xsl:when test="name() = 'text:p'">
+ <xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="div">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:copy-of select="$footnotePrefix"/>
+
+ <!-- start floating of frame (and siblings) -->
+ <xsl:apply-templates select="node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="previousFrameWidths" select="0"/>
+ <xsl:with-param name="previousFrameHeights" select="0"/>
+ <!-- 2DO for me (Svante) - Not used, uncertain 4now..
+ <xsl:with-param name="pageMarginLeft">
+ <xsl:call-template name="getPageMarginLeft"/>
+ </xsl:with-param>-->
+ </xsl:apply-templates>
+ </xsl:element>
+ <!-- after the last draw:frame sibling the CSS float is disabled
+ &#160; is an unbreakable whitespace to give conent to the element and force a browser not to ignore the element -->
+ <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
+ </xsl:when>
+ <xsl:when test="text:tab">
+ <!-- If there is a tabulator (ie. text:tab) within a paragraph, a heuristic for ODF tabulators creates a
+ span for every text:tab embracing the following text nodes aligning them according to the tabulator.
+ A line break or another text:tab starts a new text:span, line break even the tab counter for the line.
+ -->
+ <xsl:element name="p">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ <!-- start with first child of the paragraph -->
+ <xsl:variable name="firstChildNode" select="node()[1]" />
+ <xsl:apply-templates select="$firstChildNode" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="tabStops" select="$globalData/all-doc-styles/style[@style:name = current()/@text:style-name]/*/style:tab-stops"/>
+ <xsl:with-param name="parentMarginLeft">
+ <!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
+ <xsl:variable name="paragraphName" select="@text:style-name" />
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
+ <!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
+<!-- 2DO: left-margin in order with bidirectional -->
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="pageMarginLeft">
+ <xsl:call-template name="getPageMarginLeft"/>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <!-- !!Check if paragraph is empty!!
+ OOo writes out empty paragraphs layouted behind an image (= draw:image within draw:frame)
+ those have to be neglected in HTML -->
+ <xsl:when test="name() = 'text:p' and not(text()) and not(*)">
+ <xsl:variable name="isFollowingImage">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::node()[1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$isFollowingImage = 'yes'">
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- A span will be created for every text:tab embracing the following text nodes.
+ A line break or another text:tab starts a new text:span -->
+ <xsl:template match="* | text()" mode="tabHandling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="tabStops"/>
+ <!-- there can be multiple tabs in one line, tabNo guesses the one to apply. By default the first i.e. "1" -->
+ <xsl:param name="tabCount" select="0"/>
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="pageMarginLeft" />
+
+<!-- 2DO: EXCHANGE FOLLOING SIBLING BY VARIABLE -->
+ <xsl:variable name="followingSiblingNode" select="following-sibling::node()[1]"/>
+
+
+ <!--
+ Every tabulator indents its following content, encapuslated in a span
+ element.
+
+ This template have two modes:
+
+ 1) Before the first tabulator it will match as usually paragraph content
+ to HTML.
+ 2) After the first paragraph it will always triggers two recursions.
+ One embraces the following content of a paragraph element into a span.
+ (tabContentHandling)
+ The other calls this template and will now ignore anything else than
+ TAB and LINE-BREAK.
+
+
+ The tabulators and linebreaks are being iterated, one by one to keep track of the tab number
+ -->
+
+
+ <xsl:choose>
+ <xsl:when test="name() = 'text:tab'">
+ <!-- every frame sibling have to be incapuslated within a div with left indent -->
+ <xsl:element name="span">
+ <xsl:choose>
+ <xsl:when test="count($tabStops/style:tab-stop) &lt; 3">
+ <!-- only allow the heuristic when the style has less than 3 TABS -->
+ <xsl:attribute name="style">
+ <xsl:call-template name="createTabIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount + 1"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if there are more than 3 TABS in the style, create a none-breakable-space as whitespace -->
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount + 1"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="name() = 'text:line-break'">
+ <!-- A line-break resets the tabCount to '0' -->
+ <br/>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="0"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- only before the first tab all content is written out -->
+ <xsl:if test="$tabCount = 0">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="tabStops" select="$tabStops"/>
+ <xsl:with-param name="tabCount" select="$tabCount"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="pageMarginLeft" select="$pageMarginLeft"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ This recursion creates the content of a tab (i.e. following siblings
+ till next TAB or LINE BREAK) and ends with the next
+ TAB, LINE-BREAK or with the end of the paragraph.
+ -->
+ <xsl:template match="* | text()" mode="tabContentHandling">
+ <xsl:param name="globalData"/>
+
+ <xsl:if test="(name() != 'text:tab') and (name() != 'text:line-break')">
+ <!-- Write out content -->
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- Apply for the next node -->
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="tabContentHandling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="createTabIndent">
+ <xsl:param name="globalData"/>
+ <xsl:param name="tabStops"/>
+ <xsl:param name="tabCount"/>
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="pageMarginLeft" />
+
+ <xsl:text>position:absolute;left:</xsl:text>
+ <xsl:variable name="tabPosition">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$tabStops/style:tab-stop[$tabCount]/@style:position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="tabIndent">
+ <xsl:choose>
+ <xsl:when test="$tabStops/style:tab-stop[$tabCount]/@style:type = 'center'">
+ <!-- in case of style:type 'center' the text is even before the tab stop,
+ centered around the beginning. As I see currently no way in mapping this,
+ therefore I do some HEURISTIC (minus -2.5cm) -->
+ <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft - 2.5"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabPosition + $parentMarginLeft + $pageMarginLeft"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$tabIndent='NaN'">
+ <xsl:variable name="tabPosition">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$tabStops/style:tab-stop[last()]/@style:position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Heuristic: for every tab that is more than specified give a further 1 cm -->
+ <xsl:value-of select="$parentMarginLeft + $tabPosition + count($tabStops/style:tab-stop) - $tabCount"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabIndent"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>cm;</xsl:text>
+ <xsl:apply-templates select="$tabStops/style:tab-stop[$tabCount]/@style:type"/>
+ </xsl:template>
+
+ <!-- OOo writes out empty paragraphs layouted behind an image,
+ those have to be neglected in HTML
+ This method checks if an empty paragraph is of that kind! -->
+ <xsl:template name="follows-empty-paragraphs-and-image">
+ <xsl:param name="precedingElement" />
+ <xsl:param name="elementToCheck" select="1"/>
+
+ <xsl:choose>
+ <!-- OOo writes out empty paragraphs layouted behind the image,
+ those have to be neglected in HTML -->
+ <xsl:when test="name($precedingElement) = 'text:p' and not($precedingElement/text()) and not($precedingElement/*)">
+ <xsl:call-template name="follows-empty-paragraphs-and-image">
+ <xsl:with-param name="precedingElement" select="preceding-sibling::*[$elementToCheck]"/>
+ <xsl:with-param name="elementToCheck" select="$elementToCheck +1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$precedingElement/draw:frame">no</xsl:when>
+ <xsl:otherwise>yes</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-paragraph">
+ <xsl:param name="globalData"/>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:param name="footnotePrefix"/>
+
+ <!-- xhtml:p may only contain inline elements.
+ If there is one frame beyond, div must be used! -->
+ <xsl:variable name="elementName">
+ <xsl:choose>
+ <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
+ <xsl:otherwise>p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$elementName}">
+ <xsl:choose>
+ <!-- in ODF borders of paragraphs will be merged by default. Merging means the adjactend paragraphs are building a unit,
+ where only the first and the last will have have a border to the surrounding (top / bottom border)
+ <xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ -->
+ <xsl:when test="$globalData/all-styles/style[@style:name = current()/@text:style-name]/@mergedBorders">
+ <xsl:variable name="precedingParagraphStyle" select="preceding-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:variable name="followingParagraphStyle" select="following-sibling::*[1][name() = 'text:p']/@text:style-name"/>
+ <xsl:choose>
+ <xsl:when test="$precedingParagraphStyle or $followingParagraphStyle">
+ <xsl:variable name="isPrecedingBorderParagraph" select="$globalData/all-styles/style[@style:name = $precedingParagraphStyle]/@mergedBorders"/>
+ <xsl:variable name="isFollowingBorderParagraph" select="$globalData/all-styles/style[@style:name = $followingParagraphStyle]/@mergedBorders"/>
+ <xsl:choose>
+ <xsl:when test="not($isPrecedingBorderParagraph) and $isFollowingBorderParagraph">
+ <xsl:attribute name="class">
+ <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderStart')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$isPrecedingBorderParagraph and not($isFollowingBorderParagraph)">
+ <xsl:attribute name="class">
+ <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderEnd')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-paragraph">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-paragraph">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-paragraph">
+ <xsl:param name="globalData"/>
+ <!-- the footnote symbol is the prefix for a footnote in the footer -->
+ <xsl:param name="footnotePrefix" />
+
+ <!-- empty paragraph tags does not provoke an carridge return,
+ therefore an non breakable space (&nbsp) have been inserted.-->
+ <xsl:choose>
+ <xsl:when test="node()">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix" select="$footnotePrefix" />
+ </xsl:call-template>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="style:tab-stop/@style:type">
+ <xsl:text>text-align:</xsl:text>
+ <xsl:choose>
+ <xsl:when test=". = 'left'">left</xsl:when>
+ <xsl:when test=". = 'right'">right</xsl:when>
+ <xsl:when test=". = 'center'">center</xsl:when>
+ <xsl:otherwise>justify</xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>;</xsl:text>
+ </xsl:template>
+
+ <!-- As soon a frame is within a paragraph (text:p) or page:frame, every element floating (CSS) and worked out in sequence.
+ Accumulating prior frame width and adding parent's left margin -->
+
+ <!-- Matching all elements and text beyond a paragraph/text:page which are sibling of a draw:frame -->
+ <xsl:template match="* | text()" mode="frameFloating">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+ <!-- it becomes true for siblings after a draw:frame -->
+ <xsl:param name="createDiv" select="false()"/>
+ <xsl:param name="noDivBefore" select="true()"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="parentMarginLeft" />
+ <xsl:param name="frameAlignedToParagraphWithSvgY" />
+
+ <xsl:choose>
+ <xsl:when test="name() = 'draw:frame'">
+ <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
+
+ <!-- if the first node is a draw:frame create a div -->
+ <xsl:call-template name="createDrawFrame">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ </xsl:call-template>
+ <!-- next elements will be called after the creation with the new indent (plus width of frame) -->
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="nextSiblingIsFrame" select="name(following-sibling::node()[1]) = 'draw:frame'"/>
+ <xsl:choose>
+ <xsl:when test="$createDiv and normalize-space(.) != ''">
+ <!-- every following frame sibling till the next draw:frame
+ have to be incapuslated within a div with left indent.
+ To be moved alltogether arcording the indent (usually right) -->
+ <xsl:comment>Next 'div' added for floating.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:text>position:relative; left:</xsl:text>
+ <xsl:value-of select="$leftPosition"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <!-- if it is a frame sibling it will be NOT incapuslated within the div (as already within one) -->
+ <xsl:if test="not($nextSiblingIsFrame)">
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="false()"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
+
+ <!-- Other draw:frame will be created outside of the div element -->
+ <xsl:apply-templates select="following-sibling::draw:frame[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="not($createDiv)">
+ <xsl:apply-templates select=".">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ <xsl:if test="not($nextSiblingIsFrame) or $noDivBefore">
+ <xsl:variable name="followingSibling" select="following-sibling::node()[1]"/>
+ <xsl:choose>
+ <xsl:when test="normalize-space($followingSibling) != ''">
+ <xsl:apply-templates select="$followingSibling" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeft"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="false()"/>
+ <xsl:with-param name="noDivBefore" select="$noDivBefore"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY" select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$frameAlignedToParagraphWithSvgY"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- As draw:fame may occure within more elements than in text:p and draw:page -->
+ <xsl:template match="draw:frame">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+
+ <xsl:call-template name="createDrawFrame">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths"/>
+ <xsl:with-param name="previousFrameHeights" select="$previousFrameHeights"/>
+ </xsl:call-template>
+ <!-- after the last draw:frame sibling the CSS float is disabled -->
+ <div style="clear:both; line-height:0; width:0; height:0; margin:0; padding:0;">&#160;</div>
+ </xsl:template>
+
+ <xsl:template name="getPageMarginLeft">
+ <!-- approximation to find the correct master page style (with page dimensions) -->
+ <xsl:variable name="masterPageNames">
+ <!-- Loop over every style:style containing a @style:master-page-name attribute -->
+ <xsl:for-each select="key('masterPage','count')">
+ <!-- Check if this style is being used in the body -->
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0">
+ <xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <!-- Find the according style:page-layout and store the properties in a variable -->
+ <xsl:variable name="pageMarginLeftAttr" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties/@fo:margin-left"/>
+ <xsl:choose>
+ <xsl:when test="$pageMarginLeftAttr">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$pageMarginLeftAttr"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Elements and text aside of a draw:frame are floating, here a div is being created.
+ Either for a draw:frame or for text and other elements floating aside -->
+ <xsl:template name="createDrawFrame">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" select="0"/>
+ <xsl:param name="previousFrameHeights" select="0" />
+ <xsl:param name="parentMarginLeft"/>
+
+ <xsl:variable name="parentMarginLeftNew">
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($parentMarginLeft)) &lt; 1">
+ <!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
+ <xsl:variable name="paragraphName" select="parent::*/@text:style-name" />
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paragraphName]/final-properties"/>
+ <!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($imageParagraphStyle, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$parentMarginLeft"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svgWidth">
+ <xsl:choose>
+ <xsl:when test="@svg:width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svgX">
+ <xsl:choose>
+ <xsl:when test="@svg:x">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:x"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftPosition" select="$svgX - $parentMarginLeftNew - $previousFrameWidths"/>
+ <xsl:variable name="svgY">
+ <xsl:choose>
+ <xsl:when test="@svg:y">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="@svg:y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- if the frame is anchored on a paragraph -->
+ <xsl:if test="@text:anchor-type='paragraph'">
+ <xsl:comment>Next 'div' is emulating the top hight of a draw:frame.</xsl:comment>
+ <!-- When the svg:y is set relativ to the paragraph content, the best way to emulate a positive height,
+ is to add an invisbile division inbetween with a height.
+ Often text will flow into this 'gap', which is handled separately!
+ -->
+ <xsl:if test="$svgY &gt; 0">
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:text>height:</xsl:text>
+ <xsl:value-of select="$svgY"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+ </xsl:if>
+ </xsl:if>
+
+
+ <xsl:variable name="followingSibling" select="following-sibling::node()[1]"/>
+ <!--
+ <xsl:choose>
+ HEURISTIC: if the frame is anchored on a paragraph and the above gab is big enough to hold a text line,
+ move it behind the text
+ <xsl:when test="@text:anchor-type='paragraph' and
+ (
+ ($svgY &gt; 0.5) or
+ ($svgX &gt; 4)
+ ) and normalize-space($followingSibling) != ''">
+ <xsl:apply-templates select="$followingSibling" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="true()"/>
+ <xsl:with-param name="noDivBefore" select="false()"/>
+ <xsl:with-param name="frameAlignedToParagraphWithSvgY">
+ <xsl:call-template name="createDrawFrame2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="svgY" select="$svgY"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>-->
+ <xsl:call-template name="createDrawFrame2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeftNew" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="svgY" select="$svgY"/>
+ </xsl:call-template>
+ <!-- <xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="previousFrameWidths" select="$previousFrameWidths + $svgWidth"/>
+ <xsl:with-param name="parentMarginLeft" select="$parentMarginLeftNew"/>
+ <xsl:with-param name="leftPosition" select="$leftPosition"/>
+ <xsl:with-param name="createDiv" select="true()"/>
+ <xsl:with-param name="noDivBefore" select="false()"/>
+ </xsl:apply-templates>
+
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:template>
+
+ <xsl:template name="createDrawFrame2">
+ <xsl:param name="globalData"/>
+ <xsl:param name="previousFrameWidths" />
+ <xsl:param name="parentMarginLeftNew"/>
+ <xsl:param name="leftPosition" />
+ <xsl:param name="svgY" />
+
+ <xsl:comment>Next 'div' is a draw:frame.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:attribute name="style">
+ <xsl:call-template name="widthAndHeight"/>
+
+ <!-- all images float (CSS float reltaive) with a left position calculated by svg:x - parentMarginLeft - previousFrameWidths -->
+ <xsl:text> float:left; padding:0; position:relative; left:</xsl:text>
+ <xsl:value-of select="$leftPosition"/>
+ <xsl:text>cm; </xsl:text>
+ <!-- if the frame is anchored on a char -->
+ <xsl:if test="@text:anchor-type='char'">
+ <xsl:text>top:</xsl:text>
+ <xsl:value-of select="$svgY"/>
+ <xsl:text>cm; </xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="node()">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="widthAndHeight">
+ <xsl:if test="@svg:height | @svg:width">
+ <xsl:choose>
+ <xsl:when test="not(@svg:width)">
+ <xsl:call-template name="svg:height"/>
+ </xsl:when>
+ <xsl:when test="not(@svg:height)">
+ <xsl:call-template name="svg:width"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="svg:height"/>
+ <xsl:call-template name="svg:width"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- ***************** -->
+ <!-- *** Text Span *** -->
+ <!-- ***************** -->
+
+ <xsl:template match="text:span">
+ <xsl:param name="globalData"/>
+
+ <xsl:choose>
+ <xsl:when test="draw:frame">
+ <!-- sometimes an ODF image is anchored as character and the
+ image frame appears within a span (which is not valid for HTML)
+ Heuristic: Neglecting the span assuming no text content aside
+ of frame within span -->
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="span">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- **************** -->
+ <!-- *** Headings *** -->
+ <!-- **************** -->
+
+ <xsl:template match="text:h">
+ <xsl:param name="globalData"/>
+
+ <!-- no creation of empty headings (without text content) -->
+ <xsl:if test="text() or descendant::text()">
+ <!-- The URL linking of an table-of-content is due to a bug (cp. bug id# 102311) not mapped as URL in the XML.
+ Linking of the table-of-content can therefore only be archieved by a work-around in HTML -->
+ <xsl:call-template name="create-heading">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- default matching for header elements -->
+ <xsl:template name="create-heading">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="headingLevel">
+ <xsl:choose>
+ <xsl:when test="@text:outline-level &lt; 6">
+ <xsl:value-of select="@text:outline-level"/>
+ </xsl:when>
+ <xsl:otherwise>6</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="headertyp" select="concat('h', $headingLevel)"/>
+ <xsl:element name="{$headertyp}">
+ <!-- outline style 'text:min-label-width' is interpreted as a CSS 'margin-right' attribute
+ NOTE: Should be handled as CSS style in style header -->
+ <xsl:variable name="min-label" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+
+ <xsl:call-template name="create-heading-anchor">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+
+ </xsl:template>
+
+ <xsl:template name="create-heading-anchor">
+ <xsl:param name="globalData"/>
+
+ <!-- writing out a heading number if desired.-->
+ <!-- if a corresponding 'text:outline-style' exist or is not empty -->
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-format != ''">
+
+ <!-- Every heading element will get an unique anchor for its file, from its hiearchy level and name:
+ For example: The heading title 'My favorite heading' might get <a name="1_2_2_My_favorite_heading" /> -->
+ <!-- creating an anchor for referencing the heading (e.g. from content table) -->
+ <xsl:variable name="headingNumber">
+ <xsl:call-template name="get-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="create-heading-anchor2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="headingNumber" select="$headingNumber"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="create-heading-anchor2">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="get-heading-number">
+ <xsl:param name="globalData"/>
+
+ <!-- write number prefix -->
+ <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-prefix"/>
+ <xsl:call-template name="write-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ <!-- write number suffix -->
+ <xsl:value-of select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-suffix"/>
+ </xsl:template>
+
+ <!-- creating an anchor for referencing the heading -->
+ <xsl:template name="create-heading-anchor2">
+ <xsl:param name="globalData"/>
+ <xsl:param name="headingNumber" />
+
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+ <!-- REFERENCE HANDLING - ANCHOR -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="id">
+ <xsl:value-of select="translate(concat('a_',$headingNumber, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:attribute>
+
+ <xsl:element name="span">
+ <!-- outline style 'text:min-label-distance' is interpreted as a CSS 'margin-right' attribute
+ NOTE: Should be handled as CSS style in style header -->
+ <xsl:variable name="minLabelDistance" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-distance"/>
+ <xsl:variable name="minLabelWidth" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/*/@text:min-label-width"/>
+
+ <xsl:if test="$minLabelDistance | $minLabelWidth">
+ <xsl:attribute name="style">
+ <xsl:if test="$minLabelDistance">
+ <xsl:text>margin-right:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$minLabelDistance"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ <xsl:if test="$minLabelWidth">
+ <xsl:text>min-width:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$minLabelWidth"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:copy-of select="$headingNumber"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-heading-number">
+ <xsl:param name="globalData"/>
+
+ <!-- By default heading start with '1', the parameter 'textStartValue' will only be set, if the attribute @text:start-value exist -->
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value">
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
+ <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@text:start-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="@text:outline-level"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ Find the correct heading no., which is the sum of 'text:start-value'
+ and preceding siblings of 'text:h' with the same 'text:outline-level' (until a text:outline-level with lower value is found).
+ If the 'text:start-value is not set the default value of '1' has to be taken.
+ If a heading number is found (e.g. text:outline-level='3') all heading numbers
+ for the higher levels have to be written out -->
+ <xsl:template name="calc-heading-number">
+ <xsl:param name="globalData"/>
+ <xsl:param name="outlineLevel"/><!-- text level of the heading -->
+ <xsl:param name="iOutlineLevel" select="1"/><!-- iterator, counts from 1 to the text level of the heading -->
+ <xsl:param name="textStartValue" select="1"/><!-- text level to start with, default is '1' -->
+
+ <xsl:choose>
+ <!-- iText levels counts up from '1' to outlineLevel
+ Which means writing a heading number from left to right -->
+ <xsl:when test="$iOutlineLevel &lt; $outlineLevel">
+
+ <!-- Write preceding heading numbers -->
+ <xsl:call-template name="writeNumber">
+ <xsl:with-param name="numberDigit">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="0"/>
+ <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($outlineLevel)]/@style:num-format"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value">
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
+ <xsl:with-param name="textStartValue" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = ($iOutlineLevel + 1)]/@text:start-value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="calc-heading-number">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="outlineLevel" select="$outlineLevel"/>
+ <xsl:with-param name="iOutlineLevel" select="$iOutlineLevel + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Write preceding heading numbers -->
+ <xsl:call-template name="writeNumber">
+ <xsl:with-param name="numberDigit">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$textStartValue"/>
+ <xsl:with-param name="currentoutlineLevel" select="$iOutlineLevel"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="numberFormat" select="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = $outlineLevel]/@style:num-format"/>
+ <xsl:with-param name="last" select="true()"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="writeNumber">
+ <xsl:param name="numberDigit"/>
+ <xsl:param name="numberFormat"/>
+ <xsl:param name="last"/>
+
+ <xsl:choose>
+ <xsl:when test="not($numberFormat)">
+ <xsl:number value="$numberDigit" format="1."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$last">
+ <xsl:number value="$numberDigit" format="{$numberFormat}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:number value="$numberDigit" format="{$numberFormat}."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="calc-heading-digit">
+ <xsl:param name="value"/>
+ <xsl:param name="currentoutlineLevel"/>
+ <xsl:param name="i" select="1"/>
+
+ <xsl:variable name="precedingoutlineLevel" select="preceding-sibling::text:h[$i]/@text:outline-level"/>
+ <xsl:choose>
+ <xsl:when test="$currentoutlineLevel = $precedingoutlineLevel">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$value + 1"/>
+ <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$currentoutlineLevel &lt; $precedingoutlineLevel">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$value"/>
+ <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Neglect Annotations -->
+ <xsl:template match="office:annotation" mode="concatenate"/>
+
+ <!-- Match text:placeholder child nodes (e.g. text) -->
+ <xsl:template match="text:placeholder">
+ <xsl:param name="globalData"/>
+
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- ************* -->
+ <!-- *** Link *** -->
+ <!-- ************* -->
+
+ <xsl:template match="text:a | draw:a">
+ <xsl:param name="globalData"/>
+
+ <xsl:call-template name="create-common-anchor-link">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <xsl:template name="create-common-anchor-link">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="@xlink:href"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+
+
+ <!-- ******************* -->
+ <!-- *** Image Link *** -->
+ <!-- ******************* -->
+
+ <!-- currently suggesting that all draw:object-ole elements are images -->
+ <xsl:template match="draw:image | draw:object-ole">
+ <xsl:param name="globalData"/>
+
+ <xsl:choose>
+ <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base">
+ <!-- XHTML does not allow the mapped elements to contain paragraphs -->
+ <xsl:call-template name="create-image-element">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself.
+ A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph -->
+ <xsl:element name="p">
+ <xsl:apply-templates select="@draw:style-name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+
+ <xsl:call-template name="create-image-element">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-image-element">
+ <xsl:param name="globalData"/>
+
+ <xsl:element name="img">
+ <xsl:if test="../@svg:width or ../@svg:height">
+ <xsl:attribute name="style">
+ <xsl:if test="../@svg:height">
+ <xsl:text>height:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="../@svg:height"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ <xsl:if test="../@svg:width">
+ <xsl:text>width:</xsl:text>
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="../@svg:width"/>
+ </xsl:call-template>
+ <xsl:text>cm;</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="alt">
+ <xsl:choose>
+ <xsl:when test="../svg:desc">
+ <xsl:value-of select="../svg:desc"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ Accessibility Warning:
+ No alternate text ('svg:desc' element) set for
+ image '<xsl:value-of select="@xlink:href"/>'!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="src">
+ <xsl:call-template name="create-href">
+ <xsl:with-param name="href" select="@xlink:href"/>
+ </xsl:call-template>
+ </xsl:attribute>
+
+ <!-- style interpretation only, as no subelements are allowed for img in XHTML -->
+ <xsl:apply-templates select="@draw:style-name">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- ************ -->
+ <!-- *** list *** -->
+ <!-- ************ -->
+ <!--
+ Due to the requirements below the ODF list functionality is not handled by CSS, but the list labels calculated and written by XSLT.
+
+ REQUIREMENTS:
+ =============
+
+ A)
+ One significant difference between XHTML and Office List elements is that a list without text nodes but only further list children
+ would not show a list symbol in the Office, but in the browser from XHTML.
+
+ B)
+ Since OASIS Open Document XML (implemented in OOo2.0) only one parent type exists for list items
+ the 'text:list' element. The XHTML element 'ol', 'ul' will be choosen upon the list style type.
+
+ C)
+ An Office list may be spread over the whole document. Linked by their style and text:continue-numbering='true'.
+
+ D)
+ An Office list can use characters or images as list label.
+
+ E)
+ An Office list can have a prefix and suffix around the list label.
+
+ F)
+ An Office list style may have the attribute consecutive numbering, which resolves in a list counting for all levels
+
+ G)
+ An Office list may (re)start on any arbitrary value by using @text:start-value on the text:list-item
+
+ INDENDATION:
+ ============
+
+ The indent of a list label is not only calculated by using the text:space-before of the list level (listLevelStyle), but
+ as well taking the left margin of the first paragraph (or heading) of the list into account as loy match="" name="" use=""/>ng it is not negative.
+
+ | MARGIN LEFT | LABEL |
+
+ | text:space-before (listlevelstyle) | text:min-label-width |
+ | + fo:left-margin (firstParagraph) | |
+
+ Further details beyond text:list-list..
+ -->
+ <xsl:key name="listStyles" match=" /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style | /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style" use="@style:name"/>
+
+ <!--
+ A text list may only have text:list-item and text:list-header as children.
+ -->
+ <xsl:template match="text:list">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="listLevel" select="1"/>
+ <xsl:param name="listRestart" select="false()"/>
+ <xsl:param name="itemLabel" select="''"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName" select="@text:style-name"/>
+
+ <!-- To choose list type - get the list style, with the same 'text:style-name' and same 'text:level' >-->
+ <xsl:variable name="listStyleRTF">
+ <xsl:variable name="listStyleInContentFile" select="key('listStyles', $listStyleName)"/>
+ <xsl:choose>
+ <xsl:when test="$listStyleInContentFile">
+ <xsl:copy-of select="$listStyleInContentFile"/>
+ </xsl:when>
+ <xsl:when test="$globalData/office:styles/text:list-style[@style:name = $listStyleName]">
+ <xsl:copy-of select="$globalData/office:styles/text:list-style[@style:name = $listStyleName]"/>
+ </xsl:when>
+ <xsl:when test="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]">
+ <xsl:copy-of select="$globalData/office:styles/style:graphic-properties/text:list-style[@style:name = $listStyleName]"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="function-available('common:node-set')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="common:node-set($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xalan:nodeset')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="xalan:nodeset($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="function-available('xt:node-set')">
+ <xsl:call-template name="create-list-type">
+ <xsl:with-param name="listStyle" select="xt:node-set($listStyleRTF)" />
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">The required node-set function was not found!</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="create-list-type">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="listLevel" />
+ <xsl:param name="listRestart" />
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName" />
+
+ <!-- $globalData/styles-file/*/office:styles/ -->
+ <xsl:variable name="listLevelStyle" select="$listStyle/*/*[@text:level = number($listLevel)]"/>
+ <xsl:variable name="listIndent">
+ <xsl:call-template name="getListIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="firstPara" select="*[1]/*[name() = 'text:p' or name() = 'text:h'][1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="isEmptyList" select="not(*[1]/*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
+ <xsl:variable name="listType">
+ <xsl:choose>
+ <!-- ordered list -->
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
+ <xsl:text>ol</xsl:text>
+ </xsl:when>
+ <!-- unordered list (bullet or image) -->
+ <xsl:otherwise>
+ <xsl:text>ul</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$listType}">
+ <xsl:apply-templates select="*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset">
+ <xsl:choose>
+ <xsl:when test="$isListNumberingReset">
+ <xsl:value-of select="true()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- A list is empty if a text:list does not have a text:list-header or text:list-item (wildcard as only those can exist beyond a text:list), which contains a text:h or text:p -->
+ <xsl:value-of select="not($isEmptyList)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart">
+ <xsl:choose>
+ <xsl:when test="$listRestart">
+ <xsl:value-of select="$listRestart"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- descdendants restart their list numbering, when an ancestor is not empty -->
+ <xsl:value-of select="not($isEmptyList)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="minLabelDist">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:min-label-distance">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-distance"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="minLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:min-label-width">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:min-label-width"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- See comment before text:list template -->
+ <xsl:template name="getListIndent">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLevelStyle"/>
+ <!-- The first paragraph of the list item (heading is special paragraph in ODF) -->
+ <xsl:param name="firstPara" />
+
+ <!-- Styles of first paragraph in list item, including ancestor styles (inheritance) -->
+ <xsl:variable name="firstParaStyles" select="$globalData/all-styles/style[@style:name = $firstPara/@text:style-name]/final-properties"/>
+
+ <!-- Only the left margin of the first paragraph of a list item will be added to the margin of the complete list (all levels)-->
+ <xsl:variable name="firstParaLeftMargin">
+ <xsl:choose>
+ <xsl:when test="contains($firstParaStyles, 'margin-left:')">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="normalize-space(substring-before(substring-after($firstParaStyles, 'margin-left:'), ';'))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="spaceBefore">
+ <xsl:choose>
+ <xsl:when test="$listLevelStyle/*/@text:space-before">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$listLevelStyle/*/@text:space-before"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Only if the left-margin of the first paragraph is positive the sum
+ text:space-before and fo:left-margin is taken as list indent -->
+ <xsl:choose>
+ <xsl:when test="$firstParaLeftMargin &gt; 0">
+ <xsl:value-of select="$firstParaLeftMargin + $spaceBefore"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$spaceBefore"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ****************** -->
+ <!-- *** list item *** -->
+ <!-- ****************** -->
+<!--
+ Left margin of the complete list:
+ The space between left page and the list symbol (left-margin) is in the Office implemented by
+ the sum of three values:
+ 1) 'text:space-before', which is part of the 'text:list-style' element.
+ 2) 'margin:left' from the style of the first child (e.g. paragraph).
+ 3) 'fo:text-indent' the indent of the first line of some child (e.g. paragraph) (applied by CSS class style)
+
+ Possible list children:
+ <!ELEMENT text:list-item (text:p|text:h|text:list|text:list)+>
+
+ In the Office the list label before the text depends on two attributes:
+ - 'text:min-label-width': the distance between list label and all text of the list item.
+ - 'text:min-label-distance': the distance between list label and text of the first line,
+ only used, when text does not fit in text:min-label-width (ignored)
+
+-->
+ <xsl:template match="text:list-item | text:list-header" mode="listItemSibling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="firstitemLabelWidth"/>
+ <xsl:param name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p' or name() = 'text:name'])"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelDist"/>
+ <xsl:param name="minLabelWidth"/>
+ <xsl:param name="listIndent" />
+
+
+ <xsl:variable name="listIndentNew">
+ <xsl:choose>
+ <xsl:when test="$listIndent">
+ <xsl:value-of select="$listIndent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getListIndent">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="firstPara" select="*[name() = 'text:p' or name() = 'text:h'][1]" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="itemNumberNew">
+ <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
+ <xsl:choose>
+ <xsl:when test="$isEmptyList">
+ <!-- An empty list item (no text:h/text:p as child), will not count as item and does not increment the count. -->
+ <xsl:variable name="tempItemNumber">
+ <xsl:choose>
+ <!-- siblings will be incremented by one -->
+ <xsl:when test="$itemNumber">
+ <xsl:value-of select="$itemNumber + 1"/>
+ </xsl:when>
+ <!-- if a higher list level had content the numbering starts with 1 -->
+ <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getItemNumber">
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <!-- in case the empty list-item is the first list-item in document -->
+ <xsl:when test="$tempItemNumber = 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tempItemNumber - 1"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <xsl:value-of select="@text:start-value"/>
+ </xsl:when>
+ <!-- text:start-value from list level style will only be taken on the first list-item of a list -->
+ <xsl:when test="$listLevelStyle/@text:start-value and count(preceding-sibling::text:list-item) = 0">
+ <xsl:value-of select="$listLevelStyle/@text:start-value"/>
+ </xsl:when>
+ <!-- siblings will be incremented by one -->
+ <xsl:when test="$itemNumber">
+ <xsl:value-of select="$itemNumber + 1"/>
+ </xsl:when>
+ <!-- if a higher list level had content the numbering starts with 1 -->
+ <xsl:when test="$isListNumberingReset and $listLevel &gt; 1">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="getItemNumber">
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="itemLabelNew">
+ <xsl:if test="$listStyle/text:list-style/text:list-level-style-number">
+ <!--
+ A numbered label (e.g. 2.C.III) is created for every text:list-item/header.
+ Above list levels are listed in the label, if the list-style requires this. Levels are separated by a '.'
+ Formatation is dependent for every list level depth.
+ The label is passed from anchestor text:list-item/header and if requrired truncated.
+ The prefix/suffix (as well list level dependent) comes before and after the complete label (after truncation)
+ -->
+ <!-- Numbered label will be generated -->
+ <xsl:call-template name="createItemLabel">
+ <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevelsToDisplay">
+ <xsl:variable name="display" select="$listLevelStyle/@text:display-levels"/>
+ <xsl:choose>
+ <xsl:when test="$display">
+ <xsl:value-of select="$display"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:element name="li">
+ <xsl:choose>
+ <xsl:when test="$isEmptyList">
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
+ <xsl:with-param name="listLevel" select="$listLevel + 1"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Possible following children are text:h, text:p, list:text, text:soft-page-break -->
+ <xsl:apply-templates mode="list-item-children" select="*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <!-- The new created label is given to the children -->
+ <xsl:with-param name="itemLabel" select="$itemLabelNew"/>
+ <xsl:with-param name="listLabelElement">
+ <xsl:choose>
+ <xsl:when test="name() = 'text:list-header'"/>
+ <xsl:otherwise>
+ <xsl:variable name="listLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$minLabelWidth &gt; $minLabelDist">
+ <xsl:value-of select="$minLabelWidth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minLabelDist"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Numbering is being done by this transformation creating a HTML span representing the number label
+ The html:span represents the list item/header label (e.g. 1.A.III)
+ As the html:span is usually a inline element is formated by CSS as block element to use width upon it,
+ to disable the caridge return float:left is used and later neglected -->
+ <xsl:element name="span">
+ <xsl:if test="$listLevelStyle/@text:style-name">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$listLevelStyle/@text:style-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>display:block;float:</xsl:text>
+ <!-- 2DO: Svante - copy this functionality for other used margin:left (in western country 'left') -->
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>;min-width:</xsl:text>
+ <xsl:value-of select="$listLabelWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:variable name="labelContent">
+ <xsl:choose>
+ <xsl:when test="text:number">
+ <xsl:apply-templates select="text:number" mode="listnumber"/>
+ </xsl:when>
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-bullet'">
+ <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
+ <xsl:value-of select="$listLevelStyle/@text:bullet-char"/>
+ <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
+ </xsl:when>
+ <xsl:when test="name($listLevelStyle) = 'text:list-level-style-number'">
+ <xsl:value-of select="$listLevelStyle/@style:num-prefix"/>
+ <xsl:value-of select="$itemLabelNew"/>
+ <xsl:value-of select="$listLevelStyle/@style:num-suffix"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Listing with image as bullets, taken from the list style's href -->
+ <xsl:value-of select="$listLevelStyle/@xlink:href"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Some browsers have problem with stand-alone elements (e.g. <span/>)
+ Therefore a comment is being inserted into an empty label -->
+ <xsl:choose>
+ <xsl:when test="$labelContent != ''">
+ <xsl:value-of select="$labelContent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>&#160;</xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="listLabelEmptyElement">
+ <xsl:variable name="listLabelWidth">
+ <xsl:choose>
+ <xsl:when test="$minLabelWidth &gt; $minLabelDist">
+ <xsl:value-of select="$minLabelWidth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$minLabelDist"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="span">
+ <xsl:if test="$listLevelStyle/@text:style-name">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$listLevelStyle/@text:style-name"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>display:block;float:</xsl:text>
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>;min-width:</xsl:text>
+ <xsl:value-of select="$listLabelWidth"/>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:comment>&#160;</xsl:comment>
+ </xsl:element>
+ </xsl:with-param>
+ <xsl:with-param name="listLevel" select="$listLevel + 1"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndentNew"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumberNew"/>
+ <xsl:with-param name="listIndent">
+ <xsl:choose>
+ <xsl:when test="not($isEmptyList)">
+ <xsl:value-of select="$listIndentNew"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ <!-- Receives the same parent label -->
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="minLabelDist" select="$minLabelDist"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template name="getOppositeWritingDirection">
+ <xsl:param name="globalData"/>
+ <xsl:param name="paraStyleName"/>
+
+ <xsl:variable name="imageParagraphStyle" select="$globalData/all-styles/style[@style:name = $paraStyleName]/final-properties"/>
+
+ <xsl:choose>
+ <xsl:when test="contains($imageParagraphStyle, 'writing-mode:')">
+ <xsl:choose>
+ <xsl:when test="contains(substring-before(substring-after($imageParagraphStyle, 'writing-mode:'), ';'), 'rl')">right</xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>left</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="text:number" mode="listnumber">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="text:number" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLabelElement" select="$listLabelElement"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- Each key element holds the set of all text:list-item/text:list-header of a certain level and a certain style -->
+ <xsl:key name="getListItemsByLevelAndStyle" use="concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)" match="text:list-item | text:list-header"/>
+ <!-- Each key element holds the set of all text:list-item/text:list-header of a certain style -->
+ <xsl:key name="getListItemsByStyle" use="ancestor::text:list/@text:style-name" match="text:list-item | text:list-header"/>
+
+
+ <!-- The Numbering start value (or offset from regular counteing) is used at the first item of offset,
+ but have to be reused on following item/headers with no text:start-value -->
+ <xsl:template name="getItemNumber">
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="listStyle"/>
+
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="preceding::text:list-item[generate-id(key('getListItemsByLevelAndStyle', concat($listLevel, $listStyleName))) = generate-id(key('getListItemsByLevelAndStyle', concat(count(ancestor::text:list), ancestor::text:list/@text:style-name)))]"/>
+
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="preceding::text:list-item[generate-id(key('getListItemsByStyle', $listStyleName)) = generate-id(key('getListItemsByStyle', ancestor::text:list/@text:style-name))]"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- When there is a text:start-value the last have to be found and added to the number -->
+ <xsl:template name="countListItemTillStartValue">
+ <xsl:param name="IteratorSameLevelAndStyle" select="1"/>
+ <xsl:param name="IteratorSameStyle" select="1"/>
+ <xsl:param name="itemNumber" select="1"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyle" />
+ <xsl:param name="precedingListItemsOfSameLevelAndStyleCount" select="count($precedingListItemsOfSameLevelAndStyle)"/>
+ <xsl:param name="precedingListItemsOfSameStyle" />
+ <xsl:param name="precedingListItemsOfSameStyleCount" select="count($precedingListItemsOfSameStyle)"/>
+ <!-- E.g.: If a list level 2 number is searched, a level 3 with content found with only a level 1 parent with content,
+ the level 3 gets a 'pseudoLevel' -->
+ <xsl:param name="pseudoLevel" select="0" />
+
+ <!-- set the next of preceding list items. Starting from the current to the next previous text:list-item -->
+ <xsl:variable name="precedingListItemOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle[$precedingListItemsOfSameLevelAndStyleCount - $IteratorSameLevelAndStyle + 1]"/>
+ <xsl:variable name="precedingListItemOfSameStyle" select="$precedingListItemsOfSameStyle[$precedingListItemsOfSameStyleCount - $IteratorSameStyle + 1]"/>
+ <xsl:choose>
+ <xsl:when test="($precedingListItemOfSameStyle and $precedingListItemOfSameLevelAndStyle) or ($precedingListItemOfSameStyle and $listStyle/text:list-style/@text:consecutive-numbering)">
+ <xsl:for-each select="$precedingListItemOfSameStyle">
+ <xsl:choose>
+ <!-- if it is a higher list level element -->
+ <xsl:when test="$listStyle/text:list-style/@text:consecutive-numbering">
+
+ <xsl:call-template name="countListItem">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- NOT CONSECUTIVE NUMBERING -->
+ <xsl:variable name="currentListLevel" select="count(ancestor::text:list)"/>
+ <xsl:choose>
+ <!-- IF IT IS A HIGHER LIST LEVEL ELEMENT -->
+ <xsl:when test="$currentListLevel &lt; $listLevel">
+ <xsl:choose>
+ <!-- if it has content the counting is ended -->
+ <xsl:when test="*[name() = 'text:h' or name() = 'text:p']">
+ <!-- 2DO: Perhaps the children still have to be processed -->
+ <xsl:value-of select="$itemNumber + $pseudoLevel"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if it is empty the counting continues -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <!-- IF IT IS A LIST LEVEL ELEMENT OF THE COUNTING LEVEL -->
+ <xsl:when test="$currentListLevel = $listLevel">
+ <xsl:call-template name="countListItem">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- list item below the current level does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel">
+ <xsl:choose>
+ <!-- empty list item does not count -->
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <xsl:value-of select="$pseudoLevel"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="countListItem">
+ <xsl:param name="IteratorSameLevelAndStyle"/>
+ <xsl:param name="IteratorSameStyle"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listLevelStyle"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:param name="precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:param name="precedingListItemsOfSameStyle"/>
+ <xsl:param name="precedingListItemsOfSameStyleCount"/>
+ <xsl:param name="pseudoLevel" />
+
+ <xsl:choose>
+ <xsl:when test="@text:start-value">
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <!-- empty list item does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber + @text:start-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$listLevelStyle/@text:start-value">
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <!-- empty list item does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$itemNumber + $listLevelStyle/@text:start-value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])">
+ <!-- empty list item does not count -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="$pseudoLevel" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- count on till you find a start-value or the end is reached -->
+ <xsl:call-template name="countListItemTillStartValue">
+ <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" />
+ <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber + 1"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameLevelAndStyleCount" select="$precedingListItemsOfSameLevelAndStyleCount"/>
+ <xsl:with-param name="precedingListItemsOfSameStyle" select="$precedingListItemsOfSameStyle"/>
+ <xsl:with-param name="precedingListItemsOfSameStyleCount" select="$precedingListItemsOfSameStyleCount"/>
+ <xsl:with-param name="pseudoLevel" select="0" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Creates the list label containing the number, which is separated by '.' between the levels.
+ Depending on the levels to display (listLevelsToDisplay) -->
+ <xsl:template name="createItemLabel">
+ <xsl:param name="itemLabel" select="''"/>
+ <xsl:param name="itemNumber" />
+ <xsl:param name="listLevel" />
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listLevelsToDisplay" />
+
+ <xsl:choose>
+ <xsl:when test="$listLevelsToDisplay &lt; $listLevel">
+ <xsl:call-template name="truncLabel">
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber" />
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle" />
+ <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="numberedSymbol">
+ <xsl:comment>&#160;</xsl:comment>
+ <!-- only give out a number when number format is not empty -->
+ <xsl:if test="$listLevelStyle/@style:num-format != ''">
+ <xsl:number value="$itemNumber" format="{$listLevelStyle/@style:num-format}"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listLevelsToDisplay != 1">
+ <xsl:value-of select="concat($itemLabel, '.' , $numberedSymbol)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$numberedSymbol"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="truncLabel">
+ <xsl:param name="itemLabel" />
+ <xsl:param name="itemNumber" />
+ <xsl:param name="listLevel" />
+ <xsl:param name="listLevelStyle" />
+ <xsl:param name="listLevelsToDisplay" />
+ <xsl:param name="listStyle" />
+ <xsl:param name="listStyleName" />
+
+ <xsl:call-template name="createItemLabel">
+ <xsl:with-param name="itemLabel">
+ <xsl:if test="contains($itemLabel, '.')">
+ <xsl:value-of select="substring-after($itemLabel, '.')"/>
+ </xsl:if>
+ </xsl:with-param>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLevel" select="$listLevel - 1"/>
+ <xsl:with-param name="listLevelStyle" select="$listLevelStyle"/>
+ <xsl:with-param name="listLevelsToDisplay" select="$listLevelsToDisplay"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <xsl:template match="text:p" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <!-- 2DO page alignment fix - PART1 -->
+
+ <!-- xhtml:p may only contain inline elements.
+ If there is one frame beyond, div must be used! -->
+ <xsl:variable name="elementName">
+ <xsl:choose>
+ <xsl:when test="descendant::draw:frame[1] or descendant::text:p[1]">div</xsl:when>
+ <xsl:otherwise>p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$elementName}">
+ <xsl:call-template name="create-list-style">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="$listLabelElement">
+ <xsl:copy-of select="$listLabelElement"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$listLabelEmptyElement"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ <!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
+ <span class="odfLiEnd"></span>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <!-- Neglecting the left margin behavior for headings for now -->
+ <xsl:template match="text:h" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listLabelElement"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:element name="h">
+ <xsl:call-template name="create-list-style">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="styleName" select="@text:style-name"/>
+ </xsl:call-template>
+ <xsl:variable name="title">
+ <xsl:apply-templates mode="concatenate"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listLabelElement">
+ <xsl:copy-of select="$listLabelElement"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$listLabelEmptyElement"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- REFERENCE HANDLING - ANCHOR -->
+ <xsl:element namespace="{$namespace}" name="a">
+ <xsl:attribute name="id">
+ <xsl:value-of select="translate(concat('a_',$listLabelElement, '_', normalize-space($title)), '&#xA;&amp;&lt;&gt;.,;: %()[]/\+', '___________________________')"/>
+ </xsl:attribute>
+ <xsl:apply-templates>
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="listIndent" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:element>
+
+ <!-- this span disables the float necessary to bring two block elements on one line. It contains a space as IE6 bug workaround -->
+ <span class="odfLiEnd"></span>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:element>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <xsl:template match="*" mode="list-item-children">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="listLabelEmptyElement"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+ <xsl:param name="minLabelWidth"/>
+
+ <xsl:apply-templates select="self::*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+
+ <xsl:apply-templates mode="list-item-children" select="following-sibling::*[1]">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listLabelEmptyElement" select="$listLabelEmptyElement"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listRestart" select="$listRestart"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <xsl:with-param name="minLabelWidth" select="$minLabelWidth"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="*" mode="listItemSibling">
+ <xsl:param name="globalData"/>
+ <xsl:param name="isEmptyList"/>
+ <xsl:param name="isListNumberingReset"/>
+ <xsl:param name="isNextLevelNumberingReset"/>
+ <xsl:param name="itemLabel"/>
+ <xsl:param name="itemNumber"/>
+ <xsl:param name="listIndent"/>
+ <xsl:param name="listLevel"/>
+ <xsl:param name="listRestart"/>
+ <xsl:param name="listStyle"/>
+ <xsl:param name="listStyleName"/>
+
+ <xsl:apply-templates select="self::*">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <!-- receives the same parent label, only with a different itemNumber -->
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="following-sibling::*[1]" mode="listItemSibling">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="isEmptyList" select="$isEmptyList"/>
+ <xsl:with-param name="isListNumberingReset" select="$isListNumberingReset"/>
+ <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/>
+ <xsl:with-param name="itemNumber" select="$itemNumber"/>
+ <xsl:with-param name="listIndent" select="$listIndent"/>
+ <!-- receives the same parent label, only with a different itemNumber -->
+ <xsl:with-param name="itemLabel" select="$itemLabel"/>
+ <xsl:with-param name="listLevel" select="$listLevel"/>
+ <xsl:with-param name="listStyle" select="$listStyle"/>
+ <xsl:with-param name="listStyleName" select="$listStyleName"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="text()" mode="list-item-children">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+
+ <xsl:template name="create-list-style">
+ <xsl:param name="globalData"/>
+ <xsl:param name="listIndent" select="0"/>
+ <xsl:param name="styleName"/>
+
+ <xsl:if test="$styleName">
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style">
+ <xsl:text>margin-</xsl:text>
+ <xsl:call-template name="getOppositeWritingDirection">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="paraStyleName" select="descendant-or-self::*/@text:style-name"/>
+ </xsl:call-template>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="$listIndent"/>
+ <xsl:text>cm;</xsl:text>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <!-- ********************************************** -->
+ <!-- *** Text Section (contains: draw:text-box) *** -->
+ <!-- ********************************************** -->
+
+ <xsl:template match="text:section">
+ <xsl:param name="globalData"/>
+
+ <xsl:if test="not(contains(@text:display, 'none'))">
+ <xsl:comment>Next 'div' was a 'text:section'.</xsl:comment>
+ <xsl:element name="div">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- Hidden text dependend on Office variables:
+ The text is not shown, if condition is 'true'.
+ Implemented solely for conditons as '<VARIABLE>==0' or '<VARIABLE>==1'
+ -->
+ <xsl:key match="text:variable-set" name="varSet" use="@text:name"/>
+ <xsl:template match="text:hidden-text">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="varName" select="substring-before(@text:condition, '==')"/>
+ <xsl:variable name="varValue" select="substring-after(@text:condition, '==')"/>
+ <xsl:choose>
+ <xsl:when test="key('varSet', $varName)/@text:value != $varValue">
+ <xsl:value-of select="@text:string-value"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:comment>
+ <xsl:value-of select="$varName"/>
+ <xsl:value-of select="@text:string-value"/>
+ <xsl:value-of select="$varName"/>
+ </xsl:comment>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="@text:style-name | @draw:style-name | @draw:text-style-name | @table:style-name"><!-- | @presentation:style-name-->
+ <xsl:param name="globalData"/>
+
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate(., '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <!-- ***************** -->
+ <!-- *** Footnotes *** -->
+ <!-- ***************** -->
+
+ <xsl:template match="text:note">
+ <xsl:param name="globalData"/>
+
+ <!-- get style configuration -->
+ <xsl:variable name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+
+ <xsl:variable name="titlePrefix">
+ <xsl:choose>
+ <xsl:when test="@text:note-class = 'footnote'">
+ <xsl:text>Footnote: </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Endnote: </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- write anchor -->
+ <xsl:element name="span">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$footnoteConfig/@text:citation-body-style-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:value-of select="$titlePrefix"/>
+ <xsl:apply-templates mode="textOnly" select="text:note-body"/>
+ </xsl:attribute>
+ <xsl:element name="a">
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#', @text:id)"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="concat('body_', @text:id)"/>
+ </xsl:attribute>
+ <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="*" mode="textOnly">
+ <xsl:apply-templates select="* | text()" mode="textOnly" />
+ </xsl:template>
+
+ <xsl:template match="text()" mode="textOnly">
+ <xsl:value-of select="."/>
+ </xsl:template>
+
+ <!-- Useful in case of 'style:map', conditional formatting, where a style references to another -->
+ <xsl:key name="textNotes" match="text:note" use="@text:note-class"/>
+
+ <!-- writing the footer- and endnotes beyond the body -->
+ <xsl:template name="write-text-nodes">
+ <xsl:param name="globalData"/>
+
+ <!-- write footnote body -->
+ <xsl:for-each select="key('textNotes', 'footnote')">
+ <xsl:call-template name="write-text-node">
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <!-- write endnote body -->
+ <xsl:for-each select="key('textNotes', 'endnote')">
+ <xsl:call-template name="write-text-node">
+
+ <xsl:with-param name="globalData" select="$globalData"/>
+ <xsl:with-param name="footnoteConfig" select="$globalData/office:styles/text:notes-configuration[@text:note-class=current()/@text:note-class]" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="write-text-node">
+ <xsl:param name="globalData"/>
+ <xsl:param name="footnoteConfig"/>
+
+ <xsl:apply-templates select="text:note-body/*[1]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="footnotePrefix">
+ <xsl:element name="span">
+ <xsl:attribute name="class">footnodeNumber</xsl:attribute>
+ <xsl:element name="a">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$footnoteConfig/@text:citation-style-name"/>
+ </xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@text:id"/>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:value-of select="concat('#body_', @text:id)"/>
+ </xsl:attribute>
+ <xsl:apply-templates mode="textOnly" select="text:note-citation"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="text:note-body/*[position()&gt;1]">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <!-- DISABLING this tab handling as the tab width is only relative
+ <xsl:template match="text:tab">
+ <xsl:param name="globalData"/>
+
+ <xsl:variable name="tabNo">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::text:line-break">
+ <xsl:call-template name="countTextTab"/>
+ </xsl:when>
+ <xsl:when test="preceding-sibling::text:tab">
+ <xsl:value-of select="count(preceding-sibling::text:tab)"/>
+ </xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="span">
+ <xsl:attribute name="style">margin-left:<xsl:value-of select="$globalData/all-doc-styles/style[@style:name = current()/parent::*/@text:style-name]/*/style:tab-stops/style:tab-stop[$tabNo]/@style:position"/>;</xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="countTextTab">
+ <xsl:param name="tabCount" select="1"/>
+ <xsl:param name="context" select="."/>
+
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*[1]">
+ <xsl:for-each select="preceding-sibling::*[1]">
+ <xsl:call-template name="countTextTab">
+ <xsl:with-param name="tabCout">
+ <xsl:choose>
+ <xsl:when test="name(.) = 'text:tab'">
+ <xsl:value-of select="$tabCount + 1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="context" select="preceding-sibling::*[1]" />
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$tabCount"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+-->
+ <!-- MathML -->
+ <xsl:template match="draw:object[math:math]">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <xsl:apply-templates select="math:math/math:semantics/*" mode="math"/>
+ </math>
+ </xsl:template>
+
+ <xsl:template match="*" mode="math">
+ <xsl:element name="{local-name()}" namespace="http://www.w3.org/1998/Math/MathML">
+ <xsl:apply-templates select="@*|node()" mode="math"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="@*" mode="math">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="math:annotation" mode="math"/>
+
+
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl
new file mode 100644
index 000000000000..e63ed0226a64
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/header.xsl
@@ -0,0 +1,488 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: header.xsl,v $
+
+ $Revision: 1.3.14.2 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+
+ <!-- ************** -->
+ <!-- *** header *** -->
+ <!-- ************** -->
+
+ <xsl:template name="create-header">
+ <xsl:param name="globalData" />
+
+ <xsl:element name="head">
+ <xsl:attribute name="profile">http://dublincore.org/documents/dcmi-terms/</xsl:attribute>
+ <xsl:if test="$debugEnabled"><xsl:message>CSS helper variable will be created....</xsl:message></xsl:if>
+ <xsl:call-template name='xhtml-header-properties'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+
+ <xsl:if test="$debugEnabled"><xsl:message>CSS variable ready, header will be created....</xsl:message></xsl:if>
+ <!-- constructing the css header simulating inheritance of style-families by style order -->
+ <xsl:call-template name='create-css-styleheader'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ <xsl:if test="$debugEnabled"><xsl:message>CSS header creation finished!</xsl:message></xsl:if>
+ </xsl:element>
+
+ </xsl:template>
+
+
+ <!-- Creating a CSS style header from the collected styles of the 'globalData' parameter -->
+ <xsl:template name='create-css-styleheader'>
+ <xsl:param name="globalData" />
+
+ <xsl:element name="style">
+ <xsl:attribute name="type">text/css</xsl:attribute>
+<xsl:text>
+ </xsl:text>
+ <xsl:call-template name='create-page-layout'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+<xsl:text>table { border-collapse:collapse; border-spacing:0; empty-cells:show }
+ </xsl:text>
+ <xsl:choose>
+ <xsl:when test="/*/office:body/office:spreadsheet"><xsl:text>td, th { vertical-align:top; font-size:10pt;}
+ </xsl:text></xsl:when>
+ <xsl:otherwise><xsl:text>td, th { vertical-align:top; font-size:12pt;}
+ </xsl:text></xsl:otherwise>
+ </xsl:choose>
+<xsl:text>h1, h2, h3, h4, h5, h6 { clear:both }
+ </xsl:text>
+<xsl:text>ol, ul { margin:0; padding:0;}
+ </xsl:text>
+<xsl:text>li { list-style: none; margin:0; padding:0;}
+ </xsl:text>
+<xsl:comment> "li span.odfLiEnd" - IE 7 issue</xsl:comment>
+<xsl:text>
+ </xsl:text>
+<xsl:text>li span. { clear: both; line-height:0; width:0; height:0; margin:0; padding:0; }
+ </xsl:text>
+<xsl:text>span.footnodeNumber { padding-right:1em; }
+ </xsl:text>
+<xsl:text>span.annotation_style_by_filter { font-size:95%; font-family:Arial; background-color:#fff000; margin:0; border:0; padding:0; }
+ </xsl:text>
+<xsl:text>* { margin:0;}
+ </xsl:text>
+ <xsl:call-template name="write-mapped-CSS-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="write-mapped-CSS-styles">
+ <xsl:param name="globalData" />
+ <xsl:param name="styleNo" select="1"/>
+ <xsl:param name="emptyStyles"/>
+
+ <xsl:choose>
+ <xsl:when test="$globalData/all-styles/style[$styleNo]">
+ <!-- If there is still a style to be written -->
+ <!-- setting the context -->
+ <xsl:for-each select="$globalData/all-styles/style[$styleNo]">
+ <xsl:choose>
+ <xsl:when test="final-properties != ''">
+ <!-- NOTE: easy process, as only the style family in conjunction with the style name, makes the style unambigous -->
+ <xsl:text>.</xsl:text><!--<xsl:value-of select="@style:family" /><xsl:text>:</xsl:text>--><xsl:value-of select="translate(@style:name, '.,;: %()[]/\+', '_____________')"/><xsl:text> { </xsl:text> <xsl:value-of select="final-properties" /><xsl:text>}
+ </xsl:text>
+ <xsl:call-template name="write-mapped-CSS-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="emptyStyles" select="$emptyStyles"/>
+ <xsl:with-param name="styleNo" select="$styleNo + 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="write-mapped-CSS-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="emptyStyles" select="concat($emptyStyles, '.', @style:name, ' ')"/>
+ <xsl:with-param name="styleNo" select="$styleNo + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Otherwise all styles have been processed and the empty styles have to be given out -->
+ <xsl:comment> ODF styles with no properties representable as CSS </xsl:comment><xsl:text>
+ </xsl:text><xsl:value-of select="$emptyStyles"/><xsl:text>{ }
+ </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <!-- Creating CSS page layout based on first office master style -->
+ <xsl:template name='create-page-layout'>
+ <xsl:param name="globalData" />
+
+ <!-- approximation to find the correct master page style (with page dimensions) -->
+ <xsl:variable name="masterPageNames">
+ <!-- set context to styles.xml -->
+ <xsl:for-each select="$globalData/all-doc-styles/style">
+ <!-- Loop over every style:style containing a @style:master-page-name attribute -->
+ <xsl:for-each select="key('masterPage','count')">
+ <!-- set context to styles.xml -->
+ <xsl:for-each select="/*/office:body">
+ <!-- Check if this style is being used in the body -->
+ <xsl:if test="key('elementUsingStyle', ../@style:name)">
+ <!-- Check every master-page-name if it is not emtpy and return as ';' separated list -->
+ <xsl:if test="string-length(../@style:master-page-name) &gt; 0"><xsl:value-of select="../@style:master-page-name"/>;</xsl:if>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:variable>
+ <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name -->
+ <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/>
+ <!-- Find the according style:page-layout and store the properties in a variable -->
+ <xsl:variable name="pageProperties" select="key('pageLayoutElements', $pageLayoutName)/style:page-layout-properties"/>
+
+<xsl:text>@page { </xsl:text>
+
+ <xsl:call-template name="page-size">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="pageProperties" select="$pageProperties" />
+ </xsl:call-template>
+ <xsl:call-template name="page-margin">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="pageProperties" select="$pageProperties" />
+ </xsl:call-template>
+
+<xsl:text> }
+ </xsl:text>
+
+ </xsl:template>
+
+
+ <xsl:template name="page-size">
+ <xsl:param name="globalData" />
+ <xsl:param name="pageProperties" />
+
+ <xsl:variable name="printOrientation" select="$pageProperties/@style:print-orientation" />
+ <xsl:variable name="pageWidth" select="$pageProperties/@fo:page-width" />
+ <xsl:variable name="pageHeight" select="$pageProperties/@fo:page-height" />
+ <xsl:choose>
+ <xsl:when test="$pageWidth and $pageHeight">
+ <xsl:text>size: </xsl:text>
+ <xsl:value-of select="$pageWidth" />
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$pageHeight" />
+ <xsl:text>; </xsl:text>
+ </xsl:when>
+ <xsl:when test="$printOrientation">
+ <xsl:text>size: </xsl:text>
+ <xsl:value-of select="$printOrientation" />
+ <xsl:text>; </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <xsl:template name="page-margin">
+ <xsl:param name="globalData" />
+ <xsl:param name="pageProperties" />
+
+ <xsl:variable name="marginTop" select="$pageProperties/@fo:margin-top" />
+ <xsl:if test="$marginTop">
+ <xsl:text>margin-top: </xsl:text>
+ <xsl:value-of select="$marginTop" />
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ <xsl:variable name="marginBottom" select="$pageProperties/@fo:margin-bottom" />
+ <xsl:if test="$marginBottom">
+ <xsl:text>margin-bottom: </xsl:text>
+ <xsl:value-of select="$marginBottom" />
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ <xsl:variable name="marginLeft" select="$pageProperties/@fo:margin-left" />
+ <xsl:if test="$marginLeft">
+ <xsl:text>margin-left: </xsl:text>
+ <xsl:value-of select="$marginLeft" />
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ <xsl:variable name="marginRight" select="$pageProperties/@fo:margin-right" />
+ <xsl:if test="$marginRight">
+ <xsl:text>margin-right: </xsl:text>
+ <xsl:value-of select="$marginRight" />
+ </xsl:if>
+ </xsl:template>
+
+
+ <!-- *************************** -->
+ <!-- *** Common XHTML header *** -->
+ <!-- *************************** -->
+
+ <xsl:template name='xhtml-header-properties'>
+ <xsl:param name="globalData" />
+
+ <xsl:variable name="netloc">
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
+ <xsl:if test="./@meta:name='ODF.base'">
+ <xsl:value-of select="." />
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined">
+ <xsl:if test="./@meta:name='ODF.filename'">
+ <xsl:value-of select="." />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="lang">
+ <xsl:choose>
+ <xsl:when test="$globalData/meta-file/*/office:meta/dc:language">
+ <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:language" />
+ </xsl:when>
+ <xsl:otherwise>en-US</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="prov">
+ <xsl:choose>
+ <xsl:when test="$globalData/meta-file/*/office:meta/meta:printed-by">
+ <xsl:value-of select="concat('Printed by &quot;',$globalData/meta-file/*/office:meta/meta:printed-by,'&quot;[dc:publisher] on &quot;',$globalData/meta-file/*/office:meta/meta:print-date,'&quot;[dc:date] in &quot;',$lang,'&quot;[dc:language]')" />
+ </xsl:when>
+ <xsl:otherwise />
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="keywords">
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:keyword">
+ <xsl:value-of select="." />
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <!-- explicit output content-type for low-tech browser (e.g. IE6) -->
+ <xsl:element name="meta">
+ <xsl:attribute name="http-equiv">Content-Type</xsl:attribute>
+ <xsl:attribute name="content">application/xhtml+xml; charset=utf-8</xsl:attribute>
+ </xsl:element>
+
+ <!-- title of document for browser frame title -->
+ <xsl:element name="title">
+ <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
+ <xsl:value-of select="$lang" />
+ </xsl:attribute>
+
+ <xsl:choose>
+ <xsl:when test="$globalData/meta-file/*/office:meta/dc:title">
+ <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
+ </xsl:when>
+ <!-- providing the mandatory title is a workaround for an IE bug-->
+ <xsl:otherwise>
+ <xsl:text>- no title specified</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+
+ <!-- title, in DC syntax -->
+ <xsl:element name="meta">
+ <xsl:attribute name="name">DCTERMS.title</xsl:attribute>
+ <xsl:attribute name="content">
+ <xsl:value-of select="$globalData/meta-file/*/office:meta/dc:title" />
+ </xsl:attribute>
+ <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
+ <xsl:value-of select="$lang" />
+ </xsl:attribute>
+ </xsl:element>
+
+ <!-- the identifier for source (identifier) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.identifier'" />
+ <xsl:with-param name="meta-data" select="translate($netloc, ' ','')" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.URI'" />
+ </xsl:call-template>
+
+ <!-- the language for source (language) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.language'" />
+ <xsl:with-param name="meta-data" select="$lang" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.RFC4646'" />
+ </xsl:call-template>
+
+ <!-- a bit commercial (generator) -->
+ <xsl:element name="meta">
+ <xsl:attribute name="name">DCTERMS.source</xsl:attribute>
+ <xsl:attribute name="content">http://xml.openoffice.org/odf2xhtml</xsl:attribute>
+ </xsl:element>
+
+ <!-- the author of the input source (author) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.creator'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:initial-creator" />
+ </xsl:call-template>
+
+ <!-- creation-date of the input source (issued) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.issued'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/meta:creation-date" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
+ </xsl:call-template>
+
+ <!-- name of last changing person of the input source (changedby) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.contributor'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:creator" />
+ </xsl:call-template>
+
+ <!-- last changing date of the input source (changed) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.modified'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:date" />
+ <xsl:with-param name="meta-enc" select="'DCTERMS.W3CDTF'" />
+ </xsl:call-template>
+
+ <!-- Last print, as provenance -->
+ <xsl:if test="$prov">
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.provenance'" />
+ <xsl:with-param name="meta-data" select="$prov" />
+ <xsl:with-param name="meta-lang" select="$lang" />
+ </xsl:call-template>
+ </xsl:if>
+
+ <!-- keywords about the input source (keywords) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.subject'" />
+ <xsl:with-param name="meta-data" select="normalize-space(concat($globalData/meta-file/*/office:meta/dc:subject,', ',$keywords))" />
+ <xsl:with-param name="meta-lang" select="$lang" />
+ </xsl:call-template>
+
+ <!-- detailed description about the input source (description) -->
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="'DCTERMS.description'" />
+ <xsl:with-param name="meta-data" select="$globalData/meta-file/*/office:meta/dc:description" />
+ <xsl:with-param name="meta-lang" select="$lang" />
+ </xsl:call-template>
+
+
+ <!-- user defined use of DCTERM tags -->
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DCTERMS.')][not(.='')]">
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="@meta:name" />
+ <xsl:with-param name="meta-data" select="." />
+ <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
+ </xsl:call-template>
+ </xsl:for-each>
+ <!-- user defined use of DC tags (legacy) -->
+ <xsl:for-each select="$globalData/meta-file/*/office:meta/meta:user-defined[starts-with(@meta:name,'DC.')][not(.='')]">
+ <xsl:call-template name="add-meta-tag">
+ <xsl:with-param name="meta-name" select="@meta:name" />
+ <xsl:with-param name="meta-data" select="." />
+ <!-- <xsl:with-param name="meta-lang" select="$lang" /> -->
+ </xsl:call-template>
+ </xsl:for-each>
+
+ <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" hreflang="en" />
+ <link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" hreflang="en" />
+ <link rel="schema.DCTYPE" href="http://purl.org/dc/dcmitype/" hreflang="en" />
+ <link rel="schema.DCAM" href="http://purl.org/dc/dcam/" hreflang="en" />
+ <!-- W3C GRDDL Profile -->
+ <!--
+ <link rel="transformation" href="http://xml.openoffice.org/odf2xhtml/rdf-extract.xsl" />
+ -->
+
+ <!-- base URL of document for resolving relative links -->
+ <xsl:element name="base">
+ <xsl:attribute name="href">
+ <!-- earlier 'targetURL' was used for an absoulte reference of base provided by the Office (file URL)
+ <xsl:value-of select="$targetURL" />
+ now '.' let relative links work, even if document has been moved -->
+ <xsl:text>.</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- generic template for adding common meta tags -->
+ <xsl:template name="add-meta-tag">
+ <xsl:param name="meta-name" />
+ <xsl:param name="meta-data" />
+ <xsl:param name="meta-enc" />
+ <xsl:param name="meta-lang" />
+
+ <xsl:if test="$meta-data">
+ <xsl:element name="meta">
+ <xsl:attribute name="name">
+ <xsl:value-of select="$meta-name" />
+ </xsl:attribute>
+ <xsl:attribute name="content">
+ <xsl:value-of select="$meta-data" />
+ </xsl:attribute>
+ <xsl:if test="$meta-enc">
+ <xsl:attribute name="scheme">
+ <xsl:value-of select="$meta-enc" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$meta-lang">
+ <xsl:attribute name="lang" namespace="http://www.w3.org/XML/1998/namespace">
+ <xsl:value-of select="$meta-lang" />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
new file mode 100644
index 000000000000..7d364cffee95
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/opendoc2xhtml.xsl
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: opendoc2xhtml.xsl,v $
+
+ $Revision: 1.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi xforms xsd xsi"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+
+ <!--+++++ INCLUDED XSL MODULES +++++-->
+
+ <!-- inheritance of office style properties is resolved into absolute styles. Office properties gathered as elements -->
+ <xsl:include href="../common/styles/style_collector.xsl" />
+
+ <!-- mapping rules of office style properties to CSS/HTML properties -->
+ <xsl:include href="../common/styles/style_mapping_css.xsl" />
+
+ <!-- office header element handling especially for XHTML -->
+ <xsl:include href="header.xsl" />
+
+ <!-- office body element handling especially for XHTML -->
+ <xsl:include href="body.xsl" />
+
+
+ <xsl:output method = "xml"
+ encoding = "UTF-8"
+ media-type = "application/xhtml+xml"
+ indent = "no"
+ omit-xml-declaration = "no"
+ doctype-public = "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
+ doctype-system = "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" />
+
+
+
+ <xsl:variable name="namespace" select="'http://www.w3.org/1999/xhtml'" />
+
+ <!--+++++ PARAMETER SECTION +++++-->
+
+ <!-- OPTIONAL: if the document content is provided in a directory structure. Opposite to a single flat XML stream -->
+ <xsl:param name="isPackageFormat" />
+
+ <!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a absolute file URL to the target directory.
+ Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
+ <xsl:param name="targetBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for all input document with content table) : parameter is a absolute file URL to the target document.
+ Relative links to this office document (e.g. to internal anchor) will get this parameter as a prefix -->
+ <xsl:param name="targetURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
+ To access contents of a office file (content like the meta.xml, styles.xml file or graphics) a URL could be choosen.
+ This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
+ "jar:file:/C:/temp/Test.sxw!/" for example.
+ When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
+ <xsl:param name="sourceBaseURL" select="'./'" />
+
+ <!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
+ Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
+ This URL session is used for example when links to graphics are created by XSLT. Otherwise the user havt to log again in for every graphic he liks to see. -->
+ <xsl:param name="optionalURLSuffix" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="metaFileURL" />
+
+ <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
+ <xsl:param name="stylesFileURL" />
+
+ <!-- OPTIONAL: DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')-->
+ <!-- Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
+ <!-- Cp. measure_conversion.xsl:
+ <xsl:param name="dpi" select="111" /> -->
+
+
+ <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
+ (e.g. encoding chapter names for the content-table as href and anchors ) -->
+ <xsl:param name="java" select="true()" />
+ <xsl:param name="javaEnabled" select="boolean($java)" />
+
+ <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
+ <xsl:param name="debug" select="false()" />
+ <xsl:param name="debugEnabled" select="boolean($debug)" />
+ <xsl:param name="onlyStyleOutput" select="false()" />
+ <xsl:param name="onlyStyleOutputEnabled" select="boolean($onlyStyleOutput)" />
+
+ <!-- ************************************* -->
+ <!-- *** build the propriate HTML file *** -->
+ <!-- ************************************* -->
+ <xsl:template match="/">
+ <!-- debug output of parameter value set -->
+ <xsl:if test="$debugEnabled">
+ <xsl:call-template name="debug-check-paramter" />
+ </xsl:if>
+ <!-- gathers style properties and
+ returns them as globalData parameter to the 'start-main' template -->
+ <xsl:call-template name="collect-global-odf-properties" />
+ </xsl:template>
+
+
+ <!-- *************************** -->
+ <!-- *** Built up XHTML file *** -->
+ <!-- *************************** -->
+ <xsl:template name="start-main">
+ <xsl:param name="globalData" />
+
+ <xsl:element name="html">
+ <xsl:comment>This file was converted to xhtml by OpenOffice.org - see http://xml.openoffice.org/odf2xhtml for more info.</xsl:comment>
+ <xsl:call-template name='create-header'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+
+ <xsl:call-template name='create-body'>
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- debug purpose only:
+ verbose checking of the parameters of this template-->
+ <xsl:template name="debug-check-paramter">
+ <xsl:message>Parameter dpi: <xsl:value-of select="$dpi" /></xsl:message>
+ <xsl:message>Parameter metaFileURL: <xsl:value-of select="$metaFileURL" /></xsl:message>
+ <xsl:message>Parameter stylesFileURL: <xsl:value-of select="$stylesFileURL" /></xsl:message>
+ <xsl:message>Parameter sourceBaseURL: <xsl:value-of select="$sourceBaseURL" /></xsl:message>
+ <xsl:message>Parameter targetBaseURL: <xsl:value-of select="$targetBaseURL" /></xsl:message>
+ <xsl:message>Parameter onlyStyleOutputEnabled: <xsl:value-of select="$onlyStyleOutputEnabled" /></xsl:message>
+ <xsl:message>Parameter debugEnabled: <xsl:value-of select="$debugEnabled" /></xsl:message>
+ <xsl:message>Parameter java: <xsl:value-of select="$java" /></xsl:message>
+ <xsl:message>Parameter javaEnabled: <xsl:value-of select="$javaEnabled" /></xsl:message>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
new file mode 100644
index 000000000000..9c82a8743aba
--- /dev/null
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2008 by Sun Microsystems, Inc.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ $RCSfile: table.xsl,v $
+
+ $Revision: 1.3 $
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org 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 version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<!--
+ For further documentation and updates visit http://xml.openoffice.org/odf2xhtml
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ooo="http://openoffice.org/2004/office"
+ xmlns:oooc="http://openoffice.org/2004/calc"
+ xmlns:ooow="http://openoffice.org/2004/writer"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xforms xlink xsd xsi"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+
+
+ <!-- current node is a table:table -->
+ <xsl:template name="create-table-children">
+ <xsl:param name="globalData" />
+ <xsl:param name="allVisibleTableRows" />
+ <xsl:param name="allTableColumns" />
+
+ <xsl:element name="colgroup">
+ <xsl:for-each select="$allTableColumns/table:table-column">
+ <xsl:if test="not(@table:visibility = 'collapse' or @table:visibility = 'filter')">
+ <xsl:element name="col">
+ <xsl:variable name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
+ <xsl:if test="$value">
+ <xsl:attribute name="width">
+ <!-- using the absolute width, problems with the relative in browser (in OOo style:rel-column-width) -->
+ <xsl:call-template name="convert2px">
+ <xsl:with-param name="value" select="$globalData/all-doc-styles/style[@style:name = current()/@table:style-name]/*/@style:column-width" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ <!-- *** the column-style ***
+ <xsl:attribute name="width">
+ <xsl:variable name="currentColumnStyleName" select="$allTableColumns/table:table-column[position() = $columnPosition]/@table:style-name" />
+ <xsl:value-of select="$globalData/all-doc-styles/style[@style:name = $currentColumnStyleName]/*/@style:column-width" />
+ </xsl:attribute>-->
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:element>
+
+ <xsl:call-template name="create-table-rows">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
+ <xsl:with-param name="allTableColumns" select="$allTableColumns" />
+ </xsl:call-template>
+ </xsl:template>
+
+
+
+ <!-- Creating the content of a table content using CSS styles -->
+ <xsl:template name="create-table-cell-content">
+ <xsl:param name="tableDataType" />
+ <xsl:param name="globalData" />
+ <xsl:param name="allTableColumns" />
+ <xsl:param name="columnPosition" />
+ <xsl:param name="currentTableColumn" />
+
+ <xsl:element name="{$tableDataType}">
+
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:if test="@table:number-columns-spanned and @table:number-columns-spanned > 1">
+ <xsl:attribute name="colspan">
+ <xsl:value-of select="@table:number-columns-spanned" />
+ </xsl:attribute>
+ </xsl:if>
+ <!-- if parser reads DTD the default is set to '1' -->
+ <xsl:if test="@table:number-rows-spanned and @table:number-rows-spanned > 1">
+ <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) office: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:call-template name="set-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="styleName" select="@table:style-name" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Cells without a style use the 'table:default-cell-style-name'
+ when there is no default cell style specified for the current column. -->
+ <xsl:variable name="defaultCellStyleName" select="$currentTableColumn/@table:default-cell-style-name" />
+ <xsl:choose>
+ <xsl:when test="$defaultCellStyleName">
+ <xsl:call-template name="set-styles">
+ <xsl:with-param name="globalData" select="$globalData" />
+ <xsl:with-param name="styleName" select="$defaultCellStyleName" />
+ <xsl:with-param name="currentTableColumn" select="$currentTableColumn" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- No cell style exists, nor a default table cell style for the column -->
+ <xsl:attribute name="style">
+ <!-- sets cell alignment dependent of cell value type -->
+ <xsl:call-template name="set-cell-alignment" />
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="$debugEnabled">
+ <xsl:message>A table cell '<xsl:value-of select="$tableDataType" />' element has been added!</xsl:message>
+ </xsl:if>
+
+ <!-- empty cell tags produce problems with width CSS style on itself other table cells as well
+ therefore an non breakable space (&nbsp;/&#160;) have been inserted.-->
+ <xsl:choose>
+ <xsl:when test="node()">
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="apply-styles-and-content">
+ <xsl:with-param name="globalData" select="$globalData" />
+ </xsl:call-template>
+ <xsl:text>&#160;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- Sets the cell alignment by the 'office:value-type' of the 'table:table-cell'.
+ Strings have a left alignment, other values right -->
+ <xsl:template name="set-cell-alignment">
+ <xsl:choose>
+ <xsl:when test="@office:value-type and not(@office:value-type = 'string')">text-align:right; </xsl:when>
+ <xsl:otherwise>text-align:left;</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+
+ <!-- Sets styles of a cell -->
+ <xsl:template name="set-styles">
+ <xsl:param name="globalData" />
+ <xsl:param name="styleName" />
+ <xsl:param name="currentTableColumn" />
+
+ <xsl:attribute name="style">
+ <!-- sets cell alignment dependent of cell value type -->
+ <xsl:call-template name="set-cell-alignment" />
+
+ <!-- set column style (disjunct of cell style) -->
+ <xsl:value-of select="$globalData/all-styles/style[@style:name = $currentTableColumn/@table:style-name]/final-properties" />
+
+ </xsl:attribute>
+
+ <!-- cell style header -->
+ <xsl:attribute name="class">
+ <xsl:value-of select="translate($styleName, '.,;: %()[]/\+', '_____________')"/>
+ </xsl:attribute>
+ </xsl:template>
+</xsl:stylesheet>
+