优化项目结构、优化 maven 结构

This commit is contained in:
chenkailing
2021-02-10 00:58:13 +08:00
parent 28d3e05ca9
commit 2542a24675
3610 changed files with 77 additions and 180 deletions

View File

@@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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>

View File

@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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>

View File

@@ -0,0 +1,280 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,729 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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 = ', , , ...' 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>

View File

@@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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 = ', , , ...'">
<!-- ', , , ...' 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>

View File

@@ -0,0 +1,397 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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>

View File

@@ -0,0 +1,854 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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>

View File

@@ -0,0 +1,308 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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 = ', , , ...'">
<!-- ', , , ...' 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>

View File

@@ -0,0 +1,412 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns: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>

File diff suppressed because it is too large Load Diff