summaryrefslogtreecommitdiff
path: root/filter/source/xslt/import/wordml
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/xslt/import/wordml')
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo.xsl348
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl284
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_draw.xsl2213
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_field.xsl1587
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_list.xsl657
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_page.xsl387
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_path.xsl1818
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_props.xsl107
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_settings.xsl69
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_table.xsl1286
-rw-r--r--filter/source/xslt/import/wordml/wordml2ooo_text.xsl1058
11 files changed, 9814 insertions, 0 deletions
diff --git a/filter/source/xslt/import/wordml/wordml2ooo.xsl b/filter/source/xslt/import/wordml/wordml2ooo.xsl
new file mode 100644
index 000000000000..1f36f195f3cd
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo.xsl
@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:fla="urn:experimental:fla">
+ <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+ <xsl:include href="../../common/measure_conversion.xsl"/>
+ <xsl:include href="../common/ms2ooo_docpr.xsl"/>
+ <xsl:include href="wordml2ooo_text.xsl"/>
+ <xsl:include href="wordml2ooo_settings.xsl"/>
+ <xsl:include href="wordml2ooo_table.xsl"/>
+ <xsl:include href="wordml2ooo_page.xsl"/>
+ <xsl:include href="wordml2ooo_list.xsl"/>
+ <xsl:include href="wordml2ooo_draw.xsl"/>
+ <xsl:include href="wordml2ooo_field.xsl"/>
+ <xsl:include href="wordml2ooo_props.xsl"/>
+ <xsl:key name="paragraph-style" match="w:style[@w:type = 'paragraph']" use="@w:styleId"/>
+ <xsl:key name="heading-style" match="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl]" use="@w:styleId"/>
+ <xsl:variable name="preserve-alien-markup">no</xsl:variable>
+ <xsl:variable name="native-namespace-prefixes">,w,o,v,wx,aml,w10,dt,</xsl:variable>
+ <xsl:variable name="to-dispatch-elements">,wx:sect,wx:sub-section,w:p,w:tbl,w:sectPr,w:r,w:fldSimple,w:hlink,w:t,w:pict,w:br,w:instrText,w:fldChar,w:tab,w:footnote,w:endnote,aml:annotation,w:hlink,w:footnote,w:endnote,w:tblGrid,w:tr,w:tc,wx:pBdrGroup,</xsl:variable>
+ <xsl:template match="/">
+ <xsl:apply-templates select="w:wordDocument"/>
+ </xsl:template>
+ <xsl:template match="*" mode="dispatch">
+ <xsl:choose>
+ <xsl:when test="not(contains($native-namespace-prefixes, concat(',', substring-before(name(), ':'), ',')))">
+ <!-- if alien namespace dispatch -->
+ <xsl:choose>
+ <xsl:when test="$preserve-alien-markup = 'yes'">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains($to-dispatch-elements, concat(',',name(),','))">
+ <xsl:apply-templates select="current()"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:wordDocument">
+ <office:document office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.0">
+ <fla:fla.activate/>
+ <xsl:apply-templates select="o:DocumentProperties"/>
+ <xsl:apply-templates select="w:docOleData" mode="init"/>
+ <xsl:apply-templates select="w:docPr"/>
+ <xsl:apply-templates select="w:fonts"/>
+ <xsl:apply-templates select="w:styles"/>
+ <xsl:apply-templates select="w:body"/>
+ <xsl:apply-templates select="w:docOleData" mode="exit"/>
+ </office:document>
+ </xsl:template>
+ <xsl:template match="w:fonts">
+ <xsl:element name="office:font-face-decls">
+ <!-- MS Word's default font declaration, added for Writer automatically. glu -->
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Symbol" svg:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
+ <style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ <xsl:if test="not(w:font[@w:name='StarSymbol'])">
+ <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" style:font-charset="x-symbol"/>
+ </xsl:if>
+ <xsl:for-each select="w:font">
+ <xsl:element name="style:font-face">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="@w:name"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:font-family">
+ <xsl:value-of select="@w:name"/>
+ </xsl:attribute>
+ <!-- added by glu, for process special fonts e.g. Marlett, -->
+ <xsl:if test="w:charset/@w:val = '02'">
+ <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:family">
+ <xsl:choose>
+ <xsl:when test="w:family/@w:val = 'Swiss'">
+ <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Modern'">
+ <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Roman'">
+ <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Script'">
+ <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='Decorative'">
+ <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:family/@w:val='System'">
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pitch and string-length(w:pitch/@w:val) &gt; 0">
+ <xsl:attribute name="style:font-pitch">
+ <xsl:choose>
+ <xsl:when test="w:pitch/@w:val = 'default'">variable</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:pitch/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:styles">
+ <office:styles>
+ <!--The next statement Added by wguo,collect the pict's dash and mark-style.The template is implemented in file wordml2ooo_draw.xsl-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style4dash_mark"/>
+ <xsl:apply-templates select="//v:fill" mode="office-style"/>
+ <xsl:call-template name="create-default-paragraph-styles"/>
+ <xsl:call-template name="create-default-text-styles"/>
+ <xsl:call-template name="create-default-frame-style"/>
+ <!-- StarWriter has no default style family 'list'. glu -->
+ <xsl:if test="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl and w:pPr/w:listPr]">
+ <xsl:call-template name="create-outline-style"/>
+ </xsl:if>
+ <xsl:apply-templates select="w:style[@w:type='table']" mode="table"/>
+ <xsl:apply-templates select="w:style[@w:type='list']" mode="list"/>
+ <xsl:apply-templates select="w:style[@w:type!='list']"/>
+ <xsl:apply-templates select="/w:wordDocument/w:docPr/w:footnotePr" mode="config"/>
+ <xsl:apply-templates select="/w:wordDocument/w:docPr/w:endnotePr" mode="config"/>
+ </office:styles>
+ <office:automatic-styles>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:p" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:rPr[not(parent::w:pPr)]" mode="style"/>
+ <!--The next statement Added by wguo for the pict's draw-style.The template is implemented in file wordml2ooo_draw.xsl-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:pict" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:tblPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:gridCol" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:trPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:tcPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:listPr" mode="style"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="page-layout"/>
+ <xsl:call-template name="default_date_style"/>
+ <!--add for generate the date , time style for date , time field G.Y.-->
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText | /w:wordDocument/w:body//w:fldSimple " mode="style"/>
+ </office:automatic-styles>
+ <office:master-styles>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="master-page"/>
+ </office:master-styles>
+ </xsl:template>
+ <xsl:template match="w:style">
+ <style:style>
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ <xsl:if test="w:basedOn">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:next">
+ <xsl:attribute name="style:next-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="@w:type = 'character'">
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:when>
+ <!-- table, paragraph are the same as in Writer . glu -->
+ <xsl:when test="@w:type">
+ <xsl:attribute name="style:family">
+ <xsl:value-of select="@w:type"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@w:type = 'table'">
+ <xsl:element name="style:table-properties">
+ <!-- xsl:apply-templates select="w:tblPr" mode="style"/ -->
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@w:type = 'character' ">
+ <xsl:element name="style:text-properties">
+<!--
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ <xsl:apply-templates select="w:rPr"/>
+-->
+ <xsl:for-each select="w:rPr">
+ <xsl:call-template name="text-properties"/>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="style:paragraph-properties">
+ <xsl:apply-templates select="w:pPr"/>
+ </xsl:element>
+ <xsl:element name="style:text-properties">
+ <xsl:apply-templates select="w:rPr"/>
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:body">
+ <xsl:element name="office:body">
+ <xsl:element name="office:text">
+ <!-- to add the sequece variable declaration at the begining of the office:body G.Y.-->
+ <text:sequence-decls>
+ <xsl:call-template name="default_seqence_declaration"/>
+ <xsl:apply-templates select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,3) = 'SEQ' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,3) = 'SEQ' ] " mode="sequence_declare"/>
+ </text:sequence-decls>
+ <!-- add the user field variables declare for Docpropety fields importing G.Y.-->
+ <text:user-field-decls>
+ <xsl:call-template name="user_fields_declare_docproperty"/>
+ </text:user-field-decls>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="wx:sect">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <xsl:template match="wx:sub-section">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <xsl:template name="create-default-frame-style">
+ <!--add for default frame style -->
+ <style:style style:name="Frame" style:family="graphic">
+ <style:graphic-properties text:anchor-type="paragraph" svg:x="0in" svg:y="0in" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="ConvertMeasure">
+ <xsl:param name="TargetMeasure" select="'cm'"/>
+ <xsl:param name="TargetTruncate" select=" 'all' "/>
+ <xsl:param name="value"/>
+ <!-- When TargetTruncate ='all' it returns the number whichsoever the return value is negative or positive
+ When TargetTruncate ='nonNegative' it only returns nonNegative number, all negative number to be returned as 0
+ When TargetTruncate ='positive" it only returns positive number, all nonPositive number to be returned as 1 -->
+ <xsl:variable name="return_value">
+ <xsl:choose>
+ <!-- remove the measure mark, if the value is null, the result should be 0. Must be the first case -->
+ <xsl:when test="string-length(translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ','')) = 0">0</xsl:when>
+ <xsl:when test="string-length(translate($value,'-.0123456789 ','')) = 0">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'cm'">
+ <xsl:call-template name="convert2cm">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'pt'">
+ <xsl:call-template name="convert2pt">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'twip'">
+ <xsl:call-template name="convert2twip">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$TargetMeasure = 'in'">
+ <xsl:call-template name="convert2in">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$TargetTruncate = 'all' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'nonNegative' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt; 0 ">
+ <xsl:value-of select=" '0' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$TargetTruncate = 'positive' ">
+ <xsl:choose>
+ <xsl:when test="number($TargetMeasure) = 'NaN' ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" $return_value &lt;= 0 ">
+ <xsl:value-of select=" '1' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$return_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl
new file mode 100644
index 000000000000..118c63301774
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_custom_draw.xsl
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
+ <xsl:template name="ms_word_draw_map2ooo_custom_draw">
+ <xsl:param name="ms_word_draw_type"/>
+ <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl-->
+ <xsl:choose>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t5' ">
+ <xsl:value-of select=" 'isosceles-triangle'"/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type ='#_x0000_t6' ">
+ <xsl:value-of select=" 'right-triangle' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t8' ">
+ <xsl:value-of select=" 'trapezoid' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t4' ">
+ <xsl:value-of select=" 'diamond' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t9' ">
+ <xsl:value-of select=" 'hexagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t7' ">
+ <xsl:value-of select="'parallelogram' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t56' ">
+ <xsl:value-of select=" 'pentagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t10' ">
+ <xsl:value-of select=" 'octagon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t11' ">
+ <xsl:value-of select=" 'cross' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t23' ">
+ <xsl:value-of select=" 'ring' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t95' ">
+ <xsl:value-of select=" 'block-arc' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t22' ">
+ <xsl:value-of select=" 'can' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t16' ">
+ <xsl:value-of select=" 'cube' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t65' ">
+ <xsl:value-of select=" 'paper' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t96' ">
+ <xsl:value-of select=" 'smiley' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t183' ">
+ <xsl:value-of select=" 'sun' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t184' ">
+ <xsl:value-of select=" 'moon' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t74' ">
+ <xsl:value-of select=" 'heart' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t57' ">
+ <xsl:value-of select=" 'forbidden' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type ='#_x0000_t85' ">
+ <xsl:value-of select=" 'left-bracket' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t86' ">
+ <xsl:value-of select=" 'right-bracket' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t87' ">
+ <xsl:value-of select=" 'left-brace' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t88' ">
+ <xsl:value-of select=" 'right-brace' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t185' ">
+ <xsl:value-of select=" 'bracket-pair' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t186' ">
+ <xsl:value-of select=" 'brace-pair' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t189' ">
+ <xsl:value-of select=" 'quad-bevel' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t66' ">
+ <xsl:value-of select=" 'left-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t67' ">
+ <xsl:value-of select=" 'down-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t68' ">
+ <xsl:value-of select=" 'up-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t13' ">
+ <xsl:value-of select=" 'right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t69' ">
+ <xsl:value-of select=" 'left-right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t70' ">
+ <xsl:value-of select=" 'up-down-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t89' ">
+ <xsl:value-of select=" 'mso-spt89' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t76' ">
+ <xsl:value-of select=" 'quad-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t94' ">
+ <xsl:value-of select=" 'notched-right-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
+ <xsl:value-of select=" 'pentagon-right' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t55' ">
+ <xsl:value-of select=" 'chevron' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t79' ">
+ <xsl:value-of select=" 'up-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t80' ">
+ <xsl:value-of select=" 'down-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t82' ">
+ <xsl:value-of select=" 'up-down-arrow-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t103' ">
+ <xsl:value-of select=" 'circular-arrow' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t109' ">
+ <xsl:value-of select=" 'flowchart-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
+ <xsl:value-of select=" 'flowchart-alternate-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t110' ">
+ <xsl:value-of select=" 'flowchart-decision' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t111' ">
+ <xsl:value-of select=" 'flowchart-data' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t112' ">
+ <xsl:value-of select=" 'flowchart-predefined-process' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t113' ">
+ <xsl:value-of select=" 'flowchart-internal-storage' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t114' ">
+ <xsl:value-of select=" 'flowchart-document' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t115' ">
+ <xsl:value-of select=" 'flowchart-multidocument' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t116' ">
+ <xsl:value-of select=" 'flowchart-terminator' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t117' ">
+ <xsl:value-of select=" 'flowchart-preparation' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t118' ">
+ <xsl:value-of select=" 'flowchart-manual-input' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t119' ">
+ <xsl:value-of select=" 'flowchart-manual-operation' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t120' ">
+ <xsl:value-of select=" 'flowchart-connector' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t177' ">
+ <xsl:value-of select=" 'flowchart-off-page-connector' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t121' ">
+ <xsl:value-of select=" 'flowchart-card' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t122' ">
+ <xsl:value-of select=" 'flowchart-punched-tape' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t123' ">
+ <xsl:value-of select=" 'flowchart-summing-junction' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t124' ">
+ <xsl:value-of select=" 'flowchart-or' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t125' ">
+ <xsl:value-of select=" 'flowchart-collate' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t126' ">
+ <xsl:value-of select=" 'flowchart-sort' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t127' ">
+ <xsl:value-of select=" 'flowchart-extract' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t128' ">
+ <xsl:value-of select=" 'flowchart-merge' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t130' ">
+ <xsl:value-of select=" 'flowchart-stored-data' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t135' ">
+ <xsl:value-of select=" 'flowchart-delay' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t131' ">
+ <xsl:value-of select=" 'flowchart-sequential-access' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t132' ">
+ <xsl:value-of select=" 'flowchart-magnetic-disk' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t133' ">
+ <xsl:value-of select=" 'flowchart-direct-access-storage' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t134' ">
+ <xsl:value-of select=" 'flowchart-display' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t61' ">
+ <xsl:value-of select=" 'rectangular-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t62' ">
+ <xsl:value-of select=" 'round-rectangular-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t63' ">
+ <xsl:value-of select=" 'round-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t106' ">
+ <xsl:value-of select=" 'cloud-callout' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t50' ">
+ <xsl:value-of select=" 'line-callout-1' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t51' ">
+ <xsl:value-of select=" 'line-callout-2' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t47' ">
+ <xsl:value-of select=" 'line-callout-3' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t72' ">
+ <xsl:value-of select=" 'bang' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t187' ">
+ <xsl:value-of select=" 'star4' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t12' ">
+ <xsl:value-of select=" 'star5' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t58' ">
+ <xsl:value-of select=" 'star8' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t92' ">
+ <xsl:value-of select=" 'star24' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t97' ">
+ <xsl:value-of select=" 'vertical-scroll' "/>
+ </xsl:when>
+ <xsl:when test="$ms_word_draw_type = '#_x0000_t98' ">
+ <xsl:value-of select=" 'horizontal-scroll' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl
new file mode 100644
index 000000000000..e0737d1374fa
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_draw.xsl
@@ -0,0 +1,2213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xalan="http://xml.apache.org/xalan" xmlns:oleextracter="MyOleExtracter" xmlns:ole="java:XSLTFilterOLEExtracter" xmlns:java="http://saxon.sf.net/java-type" exclude-result-prefixes="w wx aml o dt v xalan ole oleextracter java" extension-element-prefixes="oleextracter">
+ <xsl:include href="wordml2ooo_custom_draw.xsl"/>
+ <xsl:include href="wordml2ooo_path.xsl"/>
+ <xsl:param name="oleExtractor" as="java:XSLTFilterOLEExtracter" select="ole:new()"/>
+ <xsl:param name="XMultiServiceFactory" as="java:com.sun.star.lang.XMultiServiceFactory" select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+
+
+ <xsl:key name="imagedata" match="w:binData" use="@w:name"/>
+ <xsl:key name="shapetype" match="v:shapetype" use="concat('#', @id)"/>
+ <xsl:template match="v:fill" mode="get-xsl-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="get-xsl-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:template>
+ <xsl:template match="v:fill" mode="office-style">
+ <xsl:choose>
+ <xsl:when test="@type='pattern' or @type='tile' or @type='frame'">
+ <xsl:variable name="fill-src" select="key('imagedata',@src)"/>
+ <xsl:if test="$fill-src">
+ <draw:fill-image>
+ <xsl:if test="string-length(@o:title) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="@o:title"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="translate(@src,'&#9;&#10;&#13;&#32;:/.','' ) "/>
+ </xsl:attribute>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="translate($fill-src/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </xsl:element>
+ </draw:fill-image>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="contains(@type,'gradient')">
+ <draw:gradient>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select=" 'gradient' "/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:fill" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:style">linear</xsl:attribute>
+ <xsl:if test="string-length(parent::v:*/@fillcolor) &gt; 0">
+ <xsl:attribute name="draw:start-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="parent::v:*/@fillcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length(@color2) &gt; 0">
+ <xsl:attribute name="draw:end-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="@color2"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </draw:gradient>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:pict" mode="style4dash_mark">
+ <xsl:if test="descendant::v:line or descendant::v:rect or descendant::v:oval or descendant::v:arc or descendant::v:shape">
+ <!--Changed-->
+ <xsl:variable name="vchild" select="./v:*"/>
+ <xsl:variable name="def" select="$vchild/v:stroke"/>
+ <xsl:if test="$def">
+ <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> -->
+ <xsl:variable name="wdashstyle" select="$vchild/v:stroke/@dashstyle"/>
+ <xsl:variable name="stroke-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="ptweight">
+ <xsl:choose>
+ <xsl:when test="$vchild/@strokeweight">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ <xsl:with-param name="value" select="$vchild/@strokeweight"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'pt'"/>
+ <xsl:with-param name="value" select="'1pt'"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$wdashstyle and not ($wdashstyle = 'solid')">
+ <xsl:variable name="strdashdot">
+ <xsl:call-template name="getstrdashdot">
+ <xsl:with-param name="dashstyle" select="$wdashstyle"/>
+ <!--<xsl:with-param name="weight" select="$vchild/@strokeweight"/>-->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="draw-style">
+ <xsl:variable name="end-cap" select="$vchild/v:stroke/@endcap"/>
+ <xsl:choose>
+ <xsl:when test="$end-cap = 'round'">round</xsl:when>
+ <xsl:otherwise>rect</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot1-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dol:'"/>
+ <xsl:with-param name="suffix" select="';don'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot1n">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'don:'"/>
+ <xsl:with-param name="suffix" select="';dist'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dist-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dist:'"/>
+ <xsl:with-param name="suffix" select="';dtl'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2-length">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dtl:'"/>
+ <xsl:with-param name="suffix" select="';dtn'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2n">
+ <xsl:call-template name="get-middle-substring">
+ <xsl:with-param name="string" select="$strdashdot"/>
+ <xsl:with-param name="prefix" select="'dtn:'"/>
+ <xsl:with-param name="suffix" select="';eddtn'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="draw:stroke-dash">
+ <!--dol:8;don:1;dist:2;dtl:1;dtn:2;eddtn" />-->
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="concat('Tdash',$stroke-num)"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:style">
+ <xsl:value-of select="$draw-style"/>
+ </xsl:attribute>
+ <xsl:if test="(string-length($dot1n) &gt; 0 ) and not ($dot1n ='-1')">
+ <xsl:attribute name="draw:dots1">
+ <xsl:value-of select="$dot1n"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot2n) &gt; 0 ) and not ($dot2n ='-1')">
+ <xsl:attribute name="draw:dots2">
+ <xsl:value-of select="$dot2n"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot1-length) &gt; 0 ) and not ($dot1-length ='-1')">
+ <xsl:attribute name="draw:dots1-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dot1-length,'pt')"/>
+ </xsl:call-template>in</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dot2-length) &gt; 0 ) and not ($dot2-length ='-1')">
+ <xsl:attribute name="draw:dots2-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dot2-length,'pt')"/>
+ </xsl:call-template>in</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="(string-length($dist-length) &gt; 0 ) and not ($dist-length ='-1')">
+ <xsl:variable name="valdistance-length">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($dist-length,'pt')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="draw:distance">
+ <xsl:value-of select="$valdistance-length*$ptweight"/>in</xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@startarrow">
+ <xsl:call-template name="CreateArrowStyle">
+ <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@startarrow"/>
+ <xsl:with-param name="namenumber" select="concat('markerstart',$stroke-num)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@endarrow">
+ <xsl:call-template name="CreateArrowStyle">
+ <xsl:with-param name="arrow-name" select="$vchild/v:stroke/@endarrow"/>
+ <xsl:with-param name="namenumber" select="concat('markerend',$stroke-num)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <!--<v:stroke dashstyle="1 1" startarrow="diamond" startarrowwidth="wide" startarrowlength="long" endarrow="block"
+ endarrowwidth="wide" endarrowlength="long" endcap="round"/>
+ <draw:stroke-dash draw:name="2 2dots 1 dash" draw:style="rect" draw:dots1="2" draw:dots2="1" draw:dots2-length="0.0795in"
+ draw:distance="0.102in"/>
+ Hehe,It need to be revised-->
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="CreateArrowStyle">
+ <!--<draw:marker draw:name="Stupid33" svg:viewBox="0 0 20 30" svg:d="m10 0-10 30h20z"/> -->
+ <xsl:param name="arrow-name"/>
+ <xsl:param name="namenumber"/>
+ <xsl:param name="arrow-weight"/>
+ <xsl:variable name="svg-box">
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'block' ">0 0 1131 902</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">0 0 10 10</xsl:when>
+ <xsl:when test="$arrow-name = 'open' ">0 0 1122 2243</xsl:when>
+ <xsl:when test="$arrow-name = 'oval' ">0 0 1131 1131</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">0 0 1131 1131</xsl:when>
+ <xsl:when test="$arrow-name = 'classic' ">0 0 1131 1580</xsl:when>
+ <xsl:otherwise>0 0 1122 2243</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="svg-d">
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'block' ">m564 0-564 902h1131z</xsl:when>
+ <!--Symmetric Arrow-->
+ <xsl:when test="$arrow-name = 'diamond' ">m0 0h10v10h-10z</xsl:when>
+ <xsl:when test="$arrow-name = 'open' ">m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:when>
+ <xsl:when test="$arrow-name = 'oval' ">m462 1118-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z</xsl:when>
+ <xsl:when test="$arrow-name = 'diamond' ">m0 564 564 567 567-567-567-564z</xsl:when>
+ <xsl:when test="$arrow-name = 'classic' ">m1013 1491 118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z</xsl:when>
+ <xsl:otherwise>m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="draw:marker">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="$namenumber"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:display-name">
+ <xsl:value-of select="$namenumber"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$svg-box"/>
+ </xsl:attribute>
+ <xsl:attribute name="svg:d">
+ <xsl:value-of select="$svg-d"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <!-- The template MapDashConst Map the const dashstyle to a number manner
+ It calls the template kickblanks to delete the extra blanks in the dash style here is the map
+• Solid (default) • ShortDash "2 2"
+• ShortDot "0 2" • ShortDashDot "2 2 0 2"
+• ShortDashDotDot "2 2 0 2 0 2" • Dot "1 2"
+• Dash "4 2" • LongDash "8 2"
+• DashDot "4 2 1 2"• LongDashDot "8 2 1 2"
+• LongDashDotDot "8 2 1 2 1 2"
+-->
+ <xsl:template name="MapDashConst">
+ <xsl:param name="dashstyle"/>
+ <xsl:choose>
+ <xsl:when test="$dashstyle='shortDash'"> 2 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDot'"> 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDashDot'"> 2 2 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='shortDashDotDot'"> 2 2 0 2 0 2 </xsl:when>
+ <xsl:when test="$dashstyle='dot'"> 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='dash'"> 4 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDash'"> 8 2 </xsl:when>
+ <xsl:when test="$dashstyle='dashDot'"> 4 2 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDashDot'"> 8 2 1 2 </xsl:when>
+ <xsl:when test="$dashstyle='longDashDotDot'"> 8 2 1 2 1 2 </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="str-style" select="concat(' ',$dashstyle ,' ')"/>
+ <xsl:variable name="cleanstyle">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="translate($str-style,' ','-')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="translate($cleanstyle,'-',' ')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--The template is used to delete the extra blanks from a string.-->
+ <xsl:template name="kickblanks">
+ <xsl:param name="str"/>
+ <xsl:variable name="tmpstr">
+ <xsl:choose>
+ <xsl:when test="contains($str,'--')">
+ <xsl:variable name="str-before">
+ <xsl:value-of select="substring-before($str,'--')"/>
+ </xsl:variable>
+ <xsl:variable name="str-after">
+ <xsl:value-of select="substring-after($str,'--')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($str-before,'-',$str-after)"/>
+ </xsl:when>
+ <xsl:when test="contains($str,' ')">
+ <xsl:variable name="str-before">
+ <xsl:value-of select="substring-before($str,' ')"/>
+ </xsl:variable>
+ <xsl:variable name="str-after">
+ <xsl:value-of select="substring-after($str,' ')"/>
+ </xsl:variable>
+ <xsl:value-of select="concat($str-before,' ',$str-after)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not ( string-length($str) = string-length($tmpstr) )">
+ <xsl:variable name="restr">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="$tmpstr"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$restr"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="substrcount">
+ <xsl:param name="str"/>
+ <xsl:param name="substr"/>
+ <xsl:choose>
+ <xsl:when test="$substr and string-length($str) and contains($str,$substr) and string-length(substring-before($str,$substr)) = 0">
+ <xsl:variable name="restr" select="substring-after($str,$substr)"/>
+ <xsl:variable name="num">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$restr"/>
+ <xsl:with-param name="substr" select="$substr"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$num+1"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="lastest-substr-after">
+ <xsl:param name="str"/>
+ <xsl:param name="substr"/>
+ <xsl:choose>
+ <xsl:when test="contains($str,$substr) and string-length(substring-before($str,$substr)) = 0">
+ <xsl:variable name="restr" select="substring-after($str,$substr)"/>
+ <xsl:call-template name="lastest-substr-after">
+ <xsl:with-param name="str" select="$restr"/>
+ <xsl:with-param name="substr" select="$substr"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Template get_revised_adj is used to get real adj when adj show two time in the file. -->
+ <xsl:template name="get_remained_adj">
+ <xsl:param name="adj_typeid"/>
+ <xsl:param name="num"/>
+ <xsl:param name="mark"/>
+ <xsl:choose>
+ <xsl:when test="$num &gt; 0 ">
+ <xsl:variable name="new_remained_adj">
+ <xsl:choose>
+ <xsl:when test="string-length($adj_typeid) &gt; 0">
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="substring-after($adj_typeid,$mark)"/>
+ <xsl:with-param name="num" select="$num -1"/>
+ <xsl:with-param name="mark" select="$mark"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$new_remained_adj"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$adj_typeid"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--Template get_non_omit_adj is used to get the non-omit adj.(e.g. Adj="10,,11" means modifiers="10 0 11").-->
+ <xsl:template name="get_non_omit_adj">
+ <xsl:param name="adj_typeid"/>
+ <xsl:param name="num"/>
+ <xsl:param name="mark"/>
+ <xsl:choose>
+ <xsl:when test="$num &gt; 0 ">
+ <xsl:variable name="before" select="substring-before($adj_typeid,',')"/>
+ <xsl:variable name="after" select="substring-after($adj_typeid,',')"/>
+ <xsl:variable name="zero_or_itself">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($before, ' ','' ) ) &gt; 0">
+ <xsl:value-of select="$before"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new_non_omit_adj">
+ <xsl:call-template name="get_non_omit_adj">
+ <xsl:with-param name="adj_typeid" select="$after"/>
+ <xsl:with-param name="num" select="$num -1"/>
+ <xsl:with-param name="mark" select="$mark"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat($zero_or_itself, ' ',$new_non_omit_adj)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="zero_or_itself">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($adj_typeid, ' ','' ) ) &gt; 0">
+ <xsl:value-of select="$adj_typeid"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'0'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$zero_or_itself"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="getstrdashdot">
+ <!--Remember the robust!if dashstyle is '2'?What to do!-->
+ <xsl:param name="dashstyle"/>
+ <xsl:variable name="dstyle">
+ <xsl:variable name="tmpstyle">
+ <xsl:call-template name="MapDashConst">
+ <xsl:with-param name="dashstyle" select="$dashstyle"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-after($tmpstyle,' ')"/>
+ </xsl:variable>
+ <xsl:variable name="dot1" select="substring-before($dstyle,' ')"/>
+ <xsl:variable name="dot1after" select="substring-after($dstyle,' ')"/>
+ <xsl:variable name="dot1distance" select="substring-before($dot1after,' ')"/>
+ <xsl:variable name="modesubstr1" select="concat($dot1,' ',$dot1distance,' ')"/>
+ <xsl:variable name="dot1n">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$dstyle"/>
+ <xsl:with-param name="substr" select="$modesubstr1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2substr">
+ <xsl:call-template name="lastest-substr-after">
+ <xsl:with-param name="str" select="$dstyle"/>
+ <xsl:with-param name="substr" select="$modesubstr1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="dot2">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:value-of select="substring-before($dot2substr,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="dot2distance">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:variable name="tmpstr" select="substring-after($dot2substr,' ')"/>
+ <xsl:value-of select="substring-before($tmpstr,' ')"/>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="modesubstr2" select="concat($dot2,' ',$dot2distance,' ') "/>
+ <xsl:variable name="dot2n">
+ <xsl:choose>
+ <xsl:when test="string-length($dot2substr) &gt; 3">
+ <xsl:call-template name="substrcount">
+ <xsl:with-param name="str" select="$dot2substr"/>
+ <xsl:with-param name="substr" select="$modesubstr2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>-1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="valDistance">
+ <!--Over all distance is the larger one!-->
+ <xsl:choose>
+ <xsl:when test="$dot2distance &gt; $dot1distance">
+ <xsl:value-of select="$dot2distance"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$dot1distance"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat('dol:',$dot1,';don:',$dot1n,';dist:',$valDistance,';dtl:',$dot2,';dtn:',$dot2n,';eddtn')"/>
+ <!--<xsl:choose>
+ <xsl:when test="$dashstyle='1 1' or $dashstyle='Dots'">
+ <xsl:variable name="do"><xsl:value-of select="'1'"/></xsl:variable>
+ <xsl:variable name="dol"><xsl:value-of select="$do * $cmweight"/></xsl:variable>
+ <xsl:variable name="ds"><xsl:value-of select="'1'"/></xsl:variable>
+ <xsl:variable name="dsl"><xsl:value-of select="$ds * $cmweight"/></xsl:variable>
+ <xsl:variable name="dt"><xsl:value-of select="'-1'"/></xsl:variable>
+ <xsl:variable name="dtl"><xsl:value-of select="'-1'"/></xsl:variable>
+ <xsl:value-of select="concat('dsl:',$dsl,'edsl','do:',$do, 'edo;','do')"/>
+ </xsl:when>
+ </xsl:choose>-->
+ </xsl:template>
+ <xsl:template match="w:pict" mode="style">
+ <xsl:apply-templates mode="style" select="v:*"/>
+ </xsl:template>
+ <xsl:template match="v:*" mode="style">
+ <xsl:variable name="vchild" select="."/>
+ <xsl:variable name="style" select="concat($vchild/@style, ';')"/>
+ <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/>
+ <xsl:variable name="right-name" select="not(name($vchild) = 'v:formulas') and not(name($vchild) = 'v:f') and not(name($vchild) = 'v:shapetype')"/>
+ <xsl:variable name="def" select="string-length($style) &gt; 0 or $vchild/@stroke or $vchild/@stroked or $vchild/@strokecolor or $vchild/v:stroke or $vchild/@strokeweight or $vchild/@wrapcoords or $vchild/@fillcolor"/>
+ <xsl:choose>
+ <xsl:when test="$right-name and ($def or (number($z-index) &lt; 0))">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:variable name="stroke-num">
+ <xsl:if test="$vchild/v:stroke">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:stroke" format="1"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="draw-stroke">
+ <xsl:variable name="dashstyle" select="$vchild/v:stroke/@dashstyle"/>
+ <xsl:choose>
+ <xsl:when test="$vchild/@stroked and $vchild/@stroked='f'">none</xsl:when>
+ <xsl:when test="$dashstyle and not ($dashstyle = 'solid')">
+ <xsl:value-of select="concat('Tdash',$stroke-num)"/>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="style:graphic-properties">
+ <xsl:variable name="style-str" select="concat(@style,';')"/>
+ <xsl:choose>
+ <xsl:when test="number($z-index) &lt; 0 or (name($vchild) = 'v:group' and $vchild/@editas ='canvas' )">
+ <xsl:attribute name="style:wrap">run-through</xsl:attribute>
+ <xsl:attribute name="style:run-through">background</xsl:attribute>
+ <xsl:attribute name="style:flow-with-text">false</xsl:attribute>
+ <xsl:attribute name="fo:border">none</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:wrap">run-through</xsl:attribute>
+ <xsl:attribute name="style:run-through">foreground</xsl:attribute>
+ <xsl:attribute name="style:flow-with-text">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="contains($style-str,'mso-position-horizontal:')">
+ <xsl:attribute name="style:horizontal-pos">
+ <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-horizontal:') , ';')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="v:imagedata or v:textbox">
+ <xsl:attribute name="style:horizontal-pos">from-left</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="parent::w:pict/o:OLEObject">
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:attribute name="draw:visible-area-left">0cm</xsl:attribute>
+ <xsl:attribute name="draw:visible-area-top">0cm</xsl:attribute>
+ <xsl:attribute name="draw:visible-area-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:visible-area-height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:ole-draw-aspect">
+ <!-- DVASPECT_CONTENT = 1,
+ DVASPECT_THUMBNAIL = 2,
+ DVASPECT_ICON = 4,
+ DVASPECT_DOCPRINT = 8 -->
+ <xsl:variable name="ms-aspect" select="parent::w:pict/o:OLEObject/@DrawAspect"/>
+ <xsl:choose>
+ <xsl:when test="$ms-aspect = 'Content'">1</xsl:when>
+ <xsl:when test="$ms-aspect = 'Thumbnail'">2</xsl:when>
+ <xsl:when test="$ms-aspect = 'Icon'">4</xsl:when>
+ <xsl:when test="$ms-aspect = 'Docprint'">8</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="parent::w:pict/o:OLEObject">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">baseline</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains($style-str,'mso-position-vertical:')">
+ <xsl:attribute name="style:vertical-pos">
+ <xsl:value-of select="substring-before( substring-after( $style-str , 'mso-position-vertical:') , ';')"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="v:imagedata or v:textbox">
+ <xsl:attribute name="style:vertical-pos">from-top</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="string-length($draw-stroke) &gt; 0">
+ <!--draw:stroke="dash" draw:stroke-dash="Ohon!Ultrafine dashed" -->
+ <xsl:choose>
+ <xsl:when test="not ($draw-stroke = 'none')">
+ <xsl:attribute name="draw:stroke">
+ <xsl:value-of select="'dash'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:stroke-dash">
+ <xsl:value-of select="$draw-stroke"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:stroke">
+ <xsl:value-of select="'none'"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@startarrow">
+ <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/-->
+ <xsl:attribute name="draw:marker-start">
+ <xsl:value-of select="concat('markerstart',$stroke-num)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:stroke/@endarrow">
+ <!--<v:stroke startarrow="block" startarrowwidth="wide" startarrowlength="long"/-->
+ <xsl:attribute name="draw:marker-end">
+ <xsl:value-of select="concat('markerend',$stroke-num)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@strokeweight">
+ <xsl:attribute name="svg:stroke-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$vchild/@strokeweight"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@strokecolor">
+ <xsl:attribute name="svg:stroke-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="$vchild/@strokecolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/@fillcolor">
+ <xsl:attribute name="draw:fill-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="$vchild/@fillcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not($vchild/@fillcolor)">
+ <xsl:choose>
+ <xsl:when test="ancestor::v:group | v:shadow">
+ <xsl:attribute name="draw:fill-color">#ffffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="not($vchild/v:fill) and not(v:shadow)">
+ <xsl:attribute name="draw:fill">none</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@opacity">
+ <xsl:attribute name="draw:opacity">
+ <xsl:call-template name="convert2percent">
+ <xsl:with-param name="value" select="$vchild/v:fill/@opacity"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@type = 'pattern' or $vchild/v:fill/@type = 'tile' or $vchild/v:fill/@type = 'frame'">
+ <xsl:attribute name="draw:fill">bitmap</xsl:attribute>
+ <xsl:attribute name="draw:fill-image-name">
+ <xsl:value-of select="translate($vchild/v:fill/@src,'&#9;&#10;&#13;&#32;:/.','' ) "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$vchild/v:fill/@type = 'gradient'">
+ <xsl:attribute name="draw:fill">gradient</xsl:attribute>
+ <xsl:attribute name="draw:fill-gradient-name">
+ <xsl:value-of select=" 'gradient' "/>
+ <xsl:apply-templates mode="get-xsl-number" select="$vchild/v:fill"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="style" select="v:shadow"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--Default style which will surely be removed during imported from a .flat file to SO-->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <style:graphic-properties draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" style:wrap="none" draw:fill="none"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="name() = 'v:group'">
+ <xsl:apply-templates mode="style" select="v:*"/>
+ </xsl:if>
+ <xsl:apply-templates mode="style" select="v:textpath"/>
+ </xsl:template>
+ <xsl:template match="v:shadow" mode="style">
+ <!-- v:shadow on="t" color="aqua" opacity=".5" offset="13pt,11pt" offset2="14pt,10pt" -->
+ <xsl:attribute name="draw:shadow">
+ <xsl:choose>
+ <xsl:when test="contains(@on,'f')">hidden</xsl:when>
+ <xsl:otherwise>visible</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="@color"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:if test="string-length(@opacity) &gt;0">
+ <xsl:attribute name="draw:shadow-opacity">
+ <xsl:call-template name="convert2percent">
+ <xsl:with-param name="value" select="@opacity"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="contains(@offset,',')">
+ <xsl:attribute name="draw:shadow-offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(@offset,',')"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-offset-y">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after(@offset,',')"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="draw:shadow-offset-x">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="@offset"/>
+ <xsl:with-param name="TargetMeasure" select=" 'cm' "/>
+ </xsl:call-template>
+ <xsl:value-of select="'cm'"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:shadow-offset-y">0.062cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@type='perspective' and @offset='0,0'">
+ <xsl:message>This kind of shadow does not support yet.</xsl:message>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="convert2percent">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="contains($value,'%')">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="contains($value,'f')">
+ <xsl:variable name="num-value" select="round(substring-before($value,'f') div 6.5536) div 100"/>
+ <xsl:value-of select="concat(100 - $num-value ,'%')"/>
+ </xsl:when>
+ <xsl:when test="string-length($value) = 0">
+ <xsl:value-of select="'1%'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($value * 100 ,'%')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:pict">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:apply-templates>
+ <xsl:with-param name="x-scale" select="$x-scale"/>
+ <xsl:with-param name="y-scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-left" select="$group-left"/>
+ <xsl:with-param name="group-top" select="$group-top"/>
+ <xsl:with-param name="coord-left" select="$coord-left"/>
+ <xsl:with-param name="coord-top" select="$coord-top"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template name="get-middle-substring">
+ <xsl:param name="string"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:if test="contains($string, $prefix)">
+ <xsl:choose>
+ <xsl:when test="contains(substring-after( $string, $prefix), $suffix)">
+ <xsl:value-of select="substring-before(substring-after( $string, $prefix), $suffix)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after( $string, $prefix)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:binData">
+ </xsl:template>
+ <xsl:template match="v:group">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="left">
+ <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/>
+ <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-left"/>
+ <xsl:with-param name="value2" select="$direct-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="top">
+ <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/>
+ <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-top"/>
+ <xsl:with-param name="value2" select="$direct-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:variable name="Current-coord-left">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-before(@coordorigin, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-top">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-after(@coordorigin, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-width">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-before(@coordsize, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-coord-height">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="substring-after(@coordsize, ',' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="string-length($MeasureMark) &gt; 0">
+ <xsl:value-of select="$MeasureMark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="left-value">
+ <xsl:variable name="adjusted-left">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="top-value">
+ <xsl:variable name="adjusted-top">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width-value">
+ <xsl:variable name="adjusted-width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-width"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height-value">
+ <xsl:variable name="adjusted-height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="Target-Measure" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$adjusted-height"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="Current-x-scale" select="( $Current-coord-width div $width-value ) * $x-scale"/>
+ <xsl:variable name="Current-y-scale" select="( $Current-coord-height div $height-value ) * $y-scale"/>
+ <xsl:choose>
+ <xsl:when test="@editas='canvas' ">
+ <!-- frame -->
+ <xsl:variable name="style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="frame-name">frame<xsl:number from="/w:wordDocument/w:body" level="any" count="v:group" format="1"/>
+ </xsl:variable>
+ <draw:frame draw:style-name="{$style-name}" draw:name="{$frame-name}" text:anchor-type="as-char" svg:x="{$left-value}{$Current-MeasureMark}" svg:y="{$top-value}{$Current-MeasureMark}" svg:width="{$width-value}{$Current-MeasureMark}" svg:height="{$height-value}{$Current-MeasureMark}" draw:z-index="0">
+ <draw:text-box>
+ <text:p text:style-name="Drawing">
+ <xsl:apply-templates select="w:r/w:pict | v:*">
+ <xsl:with-param name="x-scale" select="$Current-x-scale"/>
+ <xsl:with-param name="y-scale" select="$Current-y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-left" select="$left-value"/>
+ <xsl:with-param name="group-top" select="$top-value"/>
+ <xsl:with-param name="coord-left" select="$Current-coord-left"/>
+ <xsl:with-param name="coord-top" select="$Current-coord-top"/>
+ </xsl:apply-templates>
+ </text:p>
+ </draw:text-box>
+ </draw:frame>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="draw:g">
+ <xsl:apply-templates select="w:r/w:pict | v:*">
+ <xsl:with-param name="x-scale" select="$Current-x-scale"/>
+ <xsl:with-param name="y-scale" select="$Current-y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$Current-MeasureMark"/>
+ <xsl:with-param name="group-left" select="$left-value"/>
+ <xsl:with-param name="group-top" select="$top-value"/>
+ <xsl:with-param name="coord-left" select="$Current-coord-left"/>
+ <xsl:with-param name="coord-top" select="$Current-coord-top"/>
+ </xsl:apply-templates>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="v:*">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:if test="not (name() = 'v:shapetype' )">
+ <xsl:call-template name="DrawElements">
+ <xsl:with-param name="x-scale" select="$x-scale"/>
+ <xsl:with-param name="y-scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-left" select="$group-left"/>
+ <xsl:with-param name="group-top" select="$group-top"/>
+ <xsl:with-param name="coord-left" select="$coord-left"/>
+ <xsl:with-param name="coord-top" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="DrawElements">
+ <xsl:param name="x-scale" select="1"/>
+ <xsl:param name="y-scale" select="1"/>
+ <xsl:param name="MeasureMark"/>
+ <xsl:param name="group-left" select="0"/>
+ <xsl:param name="group-top" select="0"/>
+ <xsl:param name="coord-left" select="0"/>
+ <xsl:param name="coord-top" select="0"/>
+ <xsl:param name="force-draw" select="'false'"/>
+ <xsl:param name="shape-type"/>
+ <xsl:variable name="wordshapename" select="substring-after(name(),':')"/>
+ <xsl:variable name="custom_shapename">
+ <xsl:if test="$wordshapename='roundrect' ">round-rectangle</xsl:if>
+ <xsl:if test="$wordshapename='shape' and not (v:imagedata) and not (v:textbox) and @type">
+ <xsl:call-template name="ms_word_draw_map2ooo_custom_draw">
+ <xsl:with-param name="ms_word_draw_type" select="@type"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="is-image" select="$wordshapename='shape' and v:imagedata"/>
+ <xsl:variable name="element-name">
+ <xsl:choose>
+ <xsl:when test="$wordshapename='line'">draw:line</xsl:when>
+ <xsl:when test="$wordshapename='rect'">draw:rect</xsl:when>
+ <xsl:when test="$wordshapename='oval'">draw:ellipse</xsl:when>
+ <xsl:when test="$wordshapename='arc'">draw:ellipse</xsl:when>
+ <xsl:when test="$wordshapename='polyline'">draw:polyline</xsl:when>
+ <xsl:when test="$wordshapename='roundrect' ">draw:custom-shape</xsl:when>
+ <xsl:when test="$wordshapename='shape' and v:imagedata">draw:frame</xsl:when>
+ <xsl:when test="$wordshapename='shape' and not (v:imagedata) and @type">
+ <xsl:choose>
+ <xsl:when test="string-length($custom_shapename) &gt; 0">draw:custom-shape</xsl:when>
+ <xsl:when test=" string-length(@type) &gt; 0 and key('shapetype',@type)">draw:custom-shape</xsl:when>
+ <xsl:otherwise>draw:rect</xsl:otherwise>
+ <!--if nothing match it, we prefer rect-->
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$wordshapename='shape' and v:textbox">draw:frame</xsl:when>
+ <!--changed here!-->
+ <xsl:otherwise>draw:path</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="wfill" select="@fill"/>
+ <xsl:variable name="draw-kind">
+ <xsl:if test="$wordshapename='arc' and string-length($wfill) &gt; 0">arc</xsl:if>
+ <!--Means this is a Segment of Circle-->
+ </xsl:variable>
+ <!--Get the position,left,top,width,height,z-index,flip from Style-->
+ <xsl:variable name="style" select="concat(@style, ';')"/>
+ <xsl:variable name="position" select="substring-before(substring-after($style,'position:'),';')"/>
+ <xsl:variable name="direct-left" select="substring-before(substring-after($style,';left:'),';')"/>
+ <xsl:variable name="left">
+ <xsl:variable name="margin-left" select="substring-before( substring-after($style,'margin-left:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-left"/>
+ <xsl:with-param name="value2" select="$direct-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="direct-top" select="substring-before(substring-after($style,';top:'),';')"/>
+ <xsl:variable name="top">
+ <xsl:variable name="margin-top" select="substring-before( substring-after($style,'margin-top:') ,';')"/>
+ <xsl:call-template name="Add-with-Measure">
+ <xsl:with-param name="value1" select="$margin-top"/>
+ <xsl:with-param name="value2" select="$direct-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="width" select="substring-before( substring-after($style,'width:') ,';')"/>
+ <xsl:variable name="height" select="substring-before(substring-after($style,'height:'),';')"/>
+ <xsl:variable name="flip" select="substring-before(substring-after($style,'flip:'),';')"/>
+ <xsl:variable name="z-index" select="substring-before(substring-after($style,'z-index:'),';')"/>
+ <!--these are used for wrap margins get from style-->
+ <xsl:variable name="mso-wrap-distance-lefttmp" select="substring-after($style,'mso-wrap-distance-left:')"/>
+ <xsl:variable name="mso-wrap-distance-left" select="substring-before($mso-wrap-distance-lefttmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-toptmp" select="substring-after($style,'mso-wrap-distance-top:')"/>
+ <xsl:variable name="mso-wrap-distance-top" select="substring-before($mso-wrap-distance-toptmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-righttmp" select="substring-after($style,'mso-wrap-distance-right:')"/>
+ <xsl:variable name="mso-wrap-distance-right" select="substring-before($mso-wrap-distance-righttmp,';')"/>
+ <xsl:variable name="mso-wrap-distance-bottomtmp" select="substring-after($style,'mso-wrap-distance-bottom:')"/>
+ <xsl:variable name="mso-wrap-distance-bottom" select="substring-before($mso-wrap-distance-bottomtmp,';')"/>
+ <xsl:variable name="mso-position-horizontal-relativetmp" select="substring-after($style,'mso-position-horizontal-relative:')"/>
+ <xsl:variable name="mso-position-horizontal-relative" select="substring-before($mso-position-horizontal-relativetmp,';')"/>
+ <xsl:variable name="mso-position-vertical-relativetmp" select="substring-after($style,'mso-position-vertical-relative:')"/>
+ <xsl:variable name="mso-position-vertical-relative" select="substring-before($mso-position-vertical-relativetmp,';')"/>
+ <xsl:variable name="anchor-type">
+ <xsl:choose>
+ <xsl:when test="$mso-position-vertical-relative='page' or $mso-position-horizontal-relative = 'page'">page</xsl:when>
+ <xsl:when test="$position='absolute'">paragraph</xsl:when>
+ <xsl:otherwise>as-char</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="text-style-name">
+ <xsl:choose>
+ <xsl:when test="descendant::v:textbox">P1</xsl:when>
+ <xsl:when test="v:textpath">textpath<xsl:apply-templates mode="get-xsl-number" select="v:textpath"/>
+ </xsl:when>
+ <!--Should get the real style late-->
+ <xsl:otherwise>P1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$element-name}">
+ <xsl:if test="$element-name = 'draw:frame'">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="'frame'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$element-name ='draw:path'">
+ <xsl:choose>
+ <xsl:when test="string-length(@path) = 0">
+ <xsl:attribute name="svg:d">M 0,0 L 0,0</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="svg:d">
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="$element-name ='draw:path' or $wordshapename='polyline'">
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="'0 0'"/>
+ <xsl:value-of select="' '"/>
+ <xsl:if test="string-length(@coordsize) = 0">
+ <xsl:value-of select="'1000 1000'"/>
+ </xsl:if>
+ <xsl:if test="not(string-length(@coordsize) = 0)">
+ <xsl:value-of select="translate(@coordsize,',',' ')"/>
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains($style,'rotation:')">
+ <xsl:attribute name="draw:transform">
+ <xsl:variable name="rotate">
+ <xsl:call-template name="convert2redian">
+ <xsl:with-param name="x" select="substring-before(substring-after($style,'rotation:') , ';')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( 'rotate(' , $rotate * -1 , ')' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:anchor-type">
+ <xsl:value-of select="$anchor-type"/>
+ <!--This need to be checkout and built!-->
+ </xsl:attribute>
+ <xsl:if test="string-length($z-index) &gt; 0">
+ <xsl:if test="number($z-index) &lt; 0">
+ <xsl:attribute name="draw:z-index">
+ <xsl:value-of select="'0'"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(number($z-index) &lt; 0)">
+ <xsl:attribute name="draw:z-index">
+ <xsl:value-of select="$z-index"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:attribute name="draw:style-name">Tgr<xsl:number from="/w:wordDocument/w:body" level="any" count="v:*" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-style-name">
+ <xsl:value-of select="$text-style-name"/>
+ <!--This is difficult!!-->
+ </xsl:attribute>
+ <xsl:if test="$wordshapename='line'">
+ <xsl:variable name="fromx" select="substring-before(@from,',')"/>
+ <xsl:variable name="fromy" select="substring-after(@from,',')"/>
+ <xsl:variable name="tox" select="substring-before(@to,',')"/>
+ <xsl:variable name="toy" select="substring-after(@to,',')"/>
+ <xsl:variable name="valfromx"> </xsl:variable>
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:attribute name="svg:x1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromx"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$tox"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$toy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <xsl:attribute name="svg:x1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromx"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y1">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$toy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$tox"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y2">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$fromy"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$wordshapename='rect' or $wordshapename='oval' or $wordshapename='arc' or $wordshapename='shape' or $wordshapename='polyline' or ($wordshapename='shape' and v:textbox) or ($wordshapename='roundrect' and v:textbox) ">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:attribute name="svg:width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:attribute name="svg:width">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:height">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:x">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="svg:y">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$MeasureMark"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$element-name='draw:ellipse' and string-length($draw-kind) &gt; 0">
+ <xsl:attribute name="draw:kind">
+ <xsl:value-of select="$draw-kind"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--<draw:area-polygon … svg:x="0" svg:y="0" svg:width="2.0cm" svg:height="2.0cm" svg:viewBox="0 0 2000 2000" svg:points="400,1500 1600,1500 1000,400"/>
+ The element shown in the following example defines a triangle that is located in the middle of a 2cm by 2cm image. The bounding box covers an area of 2cm by 1.5cm. One view box unit corresponds to 0.01mm.-->
+ <xsl:if test="$wordshapename='polyline'">
+ <xsl:variable name="MeasureMark_Here" select="'cm'"/>
+ <!--MeasureMarkHere is cm because One view box unit corresponds to 0.01mm-->
+ <xsl:variable name="width_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="height_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="widthval">
+ <xsl:if test="contains($width_cm,'cm')">
+ <xsl:value-of select="round(substring-before($width_cm,'cm')*1000)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="heightval">
+ <xsl:if test="contains($height_cm,'cm')">
+ <xsl:value-of select="round(substring-before($height_cm,'cm')*1000)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="viewBoxstr" select="concat('0 0 ',$widthval,' ',$heightval)"/>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$viewBoxstr"/>
+ </xsl:attribute>
+ <xsl:variable name="inputx_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$left"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="group-value" select="$group-left"/>
+ <xsl:with-param name="coord-value" select="$coord-left"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inputy_cm">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$top"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="group-value" select="$group-top"/>
+ <xsl:with-param name="coord-value" select="$coord-top"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="inputx_val">
+ <xsl:choose>
+ <xsl:when test="contains($inputx_cm,'cm')">
+ <xsl:value-of select="substring-before($inputx_cm,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="inputy_val">
+ <xsl:choose>
+ <xsl:when test="contains($inputy_cm,'cm')">
+ <xsl:value-of select="substring-before($inputy_cm,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="inputboxwidth" select="$widthval"/>
+ <xsl:variable name="oopoints">
+ <xsl:call-template name="wordpoints2oopoints">
+ <xsl:with-param name="input_x" select="$inputx_val"/>
+ <xsl:with-param name="input_y" select="$inputy_val"/>
+ <xsl:with-param name="input_width" select="$width"/>
+ <xsl:with-param name="input_height" select="$height"/>
+ <xsl:with-param name="input_boxwidth" select="$widthval"/>
+ <xsl:with-param name="input_boxheight" select="$heightval"/>
+ <xsl:with-param name="input_points" select="concat(@points,',')"/>
+ <!-- add a space to the end of input_points -->
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="string-length($oopoints) &gt; 0">
+ <xsl:attribute name="draw:points">
+ <xsl:value-of select="$oopoints"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="$is-image">
+ <xsl:variable name="the-image" select="key('imagedata',v:imagedata/@src)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(v:imagedata/@o:title) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="v:imagedata/@o:title"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="string-length(parent::w:pict/o:OLEObject/@ObjectID) &gt; 0">
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="parent::w:pict/o:OLEObject/@ObjectID"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="parent::w:pict/o:OLEObject" mode="output"/>
+ <draw:image>
+ <xsl:element name="office:binary-data">
+ <xsl:value-of select="translate($the-image/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </xsl:element>
+ </draw:image>
+ </xsl:if>
+ <xsl:if test="$element-name = 'draw:custom-shape'">
+ <xsl:apply-templates select="v:textpath" mode="text-p">
+ <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/>
+ </xsl:apply-templates>
+ <xsl:element name="draw:enhanced-geometry">
+ <xsl:variable name="enhanced_path">
+ <!--enhanced_path call a template to get the enhanced-path-->
+ <xsl:choose>
+ <xsl:when test="string-length($custom_shapename) = 0">
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:variable>
+ <!--####notice that:there is some drawing elements that don't have the shapetype so that can not have a viewbox
+ It is a ****problem**** now-so be sure to check it out.-->
+ <xsl:if test="$wordshapename='roundrect' ">
+ <xsl:variable name="tmp_MeasueMark">
+ <xsl:value-of select="'cm'"/>
+ </xsl:variable>
+ <xsl:variable name="svg_viewwidth">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$width"/>
+ <xsl:with-param name="scale" select="$x-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="svg_viewheight">
+ <xsl:if test="$anchor-type='as-char'">
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not ($anchor-type='as-char')">
+ <!--Something has to be down because We have Margin-top options-->
+ <xsl:call-template name="convert-with-scale-and-measure">
+ <xsl:with-param name="value" select="$height"/>
+ <xsl:with-param name="scale" select="$y-scale"/>
+ <xsl:with-param name="MeasureMark" select="$tmp_MeasueMark"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="svg_viewBox">
+ <xsl:value-of select="concat( '0 0 ',substring-before($svg_viewwidth,$tmp_MeasueMark)*10000,' ',substring-before($svg_viewheight,$tmp_MeasueMark)*10000)"/>
+ </xsl:variable>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$svg_viewBox"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($custom_shapename) &gt; 0">
+ <xsl:attribute name="draw:type">
+ <xsl:value-of select="$custom_shapename"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($enhanced_path) &gt; 0">
+ <xsl:attribute name="draw:enhanced-path">
+ <xsl:value-of select="$enhanced_path"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="typeid_adj">
+ <!--for fix the bug of version 1.63: the following discription: adj="-11796480,,5400" in OOo should be: modifier =" -11796480 0 5400"-->
+ <xsl:variable name="tmp_adj">
+ <xsl:value-of select="key('shapetype',@type)/@adj"/>
+ </xsl:variable>
+ <xsl:if test="contains($tmp_adj, ',') ">
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate($tmp_adj,'+-0123456789 ','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_non_omit_adj">
+ <xsl:with-param name="adj_typeid" select="$tmp_adj"/>
+ <xsl:with-param name="num" select="$number"/>
+ <xsl:with-param name="mark" select="',' "/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains($tmp_adj, ',') )">
+ <xsl:value-of select="$tmp_adj"/>
+ </xsl:if>
+ </xsl:variable>
+ <!--the following choose statement code will process the revised modifier
+ It happens that if a drawing elements has more than 2 modifier, the modifier (or say adj
+ in wordml) can be adjusted and only the modified adj is recorded.
+ what makes it more compicated is that adj support both comma and blanks.
+ so you have to use kickblanks template to kick the blanks and change it to comma version.
+ <key('shapetype',@type)/v:textpath[1]-->
+ <xsl:choose>
+ <xsl:when test="string-length($typeid_adj) = 0">
+ <xsl:if test="contains(@adj,',')">
+ <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient.
+ -####Note that comma cann't be recognized by OOo's modifiers
+ <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/>
+ <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/>
+ <xsl:variable name="adjuststr">
+ <xsl:if test="$adjust-x and $adjust-y">
+ -####Note that comma cann't be recognized by OOo's modifiers->
+ <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/>
+ </xsl:if>
+ </xsl:variable>-->
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(@adj ,',' ,' ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@adj and not(contains(@adj,','))">
+ <!--####Note that comma cann't be recognized by OOo's modifiers.-->
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="@adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!--Means that you have to care about 2 adj parameters which is defferent-->
+ <xsl:variable name="mark_used_by_typeid">
+ <xsl:if test="contains($typeid_adj, ',' )">
+ <xsl:value-of select="',' "/>
+ </xsl:if>
+ <xsl:if test="not (contains( $typeid_adj, ',' ) ) ">
+ <xsl:value-of select="' ' "/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@adj">
+ <xsl:variable name="remained_adj">
+ <xsl:if test="contains(@adj,',' ) ">
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate(@adj,'+-0123456789 ','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="$typeid_adj"/>
+ <xsl:with-param name="num" select="$number+1"/>
+ <xsl:with-param name="mark" select="$mark_used_by_typeid"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not (contains(@adj,',' ) ) ">
+ <xsl:variable name="tmp_str_adj">
+ <xsl:call-template name="kickblanks">
+ <xsl:with-param name="str" select="concat(' ' ,@adj,' ')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number">
+ <xsl:value-of select="string-length(translate($tmp_str_adj,'+-0123456789','' ) )"/>
+ </xsl:variable>
+ <xsl:call-template name="get_remained_adj">
+ <xsl:with-param name="adj_typeid" select="$typeid_adj"/>
+ <xsl:with-param name="num" select="$number - 1"/>
+ <xsl:with-param name="mark" select="$mark_used_by_typeid "/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(concat(@adj ,',' ,$remained_adj), ',' ,' ' )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="contains($typeid_adj,',')">
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate($typeid_adj ,',' ,' ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="not(contains($typeid_adj,','))">
+ <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="$typeid_adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@type">
+ <xsl:apply-templates select="v:textpath" mode="output">
+ <xsl:with-param name="type-textpath" select="key('shapetype',@type)/v:textpath[1]"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="key('shapetype',@type)" mode="output">
+ <xsl:with-param name="instance" select="."/>
+ </xsl:apply-templates>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$wordshapename='shape' and v:textbox and $element-name='draw:frame' ">
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:element>
+ </xsl:when>
+ <!--It is a case statement for all shapes,so we add v:roundrect here.-->
+ <xsl:when test="$wordshapename='roundrect' and v:textbox and $element-name='draw:frame' ">
+ <xsl:element name="draw:text-box">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="v:textbox">
+ <xsl:apply-templates select="v:textbox/w:txbxContent/w:p"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:docOleData" mode="init">
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:init')">
+ <oleextracter:init UNOURL="uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="ole:init($oleExtractor, 'uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:apply-templates select="w:binData[@w:name='oledata.mso']" mode="oledata.mso"/>
+ </xsl:template>
+ <xsl:template match="w:docOleData" mode="exit">
+ <oleextracter:exit/>
+ </xsl:template>
+ <xsl:template match="w:binData" mode="oledata.mso">
+ <!-- <xsl:choose>
+ <xsl:when test="element-available('oleextracter:getByName')">
+ <xsl:variable name="tmp" select="oleextracter:insertByName('oledata.mso', translate(text(),'&#10;&#13;&#32;','' ) )"/>
+ </xsl:when>
+ <xsl:otherwise>-->
+ <xsl:variable name="tmp" select="ole:insertByName($oleExtractor,'oledata.mso', translate(text(),'&#10;&#13;&#32;','' ) )"/>
+ <!-- </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:template>
+ <xsl:template match="o:OLEObject " mode="output">
+ <!-- depends on i43230,we can uncomment this code or find another way after i43230 got fixed -->
+ <draw:object-ole>
+ <xsl:element name="office:binary-data">
+ <!--
+ <xsl:choose>
+ <xsl:when test="element-available('oleextracter:getByName')">
+ <xsl:value-of select="translate(oleextracter:getByName(@ObjectID),'&#13;','')"/>
+ </xsl:when>
+ <xsl:otherwise> -->
+ <xsl:value-of select="translate(ole:getByName($oleExtractor,@ObjectID),'&#13;','')"/>
+ <!--
+ </xsl:otherwise>
+ </xsl:choose> -->
+ </xsl:element>
+ </draw:object-ole>
+ </xsl:template>
+ <xsl:template name="get-vml-value">
+ <xsl:param name="node1" select="''"/>
+ <xsl:param name="property-name"/>
+ <xsl:variable name="pn" select="concat(';',$property-name, ':')"/>
+ <xsl:choose>
+ <xsl:when test="string-length(@*[name() = $property-name]) &gt; 0">
+ <xsl:value-of select="@*[name() = $property-name]"/>
+ </xsl:when>
+ <xsl:when test="string-length(@style) &gt; 0 and contains(concat(';',translate(@style,' ','')),$pn)">
+ <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/>
+ </xsl:when>
+ <xsl:when test="$node1 and string-length($node1/@*[name() = $property-name]) &gt; 0">
+ <xsl:value-of select="$node1/@*[name() = $property-name]"/>
+ </xsl:when>
+ <xsl:when test="$node1 and string-length($node1/@style) &gt; 0 and contains(concat(';',translate($node1/@style,' ','')),$pn)">
+ <xsl:value-of select=" substring-before( concat(substring-after(concat(';',translate($node1/@style,' ','')) , $pn),';') , ';') "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="text-p">
+ <xsl:param name="type-textpath" select="''"/>
+ <xsl:variable name="the-string">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'string'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="style-name">
+ <xsl:value-of select="'textpath'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:variable>
+ <text:p text:style-name="{$style-name}">
+ <xsl:value-of select="$the-string"/>
+ </text:p>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="style">
+ <xsl:if test="contains(@style,'font-family:')">
+ <xsl:variable name="style-name">
+ <xsl:value-of select="'textpath'"/>
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="v:textpath" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="font-family">
+ <!-- we need remove the addtional &quot; from font-family -->
+ <xsl:value-of select="translate(substring-before(substring-after(@style,'font-family:'),';'), '&quot;' ,'')"/>
+ </xsl:variable>
+ <xsl:variable name="font-size">
+ <xsl:choose>
+ <xsl:when test="contains(@style,'font-size:')">
+ <xsl:value-of select="substring-before(substring-after(@style,'font-size:'),';')"/>
+ </xsl:when>
+ <xsl:otherwise>36pt</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <style:style style:name="{$style-name}" style:family="paragraph">
+ <style:paragraph-properties text:enable-numbering="false" style:writing-mode="lr-tb"/>
+ <style:text-properties fo:font-family="{$font-family}" fo:font-size="{$font-size}" style:font-family-generic="roman" style:text-scale="80%"/>
+ </style:style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="v:textpath" mode="output">
+ <xsl:param name="type-textpath" select="''"/>
+ <xsl:variable name="on">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'on'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="starts-with($on,'t')">
+ <xsl:attribute name="draw:text-path">true</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="fitshape">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'fitshape'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="fitpath">
+ <xsl:call-template name="get-vml-value">
+ <xsl:with-param name="node1" select="$type-textpath"/>
+ <xsl:with-param name="property-name" select="'fitpath'"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="draw:type">fontwork-plain-text</xsl:attribute>
+ <xsl:attribute name="draw:text-path-mode">
+ <xsl:choose>
+ <xsl:when test="starts-with($fitpath,'t') ">path</xsl:when>
+ <xsl:when test="starts-with($fitshape,'t') ">shape</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-path-scale">path</xsl:attribute>
+ <!-- xsl:attribute name="draw:text-path-same-letter-heights">false</xsl:attribute -->
+ <!-- xsl:attribute name="draw:text-path-scale-x">false</xsl:attribute -->
+ </xsl:template>
+ <xsl:template match="v:shapetype" mode="output">
+ <xsl:param name="instance" select="''"/>
+ <!--#Dummy after version 1.63 The following test is for the adj attribute of the file. It is Dummy now.
+ <xsl:if test="not($instance/@adj)">
+ <xsl:if test="contains(@adj,',')">-->
+ <!--Please Note that the modifier can be more than 2 , so use a translate can be more efficient.
+ -####Note that comma cann't be recognized by OOo's modifiers
+ <xsl:variable name="adjust-x" select="substring-before(@adj,',')"/>
+ <xsl:variable name="adjust-y" select="substring-after(@adj,',')"/>
+ <xsl:variable name="adjuststr">
+ <xsl:if test="$adjust-x and $adjust-y">
+ < -####Note that comma cann't be recognized by OOo's modifiers.->
+ <xsl:value-of select="concat( $adjust-x , ' ' ,$adjust-y )"/>
+ </xsl:if>
+ </xsl:variable>-->
+ <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="translate(@adj, ',' , ' ' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@adj and not(contains(@adj,','))">-->
+ <!--####Note that comma cann't be recognized by OOo's modifiers.-->
+ <!--Dummy after version 1.63 <xsl:attribute name="draw:modifiers">
+ <xsl:value-of select="@adj"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>-->
+ <xsl:variable name="viewbox">
+ <xsl:value-of select="'0 0'"/>
+ <xsl:value-of select="' '"/>
+ <xsl:if test="string-length(@coordsize) = 0">
+ <xsl:value-of select="'1000 1000'"/>
+ </xsl:if>
+ <xsl:if test="not(string-length(@coordsize) = 0)">
+ <xsl:value-of select="translate(@coordsize,',',' ')"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:attribute name="svg:viewBox">
+ <xsl:value-of select="$viewbox"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:text-areas">
+ <xsl:value-of select="$viewbox"/>
+ </xsl:attribute>
+ <!-- This path need be output is instance does not have a path-->
+ <xsl:if test="not($instance/@path) and string-length(@path) &gt;0">
+ <xsl:attribute name="draw:enhanced-path">
+ <!--<xsl:call-template name="vmlpath2svgpath">rrrrrrevised-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="@path"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="v:formulas | v:handles" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:formulas" mode="output">
+ <xsl:apply-templates select="v:f" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:f" mode="output">
+ <xsl:element name="draw:equation">
+ <xsl:attribute name="draw:formula">
+ <xsl:call-template name="v-formula2o-formula">
+ <xsl:with-param name="v-formula" select="@eqn"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="draw:name">
+ <xsl:value-of select="'f'"/>
+ <xsl:variable name="the-number">
+ <xsl:number format="1" level="single"/>
+ </xsl:variable>
+ <xsl:value-of select="$the-number - 1"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="v-formula2o-formula">
+ <xsl:param name="v-formula"/>
+ <xsl:variable name="command" select="substring-before(normalize-space($v-formula), ' ')"/>
+ <xsl:variable name="tmp" select="normalize-space(substring-after($v-formula, $command ))"/>
+ <xsl:variable name="step1">
+ <xsl:choose>
+ <xsl:when test="$command ='val'">
+ <xsl:value-of select="$tmp"/>
+ </xsl:when>
+ <!-- (sum a b c) = (a + b - c)-->
+ <xsl:when test="$command = 'sum' ">
+ <xsl:call-template name="replace-space">
+ <xsl:with-param name="value" select="$tmp"/>
+ <xsl:with-param name="replace1" select="'+'"/>
+ <xsl:with-param name="replace2" select="'-'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- (prod a b c) = (a * b / c)-->
+ <xsl:when test="$command = 'prod'">
+ <xsl:call-template name="replace-space">
+ <xsl:with-param name="value" select="$tmp"/>
+ <xsl:with-param name="replace1" select="'*'"/>
+ <xsl:with-param name="replace2" select="'/'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!-- (mid a b) = ((a + b) / 2)-->
+ <xsl:when test="$command = 'mid'">
+ <xsl:value-of select="concat('(' , translate($tmp,' ', '+') , ') / 2' )"/>
+ </xsl:when>
+ <!-- (if a b c) = (a>0? b : c) Conditional testing. -->
+ <xsl:when test="$command = 'if' ">
+ <xsl:value-of select="concat('if(' , translate($tmp,' ', ',') , ')' )"/>
+ </xsl:when>
+ <!-- (min a b) = (min (a , b) )-->
+ <!-- (max a b) = (max (a , b) )-->
+ <xsl:when test="$command = 'min' or $command = 'max'">
+ <xsl:value-of select="concat($command, '(' , translate($tmp,' ', ',') , ')' )"/>
+ </xsl:when>
+ <xsl:when test="$command = 'abs' or $command = 'sqrt'">
+ <xsl:value-of select="concat($command, '(' , $tmp , ')' )"/>
+ </xsl:when>
+ <!-- sin(a,b) = a*sin(b) -->
+ <xsl:when test="$command = 'sin' or $command = 'cos' or $command = 'tan' ">
+ <!-- atan is not this kind 2 $command = 'atan2' "-->
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( $value1 , ' * ' , $command, '(' , $value2 , ')' )"/>
+ </xsl:when>
+ <!-- -->
+ <xsl:when test="$command = 'atan2' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( $command , '( ' , $value2, ',' , $value1 , ')' )"/>
+ </xsl:when>
+ <!-- -->
+ <!--><xsl:when test="$command = 'atan2' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-after($tmp,' ')"/>
+ <xsl:value-of select="concat( 'atan' , '( ' , $value2, '/' , $value1 , ')' )"/>
+ </xsl:when><- -->
+ <!-- ellipse and sumangle are always used by arc commans like this
+ eqn="ellipse @24 @4 height" ; and eqn="sumangle @2 360 0"
+ mod is always used too.-->
+ <!--mod =sqrt( v*v + P1×P1 + P2×P2). ( 3 parameters )-->
+ <xsl:when test="$command='mod' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( 'sqrt( ' , $value3, ' * ',$value3, ' + ' ,$value2, ' * ' ,$value2, ' + ' ,$value1, ' * ', $value1, ' )' )"/>
+ </xsl:when>
+ <!--ellipse= P2* sqrt(1 - v*v /P1*P1) ( 3 parameters )-->
+ <xsl:when test="$command='ellipse' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value3 , ' * sqrt( ' , $value2 , ' * ' , $value2, ' - ',$value1 , ' * ', $value1, ' )' ,'/',$value2 )"/>
+ </xsl:when>
+ <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )-->
+ <!--<xsl:when test="$command='sumangle' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value1 , '+' , $value2 , ' * ' , '65535',' + ', $value2,' - ' ,$value3 , ' * ', '65535', ' - ', $value3)"/>
+ </xsl:when>-->
+ <!--sumangle =v + P1×2^16 - P2×2^16. ( 3 parameters )-->
+ <xsl:when test="$command='sumangle' ">
+ <xsl:variable name="value1" select="substring-before($tmp,' ')"/>
+ <xsl:variable name="value2" select="substring-before(substring-after($tmp,' '), ' ')"/>
+ <xsl:variable name="value3" select="substring-after(substring-after($tmp,' '), ' ')"/>
+ <xsl:value-of select="concat( $value1 , '+' , $value2 , '*pi/180',' - ' ,$value3 , '*pi/180' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>Find a unsupported formule:<xsl:value-of select="$v-formula"/>
+ </xsl:message>
+ <!--<xsl:value-of select="'0'"/><-for release use-->
+ <xsl:value-of select="concat('not found this:', $v-formula)"/>
+ <!--for Debug use-->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="step2">
+ <xsl:value-of select="translate($step1,'#','$')"/>
+ </xsl:variable>
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="$step2"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="replace-space">
+ <xsl:param name="value"/>
+ <xsl:param name="replace1"/>
+ <xsl:param name="replace2"/>
+ <xsl:value-of select=" concat( substring-before($value,' ') , $replace1, translate(substring-after($value,' '), ' ', $replace2 ) ) "/>
+ </xsl:template>
+ <xsl:template name="replace-at">
+ <xsl:param name="value"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:choose>
+ <xsl:when test="string-length($value) &lt; $position">
+ <xsl:value-of select="$value"/>
+ </xsl:when>
+ <xsl:when test="substring($value,$position,1) = '@'">
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="concat(substring($value,1,$position -1) , '?f' , substring($value,$position+1)) "/>
+ <xsl:with-param name="position" select="$position + 2"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="replace-at">
+ <xsl:with-param name="value" select="$value"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test=" substring($value,$position,1) = '@'">
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="v:handles" mode="output">
+ <xsl:apply-templates select="v:h" mode="output"/>
+ </xsl:template>
+ <xsl:template match="v:h" mode="output">
+ <xsl:element name="draw:handle">
+ <xsl:if test="@position">
+ <xsl:attribute name="draw:handle-position">
+ <xsl:value-of select="translate(@position,'#,' , '$ ')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@switch">
+ <xsl:attribute name="draw:handle-switched">
+ <xsl:value-of select="@switch"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@xrange">
+ <xsl:attribute name="draw:handle-range-x-maximum">
+ <xsl:value-of select="substring-after(@xrange,',')"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:handle-range-x-minimum">
+ <xsl:value-of select="substring-before(@xrange,',')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@yrange">
+ <xsl:attribute name="draw:handle-range-y-maximum">
+ <xsl:value-of select="substring-after(@yrange,',')"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:handle-range-y-minimum">
+ <xsl:value-of select="substring-before(@yrange,',')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!--this template map word's points to svg:viewbox's point they are quite differect because word's use pt but svg's use 0.001cm as a unit-->
+ <xsl:template name="wordpoints2oopoints">
+ <xsl:param name="input_points"/>
+ <xsl:param name="input_x"/>
+ <xsl:param name="input_y"/>
+ <xsl:param name="input_width"/>
+ <xsl:param name="input_height"/>
+ <xsl:param name="input_boxwidth"/>
+ <xsl:param name="input_boxheight"/>
+ <xsl:variable name="ptx" select="substring-before($input_points,',')"/>
+ <xsl:variable name="tempstr" select="substring-after($input_points,',')"/>
+ <xsl:variable name="pty" select="substring-before($tempstr,',')"/>
+ <xsl:variable name="nextinput" select="substring-after ($tempstr,',')"/>
+ <xsl:if test="$ptx and $pty">
+ <xsl:variable name="val_ptx">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$ptx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="val_pty">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="$pty"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="round( $input_boxwidth - ( $val_ptx - $input_x ) * 1000 )"/>
+ <xsl:value-of select="','"/>
+ <xsl:value-of select="round( ( $val_pty - $input_y ) * 1000 )"/>
+ </xsl:if>
+ <xsl:if test="contains($nextinput,',')">
+ <xsl:value-of select="' '"/>
+ <!--Leave a blank first as mark of points group-->
+ <xsl:call-template name="wordpoints2oopoints">
+ <xsl:with-param name="input_points" select="$nextinput"/>
+ <xsl:with-param name="input_x" select="$input_x"/>
+ <xsl:with-param name="input_y" select="$input_y"/>
+ <xsl:with-param name="input_width" select="$input_width"/>
+ <xsl:with-param name="input_height" select="$input_height"/>
+ <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/>
+ <xsl:with-param name="input_boxheight" select="$input_boxheight"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!--template MapConstColor:input is a color in form of const e.g 'red' or number e.g '#ff0010' output is a number color-->
+ <xsl:template name="MapConstColor">
+ <xsl:param name="color"/>
+ <xsl:choose>
+ <xsl:when test="$color='black'">#000000</xsl:when>
+ <xsl:when test="$color='olive'">#808000</xsl:when>
+ <xsl:when test="$color='red'">#ff0000</xsl:when>
+ <xsl:when test="$color='teal'">#008080</xsl:when>
+ <xsl:when test="$color='green'">#00ff00</xsl:when>
+ <xsl:when test="$color='gray'">#808080</xsl:when>
+ <xsl:when test="$color='blue'">#0000ff</xsl:when>
+ <xsl:when test="$color='navy'">#000080</xsl:when>
+ <xsl:when test="$color='white'">#ffffff</xsl:when>
+ <xsl:when test="$color='lime'">#00ff00</xsl:when>
+ <xsl:when test="$color='yellow'">#ffff00</xsl:when>
+ <xsl:when test="$color='fuchsia'">#ff00ff</xsl:when>
+ <xsl:when test="$color='purple'">#800080</xsl:when>
+ <xsl:when test="$color='aqua'">#00ffff</xsl:when>
+ <xsl:when test="$color='maroon'">#800000</xsl:when>
+ <xsl:when test="$color='silver'">#c0c0c0</xsl:when>
+ <xsl:when test="$color='window'">#ffffff</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="string-length($color) =7">
+ <xsl:value-of select="$color"/>
+ </xsl:when>
+ <xsl:when test="string-length($color) =4">
+ <!--short form representation of color-->
+ <xsl:variable name="valr">
+ <xsl:value-of select="concat(substring($color,2,1),substring($color,2,1))"/>
+ <!--<xsl:call-template name="shortcolorconv"><xsl:with-param name="value" select="substring($color,2,1)"/></xsl:call-template>-->
+ </xsl:variable>
+ <xsl:variable name="valg" select="concat(substring($color,3,1),substring($color,3,1))"/>
+ <xsl:variable name="valb" select="concat(substring($color,4,1),substring($color,4,1))"/>
+ <xsl:value-of select="concat('#',$valr,$valg,$valb)"/>
+ </xsl:when>
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="shortcolorconv">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="$value='1'">11</xsl:when>
+ <xsl:when test="$value='2'">22</xsl:when>
+ <xsl:when test="$value='3'">33</xsl:when>
+ <xsl:when test="$value='4'">44</xsl:when>
+ <xsl:when test="$value='5'">55</xsl:when>
+ <xsl:when test="$value='6'">66</xsl:when>
+ <xsl:when test="$value='7'">77</xsl:when>
+ <xsl:when test="$value='8'">88</xsl:when>
+ <xsl:when test="$value='9'">99</xsl:when>
+ <xsl:when test="$value='a'">aa</xsl:when>
+ <xsl:when test="$value='b'">bb</xsl:when>
+ <xsl:when test="$value='c'">cc</xsl:when>
+ <xsl:when test="$value='d'">dd</xsl:when>
+ <xsl:when test="$value='e'">ee</xsl:when>
+ <xsl:when test="$value='f'">ff</xsl:when>
+ <!--I just guess it, maybe it is not right-->
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="MapArrowStyle">
+ <!--What is a block?normal arrow?-->
+ <xsl:param name="arrow-name"/>
+ <xsl:choose>
+ <xsl:when test="$arrow-name = 'Block' ">Arrow</xsl:when>
+ <xsl:when test="$arrow-name = 'Diamond' ">Square</xsl:when>
+ <xsl:when test="$arrow-name = 'Open' ">Line Arrow</xsl:when>
+ <xsl:when test="$arrow-name = 'Oval' ">Circle</xsl:when>
+ <xsl:when test="$arrow-name = 'Diamond' ">Square 45</xsl:when>
+ <xsl:when test="$arrow-name = 'Classic' ">Arrow concave</xsl:when>
+ <xsl:otherwise>Arrow</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="Add-with-Measure">
+ <xsl:param name="value1"/>
+ <xsl:param name="value2"/>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($value1 ,'-.0123456789 ','' )) &gt; 0">
+ <xsl:value-of select="translate($value1 ,'-.0123456789 ','' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($value2 ,'-.0123456789 ','' )"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-value1">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number-value2">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( $number-value1 + $number-value2 , $Current-MeasureMark)"/>
+ </xsl:template>
+ <xsl:template name="convert-with-scale-and-measure">
+ <xsl:param name="value"/>
+ <xsl:param name="group-value" select="0"/>
+ <xsl:param name="coord-value" select="0"/>
+ <xsl:param name="scale" select="1"/>
+ <xsl:param name="MeasureMark" select="''"/>
+ <xsl:param name="Target-Measure" select="''"/>
+ <xsl:variable name="Current-MeasureMark">
+ <xsl:choose>
+ <xsl:when test="not (translate($value ,'-. 0123456789 ','' ) = '') ">
+ <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/>
+ </xsl:when>
+ <xsl:when test="string-length($MeasureMark) &gt; 0">
+ <xsl:value-of select="$MeasureMark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($value ,'-. 0123456789 ','' ) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="number-value">
+ <xsl:call-template name="get-number">
+ <xsl:with-param name="value" select="$value"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="value-string" select="( $number-value - $coord-value) div $scale + $group-value"/>
+ <xsl:choose>
+ <xsl:when test="$value-string = 0">0cm</xsl:when>
+ <xsl:when test="$Target-Measure = $Current-MeasureMark">
+ <xsl:value-of select="concat($value-string , $Current-MeasureMark)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat($value-string , $Current-MeasureMark)"/>
+ </xsl:call-template>
+ <xsl:value-of select=" 'cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number">
+ <xsl:param name="value"/>
+ <xsl:choose>
+ <xsl:when test="translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') = '' ">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number(translate($value,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',''))"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xalan:component prefix="oleextracter" elements="init exit" functions="getByName insertByName">
+ <xalan:script lang="javaclass" src="xalan://XSLTFilterOLEExtracter"/>
+ </xalan:component>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_field.xsl b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl
new file mode 100644
index 000000000000..6c77f63e66a6
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_field.xsl
@@ -0,0 +1,1587 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt fo v">
+ <!--Generally, The MS fields can be represented in two forms, simple field w:fldsimple or complicated field
+ w:fldChar, so when importing we have to take care of two possible forms of the same type field -->
+ <xsl:template match="w:instrText">
+ <!-- ===this template is to process the w:fldChar fields ====== -->
+ <xsl:choose>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'PAGEREF' ">
+ <xsl:variable name="bookmarkname">
+ <xsl:value-of select="normalize-space(substring-before (substring-after( . , 'PAGEREF' ), '\*')) "/>
+ </xsl:variable>
+ <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(.),1,9) = 'HYPERLINK' ">
+ <xsl:variable name="hyper-str" select="normalize-space(.)"/>
+ <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '&quot;')"/>
+ <xsl:variable name="hyper-bookmark">
+ <xsl:if test="contains( $hyper-str, ' \l ')">
+ <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '&quot;'), '&quot;') )"/>
+ </xsl:if>
+ </xsl:variable>
+ <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:a>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(.),1,3) = 'REF' ">
+ <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(text(), 'REF') , '\') )}">
+
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' ">
+ <text:date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,9) = 'PRINTDATE' ">
+ <text:print-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:print-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,10) = 'CREATEDATE' ">
+ <text:creation-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:creation-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'SAVEDATE' ">
+ <text:modification-date>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@')">
+ <xsl:attribute name="style:data-style-name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </text:modification-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'PAGE' ">
+ <text:page-number text:select-page="current">
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMPAGES' ">
+ <text:page-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMWORDS' ">
+ <text:word-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:word-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'NUMCHARS' ">
+ <text:character-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:character-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'REVNUM' ">
+ <text:editing-cycles>
+ <xsl:value-of select="w:r"/>
+ </text:editing-cycles>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,3) = 'SEQ' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:variable name="seq_text_name">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(text(), 'SEQ'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name"/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(text(), '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'AUTHOR' ">
+ <text:initial-creator>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:initial-creator>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,5) = 'TITLE' ">
+ <text:title>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:title>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,7) = 'SUBJECT' ">
+ <text:subject>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:subject>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'KEYWORDS' ">
+ <text:keywords>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:keywords>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,6) = 'FILLIN' ">
+ <text:text-input>
+ <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(text(), 'FILLIN'), '\*')"/></xsl:attribute>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:text-input>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,11) = 'DOCPROPERTY' ">
+ <xsl:variable name="instr_command">
+ <xsl:value-of select="normalize-space (substring-after(text(), 'DOCPROPERTY' ))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($instr_command, 'Author' ) ">
+ <text:user-field-get text:name="Author">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Bytes' ) ">
+ <text:user-field-get text:name="Bytes">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) ">
+ <text:user-field-get text:name="CharactersWithSpaces">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Category' ) ">
+ <text:user-field-get text:name="Category">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Characters' ) ">
+ <text:user-field-get text:name="Characters">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Comments' ) ">
+ <text:user-field-get text:name="Comments">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Company' ) ">
+ <text:user-field-get text:name="Company">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CreateTime' ) ">
+ <text:user-field-get text:name="CreateTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'HyperlinkBase' ) ">
+ <text:user-field-get text:name="HyperlinkBase">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Keywords' ) ">
+ <text:user-field-get text:name="Keywords">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastPrinted' ) ">
+ <text:user-field-get text:name="LastPrinted">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedBy' ) ">
+ <text:user-field-get text:name="LastSavedBy">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedTime' ) ">
+ <text:user-field-get text:name="LastSavedTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Lines' ) ">
+ <text:user-field-get text:name="Lines">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Manager' ) ">
+ <text:user-field-get text:name="Manager">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'NameofApplication' ) ">
+ <text:user-field-get text:name="NameofApplication">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'ODMADocId' ) ">
+ <text:user-field-get text:name="ODMADocId">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Pages' ) ">
+ <text:user-field-get text:name="Pages">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Paragraphs' ) ">
+ <text:user-field-get text:name="Paragraphs">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'RevisionNumber' ) ">
+ <text:user-field-get text:name="RevisionNumber">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Security' ) ">
+ <text:user-field-get text:name="Security">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Subject' ) ">
+ <text:user-field-get text:name="Subject">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Template' ) ">
+ <text:user-field-get text:name="Template">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Title' ) ">
+ <text:user-field-get text:name="Title">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'TotalEditingTime' ) ">
+ <text:user-field-get text:name="TotalEditingTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Words' ) ">
+ <text:user-field-get text:name="Words">
+ </text:user-field-get>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,10) = 'MERGEFIELD' ">
+ <text:database-display text:database-name="" text:table-name="" text:table-type="table">
+ <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:database-display>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,8) = 'MERGEREC' ">
+ <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </text:database-row-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(.),1,4) = 'NEXT' ">
+ <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition="">
+ </text:database-next>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:fldChar">
+ <!-- for complicated field w:fldChar, we only process the w:instrText, please see the template processing w:instrText -->
+ </xsl:template>
+ <xsl:template name="get-fldchar-content">
+ <!-- this template is to get the content of fldchar in-between w:instrText and w:fldChar/@w:fldCharType ='end' -->
+ <xsl:param name="next_node"/>
+ <xsl:param name="sibling_number"/>
+ <xsl:if test="not ($next_node/w:fldChar/@w:fldCharType ='end' ) and $next_node ">
+ <xsl:if test="$next_node/w:br">
+ <xsl:text>&#x0A;</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="$next_node//w:t"/>
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[$sibling_number + 1]"/>
+ <xsl:with-param name="sibling_number" select="$sibling_number + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- ====== this template is to process the w:fldsimple fields ======= -->
+ <xsl:template match="w:fldSimple">
+ <xsl:choose>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'PAGEREF' ">
+ <xsl:variable name="bookmarkname">
+ <xsl:value-of select="normalize-space(substring-before (substring-after( @w:instr , 'PAGEREF' ), '\*')) "/>
+ </xsl:variable>
+ <text:bookmark-ref text:reference-format="page" text:ref-name="{$bookmarkname}">
+ <xsl:value-of select=" .//w:t"/>
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(@w:instr),1,9) = 'HYPERLINK' ">
+ <xsl:variable name="hyper-str" select="normalize-space(@w:instr)"/>
+ <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '&quot;')"/>
+ <xsl:variable name="hyper-bookmark">
+ <xsl:if test="contains( $hyper-str, ' \l ')">
+ <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '&quot;'), '&quot;') )"/>
+ </xsl:if>
+ </xsl:variable>
+ <text:a xlink:type="simple" xlink:href="{concat( $hyper-dest, $hyper-bookmark)}">
+ <xsl:value-of select=" .//w:t"/>
+ </text:a>
+ </xsl:when>
+ <xsl:when test="substring( normalize-space(@w:instr),1,3) = 'REF' ">
+ <text:bookmark-ref text:reference-format="text" text:ref-name="{normalize-space( substring-before (substring-after(@w:instr, 'REF') , '\') )}">
+
+ </text:bookmark-ref>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' ">
+ <text:date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' ">
+ <text:print-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:print-date>
+ </xsl:when>
+ <xsl:when test=" substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' ">
+ <text:creation-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:creation-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' ">
+ <text:modification-date>
+ <xsl:attribute name="style:data-style-name"><xsl:value-of select=" 'NDF1' "/></xsl:attribute>
+ <xsl:value-of select=".//w:t"/>
+ </text:modification-date>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'PAGE' ">
+ <text:page-number text:select-page="current">
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMPAGES' ">
+ <text:page-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:page-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMWORDS' ">
+ <text:word-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:word-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'NUMCHARS' ">
+ <text:character-count>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:character-count>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'REVNUM' ">
+ <text:editing-cycles>
+ <xsl:value-of select="w:r"/>
+ </text:editing-cycles>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'AUTONUM' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMLGL' or substring(normalize-space(@w:instr),1,10) = 'AUTONUMOUT' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">RefAutoNum<xsl:number count="w:instrText[contains(text(), 'AUTONUM') or contains(text(), 'AUTONUMLGL') or contains( text(), 'AUTONUMOUT') ] | w:fldSimple[contains(@w:instr,'AUTONUM') or contains(@w:instr, 'AUTONUMLGL') or contains(@w:instr, 'AUTONUMOUT') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:attribute name="text:name"><xsl:value-of select=" 'AutoNr' "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select=" 'ooow:AutoNr + 1' "/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,3) = 'SEQ' ">
+ <text:sequence>
+ <xsl:attribute name="text:ref-name">Ref<xsl:number count="w:instrText[contains(text(), 'SEQ') ] | w:fldSimple[contains(@w:instr,'SEQ') ] " from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:variable name="seq_text_name">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space(substring-after(@w:instr, 'SEQ'))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_text_name "/></xsl:attribute>
+ <xsl:attribute name="text:formula"><xsl:value-of select="concat (concat('ooow:',$seq_text_name), ' + 1' )"/></xsl:attribute>
+ <xsl:variable name="num-format">
+ <xsl:call-template name="get_field_num_format">
+ <xsl:with-param name="input_MS_num_format" select="normalize-space(substring-after(@w:instr, '\*' ))"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:num-format"><xsl:value-of select="$num-format"/></xsl:attribute>
+ </text:sequence>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'AUTHOR' ">
+ <text:initial-creator>
+ <xsl:value-of select=" .//w:t"/>
+ </text:initial-creator>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,5) = 'TITLE' ">
+ <text:title>
+ <xsl:value-of select=" .//w:t"/>
+ </text:title>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,7) = 'SUBJECT' ">
+ <text:subject>
+ <xsl:value-of select=" .//w:t"/>
+ </text:subject>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'KEYWORDS' ">
+ <text:keywords>
+ <xsl:value-of select=" .//w:t"/>
+ </text:keywords>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,6) = 'FILLIN' ">
+ <text:text-input>
+ <xsl:attribute name="text:description"><xsl:value-of select="substring-before(substring-after(@w:instr, '&quot;'), '&quot;')"/></xsl:attribute>
+ <xsl:value-of select=" .//w:t"/>
+ </text:text-input>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ">
+ <xsl:variable name="instr_command">
+ <xsl:value-of select="normalize-space (substring-after(@w:instr, 'DOCPROPERTY' ))"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($instr_command, 'Author' ) ">
+ <text:user-field-get text:name="Author">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Bytes' ) ">
+ <text:user-field-get text:name="Bytes">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Category' ) ">
+ <text:user-field-get text:name="Category">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CharactersWithSpaces' ) ">
+ <text:user-field-get text:name="CharactersWithSpaces">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Characters' ) ">
+ <text:user-field-get text:name="Characters">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Comments' ) ">
+ <text:user-field-get text:name="Comments">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Company' ) ">
+ <text:user-field-get text:name="Company">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'CreateTime' ) ">
+ <text:user-field-get text:name="CreateTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'HyperlinkBase' ) ">
+ <text:user-field-get text:name="HyperlinkBase">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Keywords' ) ">
+ <text:user-field-get text:name="Keywords">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastPrinted' ) ">
+ <text:user-field-get text:name="LastPrinted">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedBy' ) ">
+ <text:user-field-get text:name="LastSavedBy">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'LastSavedTime' ) ">
+ <text:user-field-get text:name="LastSavedTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Lines' ) ">
+ <text:user-field-get text:name="Lines">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Manager' ) ">
+ <text:user-field-get text:name="Manager">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'NameofApplication' ) ">
+ <text:user-field-get text:name="NameofApplication">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'ODMADocId' ) ">
+ <text:user-field-get text:name="ODMADocId">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Pages' ) ">
+ <text:user-field-get text:name="Pages">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Paragraphs' ) ">
+ <text:user-field-get text:name="Paragraphs">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'RevisionNumber' ) ">
+ <text:user-field-get text:name="RevisionNumber">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Security' ) ">
+ <text:user-field-get text:name="Security">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Subject' ) ">
+ <text:user-field-get text:name="Subject">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Template' ) ">
+ <text:user-field-get text:name="Template">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Title' ) ">
+ <text:user-field-get text:name="Title">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'TotalEditingTime' ) ">
+ <text:user-field-get text:name="TotalEditingTime">
+ </text:user-field-get>
+ </xsl:when>
+ <xsl:when test="contains($instr_command, 'Words' ) ">
+ <text:user-field-get text:name="Words">
+ </text:user-field-get>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,10) = 'MERGEFIELD' ">
+ <text:database-display text:database-name="" text:table-name="" text:table-type="table">
+ <xsl:attribute name="text:column-name"><xsl:value-of select="substring-before(substring-after(normalize-space(.), 'MERGEFIELD' ), ' ' ) "/></xsl:attribute>
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-display>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,8) = 'MERGEREC' ">
+ <text:database-row-number text:database-name="" text:table-name="" text:table-type="table" style:num-format="A" text:value="0">
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-row-number>
+ </xsl:when>
+ <xsl:when test="substring(normalize-space(@w:instr),1,4) = 'NEXT' ">
+ <text:database-next text:database-name="" text:table-name="" text:table-type="table" text:condition="">
+ <xsl:value-of select=" .//w:t"/>
+ </text:database-next>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- for MS simple fields that can not map to OOo writer fields, we just import the content of these fields -->
+ <xsl:value-of select="w:r"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get_seq_name">
+ <!-- this template is to get the identifier from the input MS seq string -->
+ <xsl:param name="input_seq_string"/>
+ <xsl:choose>
+ <xsl:when test="contains( $input_seq_string, ' ' )">
+ <xsl:value-of select="substring-before($input_seq_string, ' ' )"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$input_seq_string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="default_seqence_declaration">
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing">
+ </text:sequence-decl>
+ <text:sequence-decl text:display-outline-level="0" text:name="AutoNr">
+ </text:sequence-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="sequence_declare">
+ <text:sequence-decl text:display-outline-level="0">
+ <xsl:variable name="seq_variable_name">
+ <xsl:choose>
+ <xsl:when test=" name() = 'w:instrText' ">
+ <xsl:if test="substring(normalize-space(text()),1,3) = 'SEQ' ">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(text(), 'SEQ' ))"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test=" name() = 'w:fldSimple' ">
+ <xsl:if test="substring(normalize-space(@w:instr),1,3) = 'SEQ' ">
+ <xsl:call-template name="get_seq_name">
+ <xsl:with-param name="input_seq_string" select="normalize-space( substring-after(@w:instr, 'SEQ' ))"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:name"><xsl:value-of select="$seq_variable_name"/></xsl:attribute>
+ </text:sequence-decl>
+ </xsl:template>
+ <!-- ===== the following templates are to generate the user fields declarations for MS word DocProperty field importing == -->
+ <xsl:template name="user_fields_declare_docproperty">
+ <xsl:variable name="document-field-root" select="/w:wordDocument/w:body//w:instrText[substring(normalize-space(text()),1,11) = 'DOCPROPERTY' ] | /w:wordDocument/w:body//w:fldSimple[substring(normalize-space(@w:instr),1,11) = 'DOCPROPERTY' ] "/>
+ <xsl:variable name="field_Author_nodeset" select="$document-field-root[contains(text(), 'Author')] | $document-field-root[contains(@w:instr, 'Author')]"/>
+ <xsl:variable name="field_Bytes_nodeset" select="$document-field-root[contains(text(), 'Bytes')] | $document-field-root[contains(@w:instr, 'Bytes')]"/>
+ <xsl:variable name="field_Category_nodeset" select="$document-field-root[contains(text(), 'Category')] | $document-field-root[contains(@w:instr, 'Category')]"/>
+ <xsl:variable name="field_Characters_nodeset" select="$document-field-root[contains(text(), 'Characters')] | $document-field-root[contains(@w:instr, 'Characters')]"/>
+ <xsl:variable name="field_CharactersWithSpaces_nodeset" select="$document-field-root[contains(text(), 'CharactersWithSpaces')] | $document-field-root[contains(@w:instr, 'CharactersWithSpaces')]"/>
+ <xsl:variable name="field_Comments_nodeset" select="$document-field-root[contains(text(), 'Comments')] | $document-field-root[contains(@w:instr, 'Comments')]"/>
+ <xsl:variable name="field_Company_nodeset" select="$document-field-root[contains(text(), 'Company')] | $document-field-root[contains(@w:instr, 'Company')]"/>
+ <xsl:variable name="field_CreateTime_nodeset" select="$document-field-root[contains(text(), 'CreateTime')] | $document-field-root[contains(@w:instr, 'CreateTime')]"/>
+ <xsl:variable name="field_HyperlinkBase_nodeset" select="$document-field-root[contains(text(), 'HyperlinkBase')] | $document-field-root[contains(@w:instr, 'HyperlinkBase')]"/>
+ <xsl:variable name="field_Keywords_nodeset" select="$document-field-root[contains(text(), 'Keywords')] | $document-field-root[contains(@w:instr, 'Keywords')]"/>
+ <xsl:variable name="field_LastPrinted_nodeset" select="$document-field-root[contains(text(), 'LastPrinted')] | $document-field-root[contains(@w:instr, 'LastPrinted')]"/>
+ <xsl:variable name="field_LastSavedBy_nodeset" select="$document-field-root[contains(text(), 'LastSavedBy')] | $document-field-root[contains(@w:instr, 'LastSavedBy')]"/>
+ <xsl:variable name="field_LastSavedTime_nodeset" select="$document-field-root[contains(text(), 'LastSavedTime')] | $document-field-root[contains(@w:instr, 'LastSavedTime')]"/>
+ <xsl:variable name="field_Lines_nodeset" select="$document-field-root[contains(text(), 'Lines')] | $document-field-root[contains(@w:instr, 'Lines')]"/>
+ <xsl:variable name="field_Manager_nodeset" select="$document-field-root[contains(text(), 'Manager')] | $document-field-root[contains(@w:instr, 'Manager')]"/>
+ <xsl:variable name="field_NameofApplication_nodeset" select="$document-field-root[contains(text(), 'NameofApplication')] | $document-field-root[contains(@w:instr, 'NameofApplication')]"/>
+ <xsl:variable name="field_ODMADocId_nodeset" select="$document-field-root[contains(text(), 'ODMADocId')] | $document-field-root[contains(@w:instr, 'ODMADocId')]"/>
+ <xsl:variable name="field_Pages_nodeset" select="$document-field-root[contains(text(), 'Pages')] | $document-field-root[contains(@w:instr, 'Pages')]"/>
+ <xsl:variable name="field_Paragraphs_nodeset" select="$document-field-root[contains(text(), 'Paragraphs')] | $document-field-root[contains(@w:instr, 'Paragraphs')]"/>
+ <xsl:variable name="field_RevisionNumber_nodeset" select="$document-field-root[contains(text(), 'RevisionNumber')] | $document-field-root[contains(@w:instr, 'RevisionNumber')]"/>
+ <xsl:variable name="field_Security_nodeset" select="$document-field-root[contains(text(), 'Security')] | $document-field-root[contains(@w:instr, 'Security')]"/>
+ <xsl:variable name="field_Subject_nodeset" select="$document-field-root[contains(text(), 'Subject')] | $document-field-root[contains(@w:instr, 'Subject')]"/>
+ <xsl:variable name="field_Template_nodeset" select="$document-field-root[contains(text(), 'Template')] | $document-field-root[contains(@w:instr, 'Template')]"/>
+ <xsl:variable name="field_Title_nodeset" select="$document-field-root[contains(text(), 'Title')] | $document-field-root[contains(@w:instr, 'Title')]"/>
+ <xsl:variable name="field_TotalEditingTime_nodeset" select="$document-field-root[contains(text(), 'TotalEditingTime')] | $document-field-root[contains(@w:instr, 'TotalEditingTime')]"/>
+ <xsl:variable name="field_Words_nodeset" select="$document-field-root[contains(text(), 'Words')] | $document-field-root[contains(@w:instr, 'Words')]"/>
+ <xsl:apply-templates select="$field_Author_nodeset[1]" mode="user_field_Author_declare"/>
+ <xsl:apply-templates select="$field_Bytes_nodeset[1]" mode="user_field_Bytes_declare"/>
+ <xsl:apply-templates select="$field_Category_nodeset[1]" mode="user_field_Category_declare"/>
+ <xsl:apply-templates select="$field_Characters_nodeset[1]" mode="user_field_Characters_declare"/>
+ <xsl:apply-templates select="$field_CharactersWithSpaces_nodeset[1]" mode="user_field_CharactersWithSpaces_declare"/>
+ <xsl:apply-templates select="$field_Comments_nodeset[1]" mode="user_field_Comments_declare"/>
+ <xsl:apply-templates select="$field_Company_nodeset[1]" mode="user_field_Company_declare"/>
+ <xsl:apply-templates select="$field_CreateTime_nodeset[1]" mode="user_field_CreateTime_declare"/>
+ <xsl:apply-templates select="$field_HyperlinkBase_nodeset[1]" mode="user_field_HyperlinkBase_declare"/>
+ <xsl:apply-templates select="$field_Keywords_nodeset[1]" mode="user_field_Keywords_declare"/>
+ <xsl:apply-templates select="$field_LastPrinted_nodeset[1]" mode="user_field_LastPrinted_declare"/>
+ <xsl:apply-templates select="$field_LastSavedBy_nodeset[1]" mode="user_field_LastSavedBy_declare"/>
+ <xsl:apply-templates select="$field_LastSavedTime_nodeset[1]" mode="user_field_LastSavedTime_declare"/>
+ <xsl:apply-templates select="$field_Lines_nodeset[1]" mode="user_field_Lines_declare"/>
+ <xsl:apply-templates select="$field_Manager_nodeset[1]" mode="user_field_Manager_declare"/>
+ <xsl:apply-templates select="$field_NameofApplication_nodeset[1]" mode="user_field_NameofApplication_declare"/>
+ <xsl:apply-templates select="$field_ODMADocId_nodeset[1]" mode="user_field_ODMADocId_declare"/>
+ <xsl:apply-templates select="$field_Pages_nodeset[1]" mode="user_field_Pages_declare"/>
+ <xsl:apply-templates select="$field_Paragraphs_nodeset[1]" mode="user_field_Paragraphs_declare"/>
+ <xsl:apply-templates select="$field_RevisionNumber_nodeset[1]" mode="user_field_RevisionNumber_declare"/>
+ <xsl:apply-templates select="$field_Security_nodeset[1]" mode="user_field_Security_declare"/>
+ <xsl:apply-templates select="$field_Subject_nodeset[1]" mode="user_field_Subject_declare"/>
+ <xsl:apply-templates select="$field_Template_nodeset[1]" mode="user_field_Template_declare"/>
+ <xsl:apply-templates select="$field_Title_nodeset[1]" mode="user_field_Title_declare"/>
+ <xsl:apply-templates select="$field_TotalEditingTime_nodeset[1]" mode="user_field_TotalEditingTime_declare"/>
+ <xsl:apply-templates select="$field_Words_nodeset[1]" mode="user_field_Words_declare"/>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Author_declare">
+ <text:user-field-decl office:value-type="string" text:name="Author">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Bytes_declare">
+ <text:user-field-decl office:value-type="string" text:name="Bytes">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Category_declare">
+ <text:user-field-decl office:value-type="string" text:name="Category">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Characters_declare">
+ <text:user-field-decl office:value-type="string" text:name="Characters">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CharactersWithSpaces_declare">
+ <text:user-field-decl office:value-type="string" text:name="CharactersWithSpaces">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Comments_declare">
+ <text:user-field-decl office:value-type="string" text:name="Comments">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Company_declare">
+ <text:user-field-decl office:value-type="string" text:name="Company">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_CreateTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="CreateTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_HyperlinkBase_declare">
+ <text:user-field-decl office:value-type="string" text:name="HyperlinkBase">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Keywords_declare">
+ <text:user-field-decl office:value-type="string" text:name="Keywords">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastPrinted_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastPrinted">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedBy_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastSavedBy">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_LastSavedTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="LastSavedTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Lines_declare">
+ <text:user-field-decl office:value-type="string" text:name="Lines">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Manager_declare">
+ <text:user-field-decl office:value-type="string" text:name="Manager">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_NameofApplication_declare">
+ <text:user-field-decl office:value-type="string" text:name="NameofApplication">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_ODMADocId_declare">
+ <text:user-field-decl office:value-type="string" text:name="ODMADocId">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Pages_declare">
+ <text:user-field-decl office:value-type="string" text:name="Pages">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Paragraphs_declare">
+ <text:user-field-decl office:value-type="string" text:name="Paragraphs">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_RevisionNumber_declare">
+ <text:user-field-decl office:value-type="string" text:name="RevisionNumber">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Security_declare">
+ <text:user-field-decl office:value-type="string" text:name="Security">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Subject_declare">
+ <text:user-field-decl office:value-type="string" text:name="Subject">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Template_declare">
+ <text:user-field-decl office:value-type="string" text:name="Template">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Title_declare">
+ <text:user-field-decl office:value-type="string" text:name="Title">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_TotalEditingTime_declare">
+ <text:user-field-decl office:value-type="string" text:name="TotalEditingTime">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="user_field_Words_declare">
+ <text:user-field-decl office:value-type="string" text:name="Words">
+ <xsl:variable name="field_content">
+ <xsl:choose>
+ <xsl:when test="name() = 'w:instrText' ">
+ <xsl:call-template name="get-fldchar-content">
+ <xsl:with-param name="next_node" select="../following-sibling::w:r[1]"/>
+ <xsl:with-param name="sibling_number" select=" 1"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:value-of select=".//w:t"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="office:string-value"><xsl:value-of select="$field_content"/></xsl:attribute>
+ </text:user-field-decl>
+ </xsl:template>
+ <!-- =========this following template to convert the ms number format to OOo wirter format === -->
+ <xsl:template name="get_field_num_format">
+ <xsl:param name="input_MS_num_format"/>
+ <xsl:choose>
+ <xsl:when test="contains($input_MS_num_format, 'Arabic' ) ">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'roman' ) ">
+ <xsl:text>i</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) ">
+ <xsl:text>I</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) ">
+ <xsl:text>a</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) ">
+ <xsl:text>A</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--xsl:template name="get_field_num_format">
+ <xsl:param name="input_MS_num_format"/>
+ <xsl:choose>
+ <xsl:when test="contains($input_MS_num_format, 'Arabic' ) ">
+ <xsl:text>1</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains ($input_MS_num_format, 'CircleNum' )">
+ <xsl:text>①, ②, ③, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'roman' ) ">
+ <xsl:text>i</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ROMAN' ) ">
+ <xsl:text>I</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'CHINESENUM3' )">
+ <xsl:text>一, 二, 三, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'CHINESENUM2' )">
+ <xsl:text>壹, 貳, 參, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'DBNUM3' ) ">
+ <xsl:text>壱, 弐, 参, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ZODIAC2' ) ">
+ <xsl:text>子, 丑, 寅, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ZODIAC1' ) ">
+ <xsl:text>甲, 乙, 丙, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Iroha' ) ">
+ <xsl:text>イ, ロ, ハ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) ">
+ <xsl:text>ア, イ, ウ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'alphabetic' ) ">
+ <xsl:text>a</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ALPHABETIC' ) ">
+ <xsl:text>A</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'hebrew2' ) ">
+ <xsl:text>א, ב, ג, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ArabicAlpha' ) ">
+ <xsl:text>أ, ب, ت, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'ThaiLetter' ) ">
+ <xsl:text>ก, ข, ฃ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Chosung' ) ">
+ <xsl:text>ㄱ, ㄴ, ㄷ, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Ganada' ) ">
+ <xsl:text>가, 나, 다, ...</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($input_MS_num_format, 'Aiueo' ) ">
+ <xsl:text>ア, イ, ウ, ...</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>1</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+ <!-- ========= the following code is to generate the date styles for date/time fields ============ -->
+ <!--the default date styel content -->
+ <xsl:template name="default_date_style_content">
+ <number:year number:style="long">
+ </number:year>
+ <number:text>/</number:text>
+ <number:month>
+ </number:month>
+ <number:text>/</number:text>
+ <number:day>
+ </number:day>
+ <number:text> </number:text>
+ <number:hours>
+ </number:hours>
+ <number:text>:</number:text>
+ <number:minutes number:style="long">
+ </number:minutes>
+ <number:text>:</number:text>
+ <number:seconds number:style="long">
+ </number:seconds>
+ <number:am-pm>
+ </number:am-pm>
+ </xsl:template>
+ <!--the default date styel -->
+ <xsl:template name="default_date_style">
+ <number:date-style style:name="NDF1">
+ <xsl:call-template name="default_date_style_content"/>
+ </number:date-style>
+ </xsl:template>
+ <xsl:template match="w:instrText | w:fldSimple" mode="style">
+ <!-- this template is to generate the date, time styles according to the content of DateFormatString ( the string after \@ ) in w:instrText | w:fldSimple/@w:instr -->
+ <xsl:choose>
+ <xsl:when test=" name() = 'w:instrText' ">
+ <xsl:if test="substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' ">
+ <number:date-style>
+ <xsl:attribute name="style:name">ND<xsl:number count="w:instrText | w:fldSimple" from="/w:wordDocument/w:body" level="any" format="1"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="contains(text(), '\@' )">
+ <!-- if has the date format string then call the template parse_field_date_format to produce the style-->
+ <xsl:variable name="MS_date_format">
+ <xsl:value-of select="normalize-space(substring-before(substring-after(normalize-space(substring-after(text(), '\@')), '&#x22;'), '&#x22;'))"/>
+ </xsl:variable>
+ <xsl:if test="string-length($MS_date_format) &gt;=1">
+ <xsl:call-template name="parse_field_date_format">
+ <xsl:with-param name="input_MS_date_format" select="$MS_date_format"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="string-length($MS_date_format) &lt;1">
+ <xsl:call-template name="default_date_style_content"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if doesn't have date format string so we use the following default format -->
+ <xsl:call-template name="default_date_style_content"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </number:date-style>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="name() = 'w:fldSimple' ">
+ <xsl:if test="substring(normalize-space(@w:instr),1,4) = 'DATE' or substring(normalize-space(@w:instr),1,4) = 'TIME' or substring(normalize-space(@w:instr),1,9) = 'PRINTDATE' or substring(normalize-space(@w:instr),1,10) = 'CREATEDATE' or substring(normalize-space(@w:instr),1,8) = 'SAVEDATE' ">
+ <!-- we use the default date/time style for w:fldsimple -->
+ <number:date-style>
+ <xsl:attribute name="style:name">NDF1</xsl:attribute>
+ <xsl:call-template name="default_date_style_content"/>
+ </number:date-style>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="parse_field_date_format">
+ <!--this template is to parse and generate the content of the date-time style base on the content of input_MS_date_format -->
+ <xsl:param name="input_MS_date_format"/>
+ <xsl:if test="string-length($input_MS_date_format) &gt;= 1">
+ <xsl:variable name="date_token_start_position">
+ <!-- to find the start position of the token ' d, M, yy, YY,m etc. -->
+ <xsl:call-template name="find_token_startposition">
+ <xsl:with-param name="input_string" select="$input_MS_date_format"/>
+ <xsl:with-param name="token_start_position" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="date_token">
+ <!-- get the matched the token such as MM, YYYY, yy,MMMM etc. -->
+ <xsl:call-template name="get_date_token">
+ <xsl:with-param name="input_string2" select="substring($input_MS_date_format,$date_token_start_position)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($date_token_start_position) &gt; 1">
+ <!-- print the text between the tokens -->
+ <number:text>
+ <xsl:value-of select="substring($input_MS_date_format,1, number($date_token_start_position - 1) )"/>
+ </number:text>
+ </xsl:if>
+ <xsl:call-template name="map_date_format_pattern">
+ <xsl:with-param name="input_date_format_pattern" select="$date_token"/>
+ </xsl:call-template>
+ <xsl:variable name="unparsed_string">
+ <xsl:value-of select="substring($input_MS_date_format,$date_token_start_position + string-length($date_token))"/>
+ </xsl:variable>
+ <xsl:call-template name="parse_field_date_format">
+ <xsl:with-param name="input_MS_date_format" select="$unparsed_string"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="find_token_startposition">
+ <xsl:param name="input_string"/>
+ <xsl:param name="token_start_position"/>
+ <xsl:choose>
+ <xsl:when test="starts-with( $input_string,'yy') or starts-with($input_string,'YY') or starts-with($input_string,'HH') or starts-with($input_string,'hh') or starts-with($input_string,'ss') or starts-with($input_string,'SS')">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string, 'M') or starts-with($input_string,'d') or starts-with($input_string, 'm') or starts-with($input_string,'D') or starts-with($input_string,'h') or starts-with($input_string,'H') or starts-with($input_string,'s') or starts-with($input_string,'S')">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string, 'am/pm') or starts-with($input_string, 'AM/PM') ">
+ <xsl:value-of select="$token_start_position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new_string">
+ <xsl:value-of select="substring($input_string, 2)"/>
+ </xsl:variable>
+ <xsl:call-template name="find_token_startposition">
+ <xsl:with-param name="input_string" select="$new_string"/>
+ <xsl:with-param name="token_start_position" select="$token_start_position +1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get_date_token">
+ <xsl:param name="input_string2"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($input_string2, 'am/pm') or starts-with($input_string2, 'AM/PM') ">
+ <xsl:value-of select=" 'am/pm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'yyyy') or starts-with($input_string2, 'YYYY')">
+ <xsl:value-of select=" 'yyyy' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'yy') or starts-with($input_string2, 'YY')">
+ <xsl:value-of select=" 'yy' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MMMM') ">
+ <xsl:value-of select=" 'MMMM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MMM')">
+ <xsl:value-of select=" 'MMM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'MM')">
+ <xsl:value-of select=" 'MM' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'M') ">
+ <xsl:value-of select=" 'M' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'dddd') or starts-with($input_string2, 'DDDD')">
+ <xsl:value-of select=" 'dddd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'ddd') or starts-with($input_string2, 'DDD')">
+ <xsl:value-of select=" 'ddd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'dd') or starts-with($input_string2, 'dd')">
+ <xsl:value-of select=" 'dd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'd') or starts-with($input_string2, 'D')">
+ <xsl:value-of select=" 'd' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'mm')">
+ <xsl:value-of select=" 'mm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'm')">
+ <xsl:value-of select=" 'm' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'hh') or starts-with($input_string2, 'HH')">
+ <xsl:value-of select=" 'hh' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'h') or starts-with($input_string2, 'H')">
+ <xsl:value-of select=" 'h' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 'ss') or starts-with($input_string2, 'SS')">
+ <xsl:value-of select=" 'ss' "/>
+ </xsl:when>
+ <xsl:when test="starts-with($input_string2, 's') or starts-with($input_string2, 'S')">
+ <xsl:value-of select=" 's' "/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="map_date_format_pattern">
+ <!-- this template map the MS date time format to OOo date time format -->
+ <xsl:param name="input_date_format_pattern"/>
+ <xsl:choose>
+ <xsl:when test="$input_date_format_pattern = 'am/pm' ">
+ <number:am-pm>
+ </number:am-pm>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'yyyy' ">
+ <number:year number:style="long">
+ </number:year>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'yy' ">
+ <number:year>
+ </number:year>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MMMM' ">
+ <number:month number:style="long" number:textual="true">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MMM' ">
+ <number:month number:textual="true">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'MM' ">
+ <number:month number:style="long">
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'M' ">
+ <number:month>
+ </number:month>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'dddd' ">
+ <number:day-of-week number:style="long">
+ </number:day-of-week>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'ddd' ">
+ <number:day-of-week>
+ </number:day-of-week>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'dd' ">
+ <number:day number:style="long">
+ </number:day>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'd' ">
+ <number:day>
+ </number:day>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'mm' ">
+ <number:minutes number:style="long">
+ </number:minutes>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'm' ">
+ <number:minutes>
+ </number:minutes>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'hh' ">
+ <number:hours number:style="long">
+ </number:hours>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'h' ">
+ <number:hours>
+ </number:hours>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 'ss' ">
+ <number:seconds number:style="long">
+ </number:seconds>
+ </xsl:when>
+ <xsl:when test="$input_date_format_pattern = 's' ">
+ <number:seconds>
+ </number:seconds>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_list.xsl b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl
new file mode 100644
index 000000000000..8bbe57a5e3ec
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_list.xsl
@@ -0,0 +1,657 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:listPr" mode="style">
+ <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+ <xsl:variable name="currlist" select="."/>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+ <xsl:if test="not(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[1]/w:ilfo/@w:val= $currlistid) and $rootlist/w:lvl ">
+ <xsl:element name="text:list-style">
+ <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="$rootlist/w:lvl"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:lvl">
+ <xsl:variable name="listtype">
+ <xsl:choose>
+ <xsl:when test="w:nfc/@w:val">
+ <xsl:value-of select="w:nfc/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$listtype =23 and w:lvlPicBulletId">
+ <!-- image characters. wym -->
+ <xsl:element name="text:list-level-style-image">
+ <xsl:call-template name="list-styles-image"/>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="$listtype =23">
+ <!-- nfcBullet: Bullet character. glu -->
+ <xsl:element name="text:list-level-style-bullet">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype" select="$listtype"/>
+ <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- all kinds of numbering characters. glu :( -->
+ <xsl:element name="text:list-level-style-number">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype" select="$listtype"/>
+ <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="list-styles-common">
+ <xsl:param name="listtype"/>
+ <xsl:param name="currlevel"/>
+ <xsl:variable name="startval" select="w:start/@w:val"/>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$currlevel"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$listtype = 23">
+ <!-- bullet character. glu -->
+ <xsl:attribute name="text:style-name">Bullet_20_Symbols</xsl:attribute>
+ <xsl:if test="not (contains(w:lvlText/@w:val,'%'))">
+ <xsl:attribute name="text:bullet-char">
+ <xsl:value-of select="w:lvlText/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="contains(w:lvlText/@w:val,'%')">
+ <xsl:attribute name="text:bullet-char">
+ <xsl:value-of select=" '·' "/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="($listtype &gt;= 0) and ($listtype &lt; 60)">
+ <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
+ <xsl:if test="$startval">
+ <xsl:choose>
+ <xsl:when test="$startval &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="$startval"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:attribute name="text:display-levels">
+ <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
+ </xsl:attribute>
+ <xsl:call-template name="nfc2numformat">
+ <xsl:with-param name="nfcvalue" select="$listtype"/>
+ <xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/>
+ <xsl:with-param name="suffix" select="substring-after(w:lvlText/@w:val, concat('%', $currlevel) )"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">Numbering_20_Symbols</xsl:attribute>
+ <xsl:if test="$startval">
+ <xsl:choose>
+ <xsl:when test="$startval &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="$startval"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:attribute name="text:display-levels">
+ <xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') ) + 1"/>
+ </xsl:attribute>
+ <!-- 'none' in Word 2003. wym -->
+ <xsl:attribute name="style:num-format"/>
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:element name="style:list-level-properties">
+ <xsl:choose>
+ <xsl:when test="w:lvlJc/@w:val='right'">
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:lvlJc/@w:val='center'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="labelwidth">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:ind/@w:hanging">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:ind/@w:first-line">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftwidth">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="w:pPr/w:ind/@w:left">
+ <xsl:attribute name="text:space-before">
+ <xsl:choose>
+ <xsl:when test=" ( number($leftwidth)-number($labelwidth) ) &gt; 0">
+ <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" '0cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="text:min-label-width">
+ <xsl:choose>
+ <xsl:when test="$labelwidth &gt; 0">
+ <xsl:value-of select="concat($labelwidth,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <!-- In binary word translation, text:min-label-distance do not generate. So, the width of number-symbol will not effect the start position of text. But first line always start same position of second line, no indent. If text:min-label-distance generate, the look of list will change because of uncountable number-symbol's width, now use 0.25cm as default width-->
+ <xsl:choose>
+ <xsl:when test="w:suff/@w:val='Space'">
+ <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+ <xsl:variable name="tabpos">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+ <xsl:variable name="min-label-distance">
+ <xsl:choose>
+ <xsl:when test="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25 &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number($tabpos)+number($labelwidth)-number($leftwidth)-0.25"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:min-label-distance">
+ <xsl:value-of select="concat($min-label-distance,'cm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ <!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used
+ <xsl:variable name="currNode" select="/w:wordDocument/w:body//w:listPr[w:ilvl/@w:val = $currlevel][w:ilfo/@w:val = $currlist/w:ilfo/@w:val]"/>
+ <xsl:choose>
+ <xsl:when test="($currNode/wx:t/@wx:wTabBefore ) and ($currNode/wx:t/@wx:wTabAfter ) and (not($currNode/following-sibling::w:jc) or $currNode/following-sibling::w:jc/@w:val = 'left')">
+ <xsl:attribute name="text:space-before"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabBefore)div 1440) * 2.54"/>cm</xsl:attribute>
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabAfter)div 1440) * 2.54"/>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:space-before"><xsl:value-of select="((number(w:pPr/w:ind/@w:left) div 1440) * 2.54) "/>cm</xsl:attribute>
+ <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440) * 2.54"/>cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>-->
+ <xsl:if test="w:rPr/w:rFonts">
+ <xsl:if test="w:rPr/w:rFonts/@w:ascii">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- in Oasis format the style:font-name-asian is not allowed to appear here -->
+ <!--xsl:if test="w:rPr/w:rFonts/@w:fareast">
+ <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute>
+ </xsl:if -->
+ <!--
+ <xsl:if test="w:rPr/w:rFonts/@w:cs">
+ <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute>
+ </xsl:if>
+ -->
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="list-styles-image">
+ <xsl:variable name="currlevel" select="number(@w:ilvl)"/>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$currlevel+1"/>
+ </xsl:attribute>
+ <xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/>
+ <office:binary-data>
+ <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/>
+ </office:binary-data>
+ <xsl:element name="style:list-level-properties">
+ <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+ <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+ <xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/>
+ <xsl:attribute name="fo:text-align">left</xsl:attribute>
+ <xsl:attribute name="fo:width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="fo:height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="substring-after($picsize,'height:')"/>
+ </xsl:call-template>
+ <xsl:text>cm</xsl:text>
+ </xsl:attribute>
+ <xsl:variable name="labelwidth">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:ind/@w:hanging">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:ind/@w:first-line">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'twip')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="leftwidth">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="text:space-before">
+ <xsl:choose>
+ <xsl:when test="(number($leftwidth)-number($labelwidth)) &gt; 0 ">
+ <xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" '0cm' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="text:min-label-width">
+ <xsl:choose>
+ <xsl:when test="$labelwidth &gt; 0">
+ <xsl:value-of select="concat($labelwidth,'cm')"/>
+ </xsl:when>
+ <xsl:otherwise>0cm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="w:suff/@w:val='Space'">
+ <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+ <xsl:variable name="tabpos">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'twip')"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+ <xsl:attribute name="text:min-label-distance">
+ <xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <!-- avoid listPr in textbox. :( glu -->
+ <xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]">
+ <xsl:call-template name="genlist"/>
+ </xsl:template>
+ <xsl:template name="genlist">
+ <xsl:variable name="currlistid" select="w:pPr/w:listPr/w:ilfo/@w:val"/>
+ <xsl:variable name="currlistlvl" select="w:pPr/w:listPr/w:ilvl/@w:val"/>
+ <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/>
+ <xsl:element name="text:list">
+ <xsl:attribute name="text:style-name">
+ <xsl:choose>
+ <xsl:when test="string-length($rootlistname) &gt; 0">
+ <xsl:value-of select="translate($rootlistname,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_')"/>
+ </xsl:when>
+ <xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val">
+ <xsl:attribute name="text:continue-numbering">true</xsl:attribute>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$currlistlvl"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$currlistlvl"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="levels">
+ <xsl:param name="level"/>
+ <xsl:choose>
+ <xsl:when test="$level = '0'">
+ <xsl:call-template name="process-common-paragraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:element name="text:list">
+ <xsl:element name="text:list-item">
+ <xsl:call-template name="levels">
+ <xsl:with-param name="level" select="$level -1"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:style" mode="list">
+ <xsl:variable name="listname" select="@w:styleId"/>
+ <xsl:if test="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]">
+ <text:list-style style:name="{$listname}">
+ <xsl:apply-templates select="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]/w:lvl"/>
+ </text:list-style>
+ </xsl:if>
+ </xsl:template>
+ <!-- for create outline style in office:styles -->
+ <xsl:template name="create-outline-style">
+ <xsl:element name="text:outline-style">
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="1"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="2"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="3"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="4"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="5"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="6"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="7"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="8"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="9"/>
+ </xsl:call-template>
+ <xsl:call-template name="outline-level-style">
+ <xsl:with-param name="level" select="10"/>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="outline-level-style">
+ <xsl:param name="level"/>
+ <xsl:element name="text:outline-level-style">
+ <xsl:choose>
+ <xsl:when test="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]">
+ <xsl:apply-templates select="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]" mode="outline">
+ <xsl:with-param name="outlinelevel" select="$level"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="$level"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-format"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:listPr" mode="outline">
+ <xsl:param name="outlinelevel"/>
+ <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+ <xsl:variable name="currlistlevel">
+ <xsl:choose>
+ <xsl:when test="w:ilvl">
+ <xsl:value-of select="w:ilvl/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+ <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+ <xsl:if test="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
+ <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
+ <xsl:call-template name="list-styles-common">
+ <xsl:with-param name="listtype">
+ <xsl:choose>
+ <xsl:when test="w:nfc/@w:val">
+ <xsl:value-of select="w:nfc/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="currlevel" select="$outlinelevel"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="not($rootlist/w:lvl[@w:ilvl=$currlistlevel])">
+ <xsl:attribute name="text:level">
+ <xsl:value-of select="'1'"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="nfc2numformat">
+ <xsl:param name="nfcvalue"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=0">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=1">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=2">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=3">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=4">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=26">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="$prefix"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( '.' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=27 or $nfcvalue=29">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="concat( $prefix, '(' )"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( ')' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=57">
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="concat( $prefix, '- ' )"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="concat( ' -' , $suffix )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-prefix">
+ <xsl:value-of select="$prefix"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:num-suffix">
+ <xsl:value-of select="$suffix"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- xsl:template name="nfc2numformat">
+ <xsl:param name="nfcvalue"/>
+ <xsl:param name="prefix"/>
+ <xsl:param name="suffix"/>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=0">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=1">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=2">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=3">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=4">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=10 or $nfcvalue=11 or $nfcvalue=17 or $nfcvalue=29 or $nfcvalue=33 or $nfcvalue=35 or $nfcvalue=36 or $nfcvalue=37 or $nfcvalue=39 or $nfcvalue=44">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=12">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=13">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=14 or $nfcvalue=19">
+ <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=16">
+ <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=18 or $nfcvalue=28">
+ <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=20">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=21">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=24">
+ <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=25">
+ <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=30">
+ <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=31">
+ <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=34">
+ <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=38">
+ <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=41 or $nfcvalue=42 or $nfcvalue=43">
+ <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=45 or $nfcvalue=47">
+ <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=46 or $nfcvalue=48">
+ <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=53">
+ <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue!=57 and $nfcvalue &gt; 48 and $nfcvalue &lt; 60">
+ <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$nfcvalue=26">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( '.' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=27 or $nfcvalue=29">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '(' )"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ')' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$nfcvalue=57">
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '- ' )"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ' -' , $suffix )"/></xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+ <xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_page.xsl b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl
new file mode 100644
index 000000000000..8514594bf19a
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_page.xsl
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:footnotePr" mode="config">
+ <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol">
+ <xsl:if test="w:pos">
+ <xsl:choose>
+ <xsl:when test="w:pos/@w:val = 'beneath-text'">
+ <xsl:attribute name="text:footnotes-position">document</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:footnotes-position">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:numStart">
+ <xsl:choose>
+ <xsl:when test="w:numStart/@w:val - 1 &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="w:numStart/@w:val - 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute-->
+ </xsl:if>
+ <xsl:if test="w:numFmt">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="w:numRestart">
+ <xsl:choose>
+ <xsl:when test="w:numRestart/@w:val = 'continuous'">
+ <xsl:attribute name="text:start-numbering-at">document</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:numRestart/@w:val = 'each-sect'">
+ <xsl:attribute name="text:start-numbering-at">chapter</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-numbering-at">page</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:footnote[@w:type = 'continuation-separator']">
+ <text:footnote-continuation-notice-backward>
+ <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-separator'])"/>
+ </text:footnote-continuation-notice-backward>
+ </xsl:if>
+ <xsl:if test="w:footnote[@w:type = 'continuation-notice']">
+ <text:footnote-continuation-notice-forward>
+ <xsl:value-of select="normalize-space(w:footnote[@w:type = 'continuation-notice'])"/>
+ </text:footnote-continuation-notice-forward>
+ </xsl:if>
+ -->
+ </text:notes-configuration>
+ </xsl:template>
+ <xsl:template match="w:endnotePr" mode="config">
+ <text:notes-configuration text:note-class="endnote" text:citation-style-name="Endnote_20_Symbol">
+ <xsl:if test="w:numStart">
+ <xsl:choose>
+ <xsl:when test="(w:numStart/@w:val - 1) &gt; 0">
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select="w:numStart/@w:val - 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:start-value">
+ <xsl:value-of select=" '1' "/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:attribute name="text:start-value"><xsl:value-of select="w:numStart/@w:val - 1"/></xsl:attribute -->
+ </xsl:if>
+ <xsl:if test="w:numFmt">
+ <xsl:call-template name="convert-number-format">
+ <xsl:with-param name="number-format" select="w:numFmt/@w:val"/>
+ </xsl:call-template>
+ </xsl:if>
+ </text:notes-configuration>
+ </xsl:template>
+ <xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-zero'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">0</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">.</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-paren'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'number-in-dash'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">-</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-letter'">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-letter'">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-roman'">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-roman'">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <!-- ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting -->
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:bgPict">
+ <xsl:if test="w:background/@w:bgcolor">
+ <xsl:attribute name="fo:background-color">
+ <xsl:call-template name="MapConstColor">
+ <xsl:with-param name="color" select="w:background/@w:bgcolor"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:background/@w:background">
+ <style:background-image>
+ <office:binary-data>
+ <xsl:variable name="the-image" select="key('imagedata',w:background/@w:background)"/>
+ <xsl:value-of select="translate($the-image/text(),'&#9;&#10;&#13;&#32;','' ) "/>
+ </office:binary-data>
+ </style:background-image>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:sectPr" mode="page-layout">
+ <style:page-layout>
+ <xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr" format="1"/>
+ </xsl:attribute>
+ <style:page-layout-properties>
+ <xsl:call-template name="page-layout-properties"/>
+ <xsl:apply-templates select="/w:wordDocument/w:bgPict"/>
+ </style:page-layout-properties>
+ <style:header-style>
+ <style:header-footer-properties style:dynamic-spacing="true" fo:margin-bottom="0">
+ <xsl:attribute name="fo:min-height.value"><xsl:value-of select="concat('(.(twips2cm(?(>($0(-[', w:pgMar/@w:top, '](|[', w:pgMar/@w:header, '][720])))[0])($0)[0]))[cm])')"/></xsl:attribute>
+ </style:header-footer-properties>
+ </style:header-style>
+ </style:page-layout>
+ </xsl:template>
+ <xsl:template match="w:sectPr" mode="master-page">
+ <!-- style:page-layout style:style-->
+
+ <xsl:variable name="master-page-number">
+ <xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:variable>
+ <xsl:if test="$master-page-number = '1'">
+ <style:master-page style:next-style-name="Standard-1" style:page-layout-name="pm1" style:display-name="First Page" style:name="First_20_Page">
+ <style:header>
+ <xsl:apply-templates select="w:hdr[@w:type='first']/child::*" mode="dispatch"/>
+ </style:header>
+ <style:footer>
+ <xsl:apply-templates select="w:ftr[@w:type='first']/child::*" mode="dispatch"/>
+ </style:footer>
+ </style:master-page>
+ </xsl:if>
+ <xsl:element name="style:master-page">
+ <xsl:attribute name="style:name">Standard-<xsl:value-of select="$master-page-number"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:page-layout-name">
+ <xsl:value-of select="concat('pm', $master-page-number)"/>
+ </xsl:attribute>
+
+ <style:header>
+ <xsl:apply-templates select="w:hdr[@w:type='odd']/child::*" mode="dispatch"/>
+ </style:header>
+ <style:header-left>
+ <xsl:apply-templates select="w:hdr[@w:type='even']/child::*" mode="dispatch"/>
+ </style:header-left>
+ <style:footer>
+ <xsl:apply-templates select="w:ftr[@w:type='odd']/child::*" mode="dispatch"/>
+ </style:footer>
+ <style:footer-left>
+ <xsl:apply-templates select="w:ftr[@w:type='even']/child::*" mode="dispatch"/>
+ </style:footer-left>
+
+ <!-- Headers and footers-->
+ <!--
+ <style:header-style>
+ <style:header-footer-properties>
+ <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:header,'twip')"/></xsl:call-template>cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+ </style:header-footer-properties>
+ </style:header-style>
+ <style:footer-style>
+ <style:header-footer-properties>
+ <xsl:attribute name="fo:min-height"><xsl:call-template name="ConvertMeasure"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'twip')"/></xsl:call-template>cm</xsl:attribute>
+ <xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute>
+ <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+ </style:header-footer-properties>
+ </style:footer-style>
+ -->
+
+ <!-- any examples for w:titlePg usage? -->
+ <xsl:if test="not(w:titlePg)">
+ <xsl:apply-templates select="w:hdr[@w:type='odd']"/>
+ <xsl:apply-templates select="w:hdr[@w:type='even']"/>
+ <xsl:apply-templates select="w:ftr[@w:type='odd']"/>
+ <xsl:apply-templates select="w:ftr[@w:type='even']"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:hdr">
+ <!--
+ <xsl:choose>
+ <xsl:when test="@w:type = 'odd'">
+ <style:header>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:header>
+ </xsl:when>
+ <xsl:when test="@w:type = 'even'">
+ <style:header>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:header>
+ </xsl:when>
+ </xsl:choose>
+ -->
+ </xsl:template>
+ <xsl:template match="w:ftr">
+ <!--
+ <xsl:choose>
+ <xsl:when test="@w:type = 'odd'">
+ <style:footer>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:footer>
+ </xsl:when>
+ <xsl:when test="@w:type = 'even'">
+ <style:footer-left>
+ <xsl:apply-templates select="wx:pBdrGroup | w:p | w:tbl"/>
+ </style:footer-left>
+ </xsl:when>
+ </xsl:choose>
+ -->
+ </xsl:template>
+ <xsl:template match="wx:pBdrGroup">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:template>
+ <!-- xsl:template name="convert-number-format">
+ <xsl:param name="number-format"/>
+ <xsl:choose>
+ <xsl:when test="$number-format = 'decimal' or $number-format = 'decimal-half-width'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-zero'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">0</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-fullstop'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">.</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-paren'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'number-in-dash'">
+ <xsl:attribute name="style:num-format">1</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">-</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-letter'">
+ <xsl:attribute name="style:num-format">A</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-letter'">
+ <xsl:attribute name="style:num-format">a</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'upper-roman'">
+ <xsl:attribute name="style:num-format">I</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'lower-roman'">
+ <xsl:attribute name="style:num-format">i</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-full-width' or $number-format = 'decimal-full-width2'">
+ <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'decimal-enclosed-circle-chinese' or $number-format = 'decimal-enclosed-circle'">
+ <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-enclosed-circle'">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ <xsl:attribute name="style:num-prefix">(</xsl:attribute>
+ <xsl:attribute name="style:num-suffix">)</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chinese-counting-thousand' or $number-format = 'ideograph-digital' or $number-format = 'japanese-counting' or $number-format = 'japanese-digital-ten-thousand' or $number-format = 'taiwanese-counting-thousand' or $number-format = 'taiwanese-counting' or $number-format = 'taiwanese-digital' or $number-format = 'chinese-counting' or $number-format = 'korean-digital2' or $number-format = 'chinese-not-impl'">
+ <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chinese-legal-simplified'">
+ <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-legal-traditional'">
+ <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-traditional'">
+ <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ideograph-zodiac'">
+ <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'japanese-legal'">
+ <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'aiueo-full-width'">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'aiueo'">
+ <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'iroha-full-width'">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'iroha'">
+ <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'korean-digital' or $number-format = 'korean-counting' or $number-format = 'korean-legal'">
+ <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'chosung'">
+ <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'ganada'">
+ <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'arabic-alpha' or $number-format = 'arabic-abjad'">
+ <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'thai-letters' or $number-format = 'thai-numbers' or $number-format = 'thai-counting'">
+ <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$number-format = 'hebrew-1' or $number-format = 'hebrew-2'">
+ <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
+ </xsl:when>
+ < ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
+ vietnamese-counting, russian-lower, russian-upper, hindi-vowels, hindi-consonants, hindi-numbers, hindi-counting >
+ <xsl:otherwise>
+ <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template -->
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_path.xsl b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl
new file mode 100644
index 000000000000..2ad46a1a96a0
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_path.xsl
@@ -0,0 +1,1818 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:include href="../../common/math.xsl"/>
+ <xsl:template name="dummy">
+ <xsl:call-template name="test"/>
+ </xsl:template>
+ <xsl:template name="test-arc">
+ <xsl:call-template name="svg-arc2vml-arc">
+ <!-- M 125,75 a100,50 0 ?,? 100,50 -->
+ <xsl:with-param name="x0" select="125"/>
+ <xsl:with-param name="y0" select="75"/>
+ <xsl:with-param name="rx" select="100"/>
+ <xsl:with-param name="ry" select="50"/>
+ <xsl:with-param name="x-axis-rotation" select="0"/>
+ <xsl:with-param name="large-arc-flag" select="0"/>
+ <xsl:with-param name="sweep-flag" select="0"/>
+ <xsl:with-param name="x" select="225"/>
+ <xsl:with-param name="y" select="125"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="test">
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="'m,l,4500,3420,2520,6120,4500r2160,l6660,3240,8460,2520,8460,,3960,540r360,720l2700,1260,3240,540,,xe'"/>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="vmlpath2svgpath">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="svg-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'m'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'm' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' M ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 't' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' m ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'r' ">
+ <!-- relative lineto -->
+ <!-- 'l' command is not supported currently, so we use 'L' -->
+ <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message>
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <!-- 'l' command is not supported currently-->
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $new-x ,' ' , $new-y , ' ') "/>
+ <!-- xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/ -->
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyH' ">
+ <!-- absolute horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyh' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyV' ">
+ <!-- absolute vertical lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyv' ">
+ <!-- relative horizontal lineto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' l ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' C ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyS' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' c ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummys' ">
+ <!-- absolute shorthand/smooth curveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' v ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control-1">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 ">
+ <xsl:variable name="previous-control-2">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="count" select="2"/>
+ <xsl:with-param name="skipcount" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="substring-before($previous-control-2 , ':') "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($control-and-pos, ':') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyQ' ">
+ <!-- absolute quadratic bézier curves -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'dummyq' ">
+ <!-- relative quadratic bézier curves -->
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/>
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/>
+ <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ' , $absolute-number , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'x' ">
+ <!--dummy or $command = 'z' "-->
+ <!-- closepath -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' Z ' ) "/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'e' ">
+ <!-- end path -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' N ' )"/>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--Code below is for the support of h-command like ha,hb....hi, maybe still need to revise-->
+ <xsl:when test="$command = 'ha' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hb' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hc' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hd' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'he' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hf' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hg' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hh' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hi' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'nf' or $command = 'ns' ">
+ <xsl:variable name="new-svg-path" select="$svg-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'al' ">
+ <!-- absolute moveto -->
+ <xsl:variable name="new-svg-path" select="concat($svg-path ,' W ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2svgpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="svg-path" select=" concat($new-svg-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$svg-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ **Template vmlpath2enhancedpath**
+ The template is resposible for converting the vml-path to enhanced-path, because the svg:path
+ cann't support command a now.(But heard that will be supported in OOo3.0)
+ And the 2nd reason of using an enhanced-path is that enhanced-path have a perfect maping to
+ vmlpath.(You will find out that often,we even don't need to change the parameters).
+ -->
+ <xsl:template name="vmlpath2enhancedpath">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="enhanced-path" select="''"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command" select="'m'"/>
+ <xsl:param name="current-x" select="'0'"/>
+ <xsl:param name="current-y" select="'0'"/>
+ <xsl:variable name="command-and-newpos">
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/>
+ <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/>
+ <xsl:choose>
+ <xsl:when test="$command = 'm' ">
+ <!--####Notice that the "m 0,0,1,1,1,1" means two lines-->
+ <!-- absolute moveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'l' ">
+ <!-- absolute lineto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'x' ">
+ <!--dummy or $command = 'z' "-->
+ <!-- closepath -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Z ' ) "/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'e' ">
+ <!-- end path -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' N ' )"/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'c' ">
+ <!-- absolute curveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/>
+ <xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 't' ">
+ <!-- relative moveto -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' M ' ) "/>
+ <!--####maybe this is not crect because t r and v hasn't direct image in enhaced-path-->
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'r' ">
+ <!-- relative lineto -->
+ <!--####maybe this is not crect because 't' 'r' and 'v' hasn't direct image in enhaced-path-->
+ <!-- 'l' command is not supported currently, so we use 'L' -->
+ <xsl:message>'l' command is not supported currently, so we use 'L'. This may case problem.</xsl:message>
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' L ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:variable name="new-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <!-- 'l' command is not supported currently-->
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , $new-x ,' ' , $new-y , ' ') "/>
+ <!-- xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/ -->
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'v' ">
+ <!-- relative curveto -->
+ <!--####maybe this is not crect because 't' 'r' and 'v' hasn't direct image in enhaced-path-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' C ' ) "/>
+ <!--<xsl:variable name="control-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/>
+ </xsl:call-template>-
+ -->
+ <xsl:variable name="x1">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y1">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x1 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x2">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $y1 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y2">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x2 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $y2 , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="y">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after( $x , ':')"/>
+ <xsl:with-param name="count" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="val_x1">
+ <xsl:value-of select="substring-before( $x1 , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y1">
+ <xsl:value-of select="substring-before( $y1 , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="val_x2">
+ <xsl:value-of select="substring-before( $x2 , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y2">
+ <xsl:value-of select="substring-before( $y2 , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="val_x">
+ <xsl:value-of select="substring-before( $x , ':')+$current-x"/>
+ </xsl:variable>
+ <xsl:variable name="val_y">
+ <xsl:value-of select="substring-before( $y , ':')+$current-y"/>
+ </xsl:variable>
+ <xsl:variable name="control-and-pos">
+ <xsl:value-of select="concat($val_x1, ' ',$val_y1, ' ',$val_x2, ' ',$val_y2, ' ' )"/>
+ </xsl:variable>
+ <xsl:variable name="num-and-pos">
+ <xsl:value-of select="concat($val_x, ' ',$val_y, ' ' )"/>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ',$control-and-pos , ' ' , $num-and-pos , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $y , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $val_x "/>
+ <xsl:with-param name="current-y" select=" $val_y "/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--Code below is for the support of h-command like ha,hb....hi, maybe still need to revise-->
+ <xsl:when test="$command = 'ha' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hb' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hc' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hd' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'he' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hf' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hg' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hh' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'hi' ">
+ <xsl:variable name="new-enhanced-path" select="$enhanced-path"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'nf' ">
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' F ' )"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'ns' ">
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' S ' )"/>
+ <!--simply did nothing which might be wrong-->
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , ' ') "/>
+ <xsl:with-param name="position" select=" $newpos "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" $current-x "/>
+ <xsl:with-param name="current-y" select=" $current-y"/>
+ </xsl:call-template>
+ </xsl:when>
+ <!--The following is 6 command which deal with arcs:
+ ae ->T al -> U
+ at -> A ar -> B
+ wa -> W wr ->V
+ These pairs of commands have shown the perfect mapping from vml-path to enhanced-path-->
+ <xsl:when test="$command = 'ae' ">
+ <!-- arc on the screen with the start and end angles -->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' T ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'al' ">
+ <!-- ae command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' U ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="6"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'at' ">
+ <!-- arc on the screen with the edge box ,start points and end points(Notice it's counter-clockwise)-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' A ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'ar' ">
+ <!-- at command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' B ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'wa' ">
+ <!-- arc on the screen with the edge box ,start points and end points(Notice it's clockwise)-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' W ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'wr' ">
+ <!-- wa command plus a implicitly moveto startpoint-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' V ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="8"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qx' ">
+ <!-- Draw a quarter ellipse retated to the x-axis-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' X ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qy' ">
+ <!-- Draw a quarter ellipse retated to the y-axis-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Y ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="2"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$command = 'qb' ">
+ <!-- quadratic Bezier-->
+ <xsl:variable name="new-enhanced-path" select="concat($enhanced-path ,' Q ' ) "/>
+ <xsl:variable name="num-and-pos">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$newpos"/>
+ <xsl:with-param name="count" select="4"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="vmlpath2enhancedpath">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="enhanced-path" select=" concat($new-enhanced-path , substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/>
+ <xsl:with-param name="last-command" select="$command"/>
+ <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/>
+ <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$enhanced-path"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-before">
+ <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="-1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="previous-num-and-pos">
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/>
+ </xsl:variable>
+ <xsl:call-template name="get-number-before">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-after">
+ <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newpostion
+ skip $skipcount of numbers
+ -->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="count" select="1"/>
+ <xsl:param name="skipcount" select="0"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="$count = 0">
+ <xsl:value-of select=" concat($number , ':' , $position) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="num-pos">
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ <xsl:with-param name="direction" select="1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="next-num-and-pos">
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$num-pos"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="$skipcount &gt; 0">
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count"/>
+ <xsl:with-param name="skipcount" select="$skipcount - 1"/>
+ <xsl:with-param name="number" select="$number"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$skipcount = 0">
+ <xsl:variable name="new-number">
+ <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/>
+ <xsl:if test="not($count = 1)">
+ <xsl:value-of select="' '"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:call-template name="get-number-after">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/>
+ <xsl:with-param name="count" select="$count - 1"/>
+ <xsl:with-param name="skipcount" select="0"/>
+ <xsl:with-param name="number" select="$new-number"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-number-position">
+ <!-- get the next number start position, direction should be 1 or -1-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="direction" select="1"/>
+ <xsl:choose>
+ <xsl:when test="$direction = 1 and $position &gt; string-length($vml-path) ">0</xsl:when>
+ <xsl:when test="$direction = -1 and not($position &gt; 0)">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char">
+ <xsl:if test="$direction = 1">
+ <xsl:value-of select="substring($vml-path, $position , 1)"/>
+ </xsl:if>
+ <xsl:if test="$direction = -1">
+ <xsl:value-of select="substring($vml-path, $position -1 , 1)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start-->
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:when test="not($curr-char = ' ')">
+ <xsl:value-of select="$position"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-number-position">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position + $direction"/>
+ <xsl:with-param name="direction" select="$direction"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="skip-space">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="skip-comma" select="'yes'"/>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="$curr-char = ',' and $skip-comma = 'yes'">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position+1"/>
+ <xsl:with-param name="skip-comma" select="'no'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$curr-char = ' '">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position+1"/>
+ <xsl:with-param name="skip-comma" select="$skip-comma"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$position"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="format-number-pos">
+ <xsl:param name="number"/>
+ <xsl:param name="position"/>
+ <xsl:choose>
+ <xsl:when test="contains($number,'@')">
+ <xsl:value-of select="concat('?f',translate($number,'@',''),':' , $position ) "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" concat(round($number) , ':' , $position) "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-next-number">
+ <!-- get the next number from current position-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select=" '' "/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) ">
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- is number -->
+ <xsl:call-template name="get-next-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="number" select="concat( $number, $curr-char) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test=" $number = '' and $curr-char = ',' ">
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( '0:' , $new-pos )"/>
+ </xsl:when>
+ <xsl:when test=" $number = '' and not($curr-char = ',') ">
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="concat( '0:' , $new-pos)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="new-pos">
+ <xsl:call-template name="skip-space">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$new-pos"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-previous-number">
+ <!-- get the previous number from current position-->
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position"/>
+ <xsl:param name="number" select="''"/>
+ <xsl:choose>
+ <xsl:when test="not($position &gt; 0)">
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="'0'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position -1 , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 ">
+ <!-- is number -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="concat($curr-char , $number) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '@+-' ,'') ) = 0 and string-length($number) = 0">
+ <!-- skip it -->
+ <xsl:call-template name="get-previous-number">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position -1"/>
+ <xsl:with-param name="number" select="$number "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) &gt; 0">
+ <!-- finsh it with +/- -->
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="format-number-pos">
+ <xsl:with-param name="number" select="$number"/>
+ <xsl:with-param name="position" select="$position"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="get-path-command_dummy">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:choose>
+ <xsl:when test="string-length(translate($curr-char , 'mlcxetrvnfsawqyb' ,'')) = 0 ">
+ <!-- "MmZzLlHhVvCcSsQqTtAa" are all possiable command chars -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ **get-path- command**
+ This function will collect the next command from a string. If the input string should has a start of number character,
+ we here implictly think the command is the last-command
+ All of the command of vml is listed as following:
+ __Basic commands:__
+ m l c x e t r v nf ns ae al at ar wa wr qx qy qb
+ __Edit behavior extensions commands__
+ ha hb hc hd he hf hg hh hi
+
+ So we know the longest command should be four character.The function is implemented on this basis:
+ -->
+ <xsl:template name="get-path-command">
+ <xsl:param name="vml-path"/>
+ <xsl:param name="position" select="1"/>
+ <xsl:param name="last-command"/>
+ <xsl:choose>
+ <xsl:when test="$position &gt; string-length($vml-path) "/>
+ <xsl:otherwise>
+ <xsl:variable name="curr-char" select="substring($vml-path, $position , 1)"/>
+ <xsl:variable name="curr-2char" select="substring($vml-path, $position - 1 , 2)"/>
+ <xsl:choose>
+ <xsl:when test="$curr-char = 'a' ">
+ <!--process the commands ae al at ar-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='e' ">1</xsl:when>
+ <xsl:when test="$second-char='l' ">1</xsl:when>
+ <xsl:when test="$second-char='t' ">1</xsl:when>
+ <xsl:when test="$second-char='r' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'n' ">
+ <!--process the commands nf ns -->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='f' ">1</xsl:when>
+ <xsl:when test="$second-char='s' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'w' ">
+ <!--process the commands wa wr-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='a' ">1</xsl:when>
+ <xsl:when test="$second-char='r' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'q' ">
+ <!--process the commands qx qy qb-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="$second-char='x' ">1</xsl:when>
+ <xsl:when test="$second-char='y' ">1</xsl:when>
+ <xsl:when test="$second-char='b' ">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$curr-char = 'h' ">
+ <!--process the edit behavior extensions commands-->
+ <xsl:variable name="second-char" select="substring($vml-path, $position+1 , 1)"/>
+ <xsl:variable name="isvalid">
+ <xsl:choose>
+ <xsl:when test="string-length(translate($second-char , 'abcdefghi' ,'')) = 0">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$isvalid = '1' ">
+ <xsl:value-of select="concat( $curr-char,$second-char , ':' , $position +2)"/>
+ </xsl:if>
+ <xsl:if test="$isvalid = '0' ">
+ <xsl:message>ooo2wordml_path.xsl: Error command occured </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , 'mlcxetrv' ,'')) = 0 ">
+ <!--process the single character commands m l c x e t r v -->
+ <xsl:value-of select="concat( $curr-char , ':' , $position +1)"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , '+-.0123456789@' ,'')) = 0 ">
+ <!-- number start, use last command -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="$curr-2char=',,' ">
+ <!-- here are two ',' -->
+ <xsl:if test="string-length($last-command) = 0">
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command</xsl:message>
+ </xsl:if>
+ <xsl:value-of select="concat( $last-command , ':' , $position )"/>
+ </xsl:when>
+ <xsl:when test="string-length(translate($curr-char , ',&#9;&#10;&#13;&#32;' ,'')) = 0 ">
+ <!-- space or ',' should be skip -->
+ <xsl:call-template name="get-path-command">
+ <xsl:with-param name="vml-path" select="$vml-path"/>
+ <xsl:with-param name="position" select="$position +1"/>
+ <xsl:with-param name="last-command" select="$last-command"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="svg-arc2vml-arc">
+ <xsl:param name="x0"/>
+ <xsl:param name="y0"/>
+ <xsl:param name="rx"/>
+ <xsl:param name="ry"/>
+ <xsl:param name="x-axis-rotation" select="0"/>
+ <xsl:param name="large-arc-flag" select="0"/>
+ <xsl:param name="sweep-flag" select="0"/>
+ <xsl:param name="x"/>
+ <xsl:param name="y"/>
+ <!-- Compute 1/2 distance between current and final point -->
+ <xsl:variable name="dx2" select="($x0 - $x) div 2"/>
+ <xsl:variable name="dy2" select="($y0 - $y) div 2"/>
+ <!-- Convert from degrees to radians -->
+ <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/>
+ <!-- Compute (x1, y1). What are x1,y1?-->
+ <xsl:variable name="cos-rotation">
+ <xsl:call-template name="cos">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="sin-rotation">
+ <xsl:call-template name="sin">
+ <xsl:with-param name="x" select="$rotation-radian"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/>
+ <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/>
+ <!-- Make sure radii are large enough -->
+ <xsl:variable name="rx-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$rx"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ry-abs">
+ <xsl:call-template name="abs">
+ <xsl:with-param name="x" select="$ry"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/>
+ <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/>
+ <xsl:variable name="x1-sq" select="$x1 * $x1"/>
+ <xsl:variable name="y1-sq" select="$y1 * $y1"/>
+ <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/>
+ <xsl:variable name="radius-check-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$radius-check"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="new-rx">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$rx-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$ry-abs * $radius-check-sqrt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-abs"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-ry-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-ry * $new-ry"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$ry-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="new-rx-sq">
+ <xsl:choose>
+ <xsl:when test="$radius-check &gt; 1">
+ <xsl:value-of select="$new-rx * $new-rx"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$rx-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Step 2: Compute (cx1, cy1) -->
+ <xsl:variable name="sign">
+ <xsl:choose>
+ <xsl:when test="$large-arc-flag = $sweep-flag">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="unchecked-sq" select=" (($new-rx-sq * $new-ry-sq) - ($new-rx-sq * $y1-sq) - ($new-ry-sq * $x1-sq)) div (($new-rx-sq * $y1-sq) + ($new-ry-sq * $x1-sq)) "/>
+ <xsl:variable name="sq">
+ <xsl:choose>
+ <xsl:when test=" $unchecked-sq &lt; 0">0</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$unchecked-sq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="sq-sqrt">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="$sq"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="coef" select="$sign * $sq-sqrt "/>
+ <xsl:variable name="cx1" select="$coef * $new-rx * $y1 div $new-ry"/>
+ <xsl:variable name="cy1" select=" -1 * $coef * $new-ry * $x1 div $new-rx"/>
+ <!-- Step 3: Compute (cx, cy) from (cx1, cy1) -->
+ <xsl:variable name="sx2" select="($x0 +$x) div 2 "/>
+ <xsl:variable name="sy2" select="($y0 +$y) div 2 "/>
+ <xsl:variable name="tmp1" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="tmp2" select="$cos-rotation * $cx1 "/>
+ <xsl:variable name="cx" select=" $sx2 + ( $cos-rotation * $cx1 - $sin-rotation * $cy1 ) "/>
+ <xsl:variable name="cy" select=" $sy2 + ( $sin-rotation * $cx1 + $cos-rotation * $cy1 ) "/>
+ <!-- Step 4: Compute angle start and angle extent -->
+ <xsl:variable name="ux" select="( $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="uy" select="( $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="vx" select="( - 1 * $x1 - $cx1) div $new-rx"/>
+ <xsl:variable name="vy" select="(- 1 * $y1 - $cy1) div $new-ry"/>
+ <xsl:variable name="n">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select=" ($ux * $ux) + ($uy * $uy) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- 1 * ux + 0 * uy -->
+ <xsl:variable name="p" select="$ux"/>
+ <xsl:variable name="uy-sign">
+ <xsl:choose>
+ <xsl:when test=" $uy &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p div $n"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="theta" select="( $uy-sign * $acos-pn * 180 div $pi ) mod 360 "/>
+ <xsl:variable name="n-delta">
+ <xsl:call-template name="sqrt">
+ <xsl:with-param name="x" select="($ux * $ux + $uy * $uy) * ($vx * $vx + $vy * $vy)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="p-delta" select="$ux * $vx + $uy * $vy"/>
+ <xsl:variable name="vy-sign">
+ <xsl:choose>
+ <xsl:when test="($ux * $vy - $uy * $vx) &lt; 0 ">-1</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="acos-pn-delta">
+ <xsl:call-template name="acos">
+ <xsl:with-param name="x" select="$p-delta div $n-delta"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="unchecked-delta" select="$vy-sign * $acos-pn-delta * 180 div $pi "/>
+ <xsl:variable name="delta">
+ <xsl:choose>
+ <xsl:when test=" $sweep-flag = 0 and $unchecked-delta &gt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta - 360) mod 360 "/>
+ </xsl:when>
+ <xsl:when test=" $sweep-flag = 1 and $unchecked-delta &lt; 0 ">
+ <xsl:value-of select=" ($unchecked-delta + 360) mod 360 "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" $unchecked-delta mod 360 "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="concat ($cx, ' ' , $cy, ' ' , $rx, ' ' , $ry, ' ' , $theta, ' ' , $delta, ' ' , $x-axis-rotation) "/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_props.xsl b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl
new file mode 100644
index 000000000000..76725f217d79
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_props.xsl
@@ -0,0 +1,107 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v" xmlns:an="urn:flr:annotate">
+
+<an:page-layout-properties
+ context-node-input="w:sectPr"
+ context-node-output="style:page-layout-properties">
+<an:so-supported select="w:pgMar/@w:gutter"/>
+<an:so-supported select="w:pgSz/@w:code"/>
+</an:page-layout-properties>
+
+<xsl:template name="page-layout-properties">
+
+<xsl:attribute name="fo:margin-top.value">
+ <xsl:value-of select="concat('(.(twips2cm(?[',name(w:hdr),'](?(>=($0[',w:pgMar/@w:top,'])($1(|[',w:pgMar/@w:header,'][720])))($1)($0))[',w:pgMar/@w:top,']))[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-bottom.value">
+ <xsl:value-of select="concat('(.(twips2cm(?[',name(w:ftr),'](|[',w:pgMar/@w:footer,'][720])[',w:pgMar/@w:bottom,']))[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-left.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:left,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:margin-right.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgMar/@w:right,'])[cm])')"/>
+</xsl:attribute>
+
+<xsl:attribute name="fo:page-width.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:w,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:page-height.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:pgSz/@w:h,'])[cm])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:footnote-max-height.value">
+ <xsl:value-of select="'[0cm]'"/>
+</xsl:attribute>
+<xsl:attribute name="style:print-orientation.value">
+ <xsl:value-of select="concat('(|[',w:pgSz/@w:orient,'][portrait])')"/>
+</xsl:attribute>
+<xsl:apply-templates select="//w:bgPict"/>
+<xsl:call-template name="column-properties"/>
+</xsl:template>
+
+
+<an:column-properties
+ context-node-input="w:sectPr"
+ context-node-output="style:page-layout-properties">
+<an:so-supported select="w:cols/@w:sep"/>
+</an:column-properties>
+<xsl:template name="column-properties">
+<style:columns>
+<xsl:attribute name="fo:column-count.value">
+ <xsl:value-of select="concat('(|[',w:cols/@w:num,'][1])')"/>
+</xsl:attribute>
+
+<xsl:if test="not(w:cols/w:col)">
+<!-- bug in the OASIS spec resp. bug in xmloff -->
+<xsl:attribute name="fo:column-gap.value">
+ <xsl:value-of select="concat('(.(twips2cm[',w:cols/@w:space,'])[cm])')"/>
+</xsl:attribute>
+</xsl:if>
+
+<xsl:for-each select="w:cols/w:col">
+ <style:column>
+ <xsl:attribute name="style:rel-width.value">
+ <xsl:value-of select="concat('(.[',@w:w,'][*])')"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:start-indent.value">
+ <xsl:value-of select="'[0cm]'"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:end-indent.value">
+ <xsl:value-of select="concat('(.(twips2cm(|[',@w:space,'][0]))[cm])')"/>
+ </xsl:attribute>
+ </style:column>
+</xsl:for-each>
+</style:columns>
+</xsl:template>
+
+<an:text-properties
+ context-node-input="w:rPr"
+ context-node-output="style:text-properties">
+</an:text-properties >
+<xsl:template name="text-properties">
+<xsl:attribute name="fo:font-weight.value">
+ <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-weight-asian.value">
+ <xsl:value-of select="concat('(switch(|[',w:b/@val,'][',local-name(w:b),'])[on][bold][off][normal][b][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-weight-complex.value">
+ <xsl:value-of select="concat('(switch(|[',w:b-cs/@val,'][',local-name(w:b-cs),'])[on][bold][off][normal][b-cs][bold][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:font-style.value">
+ <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-style-asian.value">
+ <xsl:value-of select="concat('(switch(|[',w:i/@val,'][',local-name(w:i),'])[on][italic][off][normal][i][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="style:font-style-complex.value">
+ <xsl:value-of select="concat('(switch(|[',w:i-cs/@val,'][',local-name(w:i-cs),'])[on][italic][off][normal][i-cs][italic][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:text-transform.value">
+ <xsl:value-of select="concat('(switch(|[',w:caps/@val,'][',local-name(w:caps),'])[on][uppercase][off][normal][caps][uppercase][])')"/>
+</xsl:attribute>
+<xsl:attribute name="fo:font-variant.value">
+ <xsl:value-of select="concat('(switch(|[',w:smallCaps/@val,'][',local-name(w:smallCaps),'])[on][small-caps][off][normal][smallCaps][small-caps][])')"/>
+</xsl:attribute>
+</xsl:template>
+
+</xsl:stylesheet> \ No newline at end of file
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl
new file mode 100644
index 000000000000..84696dcf5773
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_settings.xsl
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:docPr">
+ <office:settings>
+ <config:config-item-set config:name="view-settings">
+ <config:config-item config:name="InBrowseMode" config:type="boolean">
+ <xsl:choose>
+ <xsl:when test="w:view/@w:val = 'outline'">true</xsl:when>
+ <xsl:when test="w:view/@w:val = 'print'">false</xsl:when>
+ <!-- others: web, reading, normal, master-pages, none. glu -->
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <xsl:if test="w:zoom">
+ <!-- VisibleRight and VisibleBottom are arbitrary positive numbers. ;) glu -->
+ <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item>
+ <xsl:choose>
+ <xsl:when test="w:zoom/@w:val = 'best-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
+ </xsl:when>
+ <xsl:when test="w:zoom/@w:val = 'full-page'">
+ <config:config-item config:name="ZoomType" config:type="short">2</config:config-item>
+ </xsl:when>
+ <xsl:when test="w:zoom/@w:val = 'text-fit'">
+ <config:config-item config:name="ZoomType" config:type="short">1</config:config-item>
+ </xsl:when>
+ <xsl:otherwise>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ </xsl:otherwise>
+ </xsl:choose>
+ <config:config-item config:name="ZoomFactor" config:type="short">
+ <xsl:value-of select="w:zoom/@w:percent"/>
+ </config:config-item>
+ </xsl:if>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ </office:settings>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_table.xsl b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl
new file mode 100644
index 000000000000..113dd391b433
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_table.xsl
@@ -0,0 +1,1286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template match="w:style[@w:type='table']" mode="table">
+ <style:style style:family="table">
+ <xsl:attribute name="style:name">
+ <xsl:value-of select="concat('w',translate(@w:styleId,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ <xsl:if test="w:basedOn">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:basedOn/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <style:table-properties table:align="margins"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:tblPr" mode="style">
+ <xsl:variable name="table-number">
+ <xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1" />
+ </xsl:variable>
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">
+ <xsl:text>Table</xsl:text>
+ <xsl:value-of select="$table-number"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table</xsl:attribute>
+ <xsl:if test="w:tblStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:tblStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/>
+ <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/>
+ <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/>
+ <xsl:variable name="last-next-p-tbl" select="$last-section-property[last()]/following::*[name()='w:p' or name()='w:tbl']"/>
+ <xsl:choose>
+ <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-next-p-tbl[1]) = generate-id(..) and not(ancestor::w:sectPr or ancestor::w:styles)">
+ <xsl:attribute name="style:master-page-name">
+ <xsl:text>Standard</xsl:text>
+ <xsl:value-of select="$section-property-number + 1" />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$table-number = 1 and not(preceding::w:p[ancestor::w:body])">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:element name="style:table-properties">
+ <xsl:choose>
+ <xsl:when test="w:jc/@w:val = 'left' or w:jc/@w:val = 'center' or w:jc/@w:val = 'right'">
+ <xsl:attribute name="table:align">
+ <xsl:value-of select="w:jc/@w:val"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="table:align">margins</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- adopt the width of table and column corresponding the width of page and margins. . -->
+ <xsl:variable name="sectPr" select="following::w:sectPr[1]"/>
+ <xsl:variable name="total-page-size" select="$sectPr/w:pgSz/@w:w"/>
+ <xsl:variable name="page-left-mar" select="$sectPr/w:pgMar/@w:left"/>
+ <xsl:variable name="page-right-mar" select="$sectPr/w:pgMar/@w:right"/>
+ <xsl:variable name="page-size-value" select="$total-page-size - $page-left-mar - $page-right-mar"/>
+ <xsl:variable name="page-size-inch">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($page-size-value, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="gridcols" select="../w:tblGrid/w:gridCol"/>
+ <xsl:variable name="tblsize" select="sum($gridcols/@w:w)"/>
+ <xsl:variable name="table_indent">
+ <xsl:choose>
+ <xsl:when test="w:tblInd and w:tblInd/@w:w &gt; 0 ">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblInd/@w:w, 'twip') "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="number( '0') "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="rel-tblsize">
+ <xsl:choose>
+ <xsl:when test="w:tblW/@w:type = 'pct'">
+ <xsl:value-of select="(number(w:tblW/@w:w ) div 5000) * $page-size-inch"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat($tblsize, 'twip')"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:width">
+ <xsl:value-of select="concat($rel-tblsize, 'in' )"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_margin_left">
+ <xsl:choose>
+ <xsl:when test="not(w:tblpPr ) ">
+ <xsl:choose>
+ <xsl:when test="w:bidiVisual">
+ <xsl:choose>
+ <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+ <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$table_indent"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:tblpPr">
+ <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 -->
+ <xsl:text>0</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tbl_margin_right">
+ <xsl:choose>
+ <xsl:when test="not(w:tblpPr ) ">
+ <xsl:choose>
+ <xsl:when test="w:bidiVisual">
+ <xsl:value-of select="$table_indent"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+ <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:tblpPr">
+ <!-- if the table is put into a draw:text-box, fo:margin-left and fo:margin-right should be 0 -->
+ <xsl:text>0</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:value-of select="concat( $tbl_margin_left, 'in')"/>
+ </xsl:attribute>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:value-of select="concat($tbl_margin_right, 'in')"/>
+ </xsl:attribute>
+ <!-- If previous w:p has a page break, the table must have the page break attribute applied to it May need this for tables starting on new pages -->
+ <!-- <xsl:if test="parent::w:tbl/preceding-sibling::w:p[1][descendant::w:br/@w:type='page']">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute></xsl:if> -->
+ <!-- initial values for tables-->
+ </xsl:element>
+ </xsl:element>
+ <!-- the following style is for conveting Word table text wrapping to SO Writer. Since SO Writer has no table text wrapping feature, so we use the draw:text-box as a container and put the table in draw:text-box -->
+ <xsl:if test="w:tblpPr">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">TableFrame<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">graphic</xsl:attribute>
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select=" 'Frame' "/>
+ </xsl:attribute>
+ <xsl:element name="style:graphic-properties">
+ <xsl:if test="w:tblpPr/@w:leftFromText">
+ <xsl:variable name="left_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:leftFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-left">
+ <xsl:value-of select="concat( $left_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:rightFromText">
+ <xsl:variable name="right_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:rightFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-right">
+ <xsl:value-of select="concat( $right_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:topFromText">
+ <xsl:variable name="top_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:topFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-top">
+ <xsl:value-of select="concat( $top_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblpPr/@w:bottomFromText">
+ <xsl:variable name="bottom_margin_from_text">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat (w:tblpPr/@w:bottomFromText, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:value-of select="concat( $bottom_margin_from_text, 'in') "/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="style:number-wrapped-paragraphs">
+ <xsl:text>no-limit</xsl:text>
+ </xsl:attribute>
+ <!--xsl:if test="w:tblpPr/@w:tblpYSpec" to get the vertical alignment-->
+ <xsl:variable name="vertical_alignment">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'top' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'center' ">
+ <xsl:text>middle</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec= 'bottom' ">
+ <xsl:text>bottom</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec = 'inside' ">
+ <xsl:text>from-top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpYSpec= 'outside' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>from-top</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-pos">
+ <xsl:value-of select="$vertical_alignment"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:vertAnchor" to get the vertical anchor related area type -->
+ <xsl:variable name="frame_v_anchor">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'text' ">
+ <xsl:value-of select=" 'paragraph' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'margin' ">
+ <xsl:value-of select=" 'paragraph-content' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:vertAnchor = 'page' ">
+ <xsl:value-of select="w:tblpPr/@w:vertAnchor"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'page-content' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-rel">
+ <xsl:value-of select="$frame_v_anchor"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:tblpXSpec" to get the horizntal alignment-->
+ <xsl:variable name="horizental_alignment">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'left' ">
+ <xsl:text>left</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'center' ">
+ <xsl:text>center</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'right' ">
+ <xsl:text>right</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'inside' ">
+ <xsl:text>from-left</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:tblpXSpec = 'outside' ">
+ <xsl:text>outside</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>left</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:horizontal-pos">
+ <xsl:value-of select="$horizental_alignment"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <!--xsl:if test="w:tblpPr/@w:horzAnchor" to get the horizental anchor related area type-->
+ <xsl:variable name="frame_h_anchor">
+ <xsl:choose>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'text' ">
+ <xsl:value-of select=" 'paragraph' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'margin' ">
+ <xsl:value-of select=" 'page-content' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor = 'page' ">
+ <xsl:value-of select="w:tblpPr/@w:horzAnchor"/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor= 'inside' ">
+ <xsl:value-of select=" 'paragraph-start-margin' "/>
+ </xsl:when>
+ <xsl:when test="w:tblpPr/@w:horzAnchor= 'outside' ">
+ <xsl:value-of select=" 'paragraph-end-margin' "/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select=" 'paragraph-content' "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:horizontal-rel">
+ <xsl:value-of select="$frame_h_anchor"/>
+ </xsl:attribute>
+ <!--/xsl:if-->
+ <xsl:attribute name="fo:background-color">
+ <xsl:text>#ffffff</xsl:text>
+ </xsl:attribute>
+ <!-- xsl:attribute name="style:background-transparency"><xsl:text>100%</xsl:text></xsl:attribute -->
+ <xsl:attribute name="style:wrap">
+ <xsl:text>parallel</xsl:text>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:gridCol" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-column</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:element name="style:table-column-properties">
+ <xsl:variable name="column_width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(@w:w, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:column-width">
+ <xsl:value-of select="concat($column_width,'in') "/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:trPr" mode="style">
+ <!-- to generate style:style of table-row height. -->
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:family">table-row</xsl:attribute>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:element name="style:table-row-properties">
+ <xsl:choose>
+ <xsl:when test="w:trHeight/@w:val">
+ <xsl:variable name="tbl_row_height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:trHeight/@w:val, 'twip') "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="style:min-row-height">
+ <xsl:value-of select="concat($tbl_row_height, 'in' )"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tcPr" mode="style">
+ <style:style>
+ <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">table-cell</xsl:attribute>
+ <xsl:variable name="rootStyle" select="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val"/>
+ <xsl:variable name="rootStyleNode" select="/w:wordDocument/w:styles/w:style[@w:styleId = $rootStyle]"/>
+ <xsl:element name="style:table-cell-properties">
+ <!-- cell background color start -->
+ <xsl:variable name="tbl_cell_background_color">
+ <xsl:choose>
+ <xsl:when test="w:shd/@w:fill">
+ <xsl:value-of select="w:shd/@w:fill"/>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblpr/w:shd/@w:fill">
+ <xsl:value-of select="$rootStyleNode/w:tblpr/w:shd/@w:fill"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test=" string-length($tbl_cell_background_color) &gt; 0 and not( $tbl_cell_background_color ='auto' )">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="concat('#',$tbl_cell_background_color)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!--cell background color end -->
+ <!-- table cell vertical alignment start -->
+ <xsl:if test="w:vAlign">
+ <xsl:variable name="tbl_cell_alignment">
+ <xsl:choose>
+ <xsl:when test="w:vAlign/@w:val = 'top' ">
+ <xsl:text>top</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:vAlign/@w:val = 'center' ">
+ <xsl:text>middle</xsl:text>
+ </xsl:when>
+ <xsl:when test="w:vAlign/@w:val = 'bottom' ">
+ <xsl:text>bottom</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>automatic</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="$tbl_cell_alignment"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--table cell alignment end -->
+ <!-- cell margin start -->
+ <xsl:variable name="tblcell_leftmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:left">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:left/@w:w , w:tcMar/w:left/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:left">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_rightmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:right">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:right/@w:w , w:tcMar/w:right/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:right">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_topmargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:top">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:top/@w:w , w:tcMar/w:top/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:top">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="tblcell_bottommargin">
+ <xsl:choose>
+ <xsl:when test="w:tcMar/w:bottom">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat(w:tcMar/w:bottom/@w:w , w:tcMar/w:bottom/@w:type) "/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:bottom">
+ <xsl:call-template name="convert2in_special">
+ <xsl:with-param name="original_value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:type)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="string-length($tblcell_leftmargin) &gt; 0 ">
+ <xsl:attribute name="fo:padding-left">
+ <xsl:value-of select="concat($tblcell_leftmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_rightmargin) &gt; 0">
+ <xsl:attribute name="fo:padding-right">
+ <xsl:value-of select="concat($tblcell_rightmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_topmargin) &gt; 0 ">
+ <xsl:attribute name="fo:padding-top">
+ <xsl:value-of select="concat($tblcell_topmargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($tblcell_bottommargin) &gt; 0">
+ <xsl:attribute name="fo:padding-bottom">
+ <xsl:value-of select="concat($tblcell_bottommargin, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!-- cell margin end -->
+ <xsl:variable name="row-position">
+ <xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:variable>
+ <!-- cell borders should be carefully converted. a little complex. glu :( -->
+ <xsl:variable name="Borders" select="ancestor::w:tbl/w:tblPr/w:tblBorders"/>
+ <xsl:choose>
+ <xsl:when test="$row-position &gt; 1">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:top"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:top"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tr/following-sibling::w:tr) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:bottom"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:bottom"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tc/preceding-sibling::w:tc) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:left"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:left"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(ancestor::w:tc/following-sibling::w:tc) &gt; 0">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+ <xsl:with-param name="style-position-1" select="$Borders/w:right"/>
+ <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:right"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </style:style>
+ </xsl:template>
+ <xsl:template name="get-table-border">
+ <xsl:param name="style-pos"/>
+ <xsl:param name="style-position-0"/>
+ <xsl:param name="style-position-1"/>
+ <xsl:param name="style-position-2"/>
+ <xsl:variable name="size-style">
+ <xsl:choose>
+ <xsl:when test="$style-position-0">
+ <xsl:value-of select="$style-position-0/@w:sz"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1">
+ <xsl:value-of select="$style-position-1/@w:sz"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2">
+ <xsl:value-of select="$style-position-2/@w:sz"/>
+ </xsl:when>
+ <xsl:otherwise>2</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="border-style">
+ <xsl:choose>
+ <xsl:when test="$style-position-0">
+ <xsl:value-of select="$style-position-0/@w:val"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1">
+ <xsl:value-of select="$style-position-1/@w:val"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2">
+ <xsl:value-of select="$style-position-2/@w:val"/>
+ </xsl:when>
+ <xsl:otherwise>single</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="color-border">
+ <xsl:choose>
+ <xsl:when test="$style-position-0 and string-length($style-position-0/@w:color) = 6">
+ <xsl:value-of select="$style-position-0/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-0 and $style-position-0/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:when test="$style-position-1 and string-length($style-position-1/@w:color) = 6">
+ <xsl:value-of select="$style-position-1/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-1 and $style-position-1/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:when test="$style-position-2 and string-length($style-position-2/@w:color) = 6">
+ <xsl:value-of select="$style-position-2/@w:color"/>
+ </xsl:when>
+ <xsl:when test="$style-position-2 and $style-position-2/@w:color = 'auto' and contains($border-style, 'set')">
+ <xsl:text>c0c0c0</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- mapping border line widths. glu -->
+ <xsl:choose>
+ <xsl:when test="$border-style = 'nil' or $border-style = 'none'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">hidden</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$border-style = 'single'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.002cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.035cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.088cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.141cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.176cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'double'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'triple'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 5">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-small-gap' or $border-style = 'thick-thin-small-gap'">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-small-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-small-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-small-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-medium-gap' or $border-style = 'thick-thin-medium-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.212cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-medium-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.039cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.212cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-large-gap' or $border-style = 'thick-thin-large-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$border-style = 'thin-thick-thin-large-gap'">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 5">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'wave') or $border-style = 'dash-dot-stroked'">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.106cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'three-d')">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.035cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 20">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.088cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.176cm solid #', $color-border)"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.265cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="contains( $border-style, 'set')">
+ <xsl:choose>
+ <xsl:when test="$size-style &lt; 7">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 10">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.092cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 15">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.125cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 30">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.178cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="$size-style &lt; 40">
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.159cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.318cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">
+ <xsl:value-of select="concat('0.231cm double #', $color-border)"/>
+ </xsl:attribute>
+ <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{concat('fo:border-', $style-pos)}">0.002cm solid #000000</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:tbl">
+ <xsl:choose>
+ <xsl:when test="w:tblPr/w:tblpPr">
+ <!-- if the table is surrounded by text then put the table into a draw:text-box -->
+ <xsl:element name="text:p">
+ <xsl:element name="draw:frame">
+ <xsl:attribute name="draw:style-name">
+ <xsl:text>TableFrame</xsl:text>
+ <xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="draw:name">TableFr<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_anchor_type">
+ <xsl:choose>
+ <xsl:when test="name(..) = 'w:tc' ">
+ <xsl:text>as-char</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>paragraph</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="text:anchor-type">
+ <xsl:value-of select="$tbl_anchor_type"/>
+ </xsl:attribute>
+ <xsl:variable name="tbl_draw_textbox_width">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <!-- adjust the width of draw:text-box containing a table with 20dxa + table-width -->
+ <xsl:with-param name="value" select="concat(string(number(sum(w:tblGrid/w:gridCol/@w:w) +20)), 'twip' )"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:width">
+ <xsl:value-of select="concat ($tbl_draw_textbox_width, 'in') "/>
+ </xsl:attribute>
+ <xsl:if test="w:tblPr/w:tblpPr/@w:tblpX">
+ <xsl:variable name="x_distance_from_anchor">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpX, 'twip' ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:x">
+ <xsl:value-of select="concat ($x_distance_from_anchor, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tblPr/w:tblpPr/@w:tblpY">
+ <xsl:variable name="y_distance_from_anchor">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpY, 'twip' ) "/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:attribute name="svg:y">
+ <xsl:value-of select="concat ($y_distance_from_anchor, 'in' )"/>
+ </xsl:attribute>
+ </xsl:if>
+ <!--create table in draw:text-box to produce table wrapping text effect-->
+ <xsl:element name="draw:text-box">
+ <xsl:element name="table:table">
+ <xsl:if test="w:tblPr">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:element>
+ </xsl:element>
+ <!--draw:text-box end -->
+ </xsl:element>
+ <!-- text:p end -->
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- if the table is not surrounded by text then put the table into a draw:text-box -->
+ <xsl:element name="table:table">
+ <xsl:if test="w:tblPr">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:tblGrid">
+ <xsl:apply-templates select="w:gridCol"/>
+ </xsl:template>
+ <xsl:template match="w:gridCol">
+ <xsl:element name="table:table-column">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tr">
+ <xsl:element name="table:table-row">
+ <!-- generate row in table and add attribute of table:style-name if the style:style exists. cp tom chen. -->
+ <xsl:if test="w:trPr/w:trHeight">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:tc">
+ <xsl:element name="table:table-cell">
+ <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any" format="1"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single" format="1"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single" format="1"/>
+ </xsl:attribute>
+ <xsl:if test="w:tcPr/w:gridSpan and w:tcPr/w:gridSpan/@w:val &gt; 0">
+ <xsl:attribute name="table:number-columns-spanned">
+ <xsl:value-of select="w:tcPr/w:gridSpan/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="convert2in_special">
+ <!-- this template is specially to deal with w:type ='dxa' situation -->
+ <xsl:param name="orignal_value"/>
+ <xsl:choose>
+ <xsl:when test="contains($orignal_value, 'dxa') ">
+ <xsl:variable name="table_measurement_new_value">
+ <xsl:value-of select="concat( substring-before($orignal_value,'dxa'), 'twip')"/>
+ </xsl:variable>
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="TargetMeasure" select="'in'"/>
+ <xsl:with-param name="value" select="$table_measurement_new_value"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/filter/source/xslt/import/wordml/wordml2ooo_text.xsl b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl
new file mode 100644
index 000000000000..a00656a9ed32
--- /dev/null
+++ b/filter/source/xslt/import/wordml/wordml2ooo_text.xsl
@@ -0,0 +1,1058 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="w wx aml o dt v">
+ <xsl:template name="create-default-paragraph-styles">
+ <xsl:variable name="default-paragraph-style" select="w:style[@w:default = 'on' and @w:type = 'paragraph']"/>
+ <xsl:if test="$default-paragraph-style">
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties>
+ <xsl:attribute name="style:tab-stop-distance">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(/w:wordDocument/w:docPr/w:defaultTabStop/@w:val,'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true">
+ <xsl:choose>
+ <xsl:when test="/w:wordDocument/w:fonts/w:defaultFonts">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:fareast"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:cs"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:sz">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="translate($default-paragraph-style/w:rPr/w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:sz-cs">
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <!-- if not defined default font size in Word, make it out as 10pt. glu -->
+ <xsl:if test="not($default-paragraph-style/w:rPr/w:sz or w:rPr/w:sz-cs)">
+ <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">10pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-complex">10pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang">
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:val">
+ <xsl:attribute name="fo:language">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/ -->
+ </xsl:attribute>
+ <xsl:attribute name="fo:country">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:fareast">
+ <xsl:attribute name="style:language-asian">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="style:country-asian">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')">
+ <xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:fareast"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/ -->
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:bidi">
+ <xsl:attribute name="style:language-complex">
+ <xsl:choose>
+ <xsl:when test="contains( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-') ">
+ <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi "/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="style:country-complex">
+ <xsl:choose>
+ <xsl:when test="contains($default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')">
+ <xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-paragraph-style/w:rPr/w:lang/@w:bidi"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/ -->
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </style:text-properties>
+ </style:default-style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="create-default-text-styles">
+ <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
+ <style:style style:name="Numbering_20_Symbols" style:display-name="Numbering Symbols" style:family="text"/>
+ <style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">
+ <style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/>
+ </style:style>
+ <style:style style:name="Endnote_20_Symbol" style:display-name="Endnote Symbol" style:family="text"/>
+ <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
+ <style:text-properties style:text-position="super 58%"/>
+ </style:style>
+ </xsl:template>
+ <xsl:template match="w:p" mode="style">
+ <xsl:variable name="paragraph-number">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/>
+ <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/>
+ <xsl:variable name="next-section-property" select="following::w:sectPr[1]"/>
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}">
+ <xsl:choose>
+ <xsl:when test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))" />
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:parent-style-name">wNormal</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="not($next-section-property/w:type/@w:val = 'continuous') and generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties>
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ <style:text-properties>
+ <xsl:apply-templates select="w:pPr/w:rPr"/>
+ <xsl:apply-templates select="w:rPr"/>
+ </style:text-properties>
+ </style:style>
+ <xsl:if test="w:r/w:br/@w:type='page'">
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}page-break">
+ <xsl:if test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties fo:break-before="page">
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ </style:style>
+ </xsl:if>
+ <xsl:if test="w:r/w:br/@w:type='column'">
+ <style:style style:family="paragraph" style:name="P{$paragraph-number}column-break">
+ <xsl:if test="w:pPr/w:pStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:pPr/w:pStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr or ancestor::w:tbl)">
+ <xsl:attribute name="style:master-page-name">Standard-1<xsl:value-of select="$section-property-number + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="$paragraph-number = 1">
+ <xsl:attribute name="style:master-page-name">First_20_Page</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <style:paragraph-properties fo:break-before="column">
+ <xsl:apply-templates select="w:pPr"/>
+ </style:paragraph-properties>
+ </style:style>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:pPr">
+ <xsl:if test="w:ind/@w:left">
+ <xsl:attribute name="fo:margin-left">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:left, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:right">
+ <xsl:attribute name="fo:margin-right">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:right, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:first-line">
+ <xsl:attribute name="fo:text-indent">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:ind/@w:first-line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:ind/@w:hanging">
+ <xsl:attribute name="fo:text-indent">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat('-',w:ind/@w:hanging, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <!-- bi-directional support-->
+ <xsl:if test="w:bidi">
+ <xsl:choose>
+ <xsl:when test="w:bidi/@w:val = 'off'">
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:jc">
+ <xsl:choose>
+ <xsl:when test="w:jc/@w:val = 'center'">
+ <xsl:attribute name="fo:text-align">center</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:jc/@w:val = 'left'">
+ <xsl:choose>
+ <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')">
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="w:jc/@w:val = 'right'">
+ <xsl:choose>
+ <xsl:when test="w:bidi and not(w:bidi/@w:val = 'off')">
+ <xsl:attribute name="fo:text-align">start</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fo:text-align">justify</xsl:attribute>
+ <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:spacing">
+ <xsl:choose>
+ <xsl:when test="w:spacing/@w:line-rule = 'at-least'">
+ <xsl:attribute name="style:line-height-at-least">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:spacing/@w:line-rule = 'auto'">
+ <xsl:attribute name="fo:line-height">
+ <xsl:value-of select="round(w:spacing/@w:line div 240 * 100)"/>%</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:spacing/@w:line-rule = 'exact'">
+ <xsl:attribute name="fo:line-height">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:line, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="w:spacing/@w:before">
+ <xsl:attribute name="fo:margin-top">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:before, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:spacing/@w:after">
+ <xsl:attribute name="fo:margin-bottom">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:after, 'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:shd">
+ <xsl:variable name="background-color">
+ <xsl:choose>
+ <xsl:when test="string-length(w:shd/@w:fill) = 6">
+ <xsl:value-of select="concat('#', w:shd/@w:fill)"/>
+ </xsl:when>
+ <xsl:otherwise>#000000</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="w:shd/@w:val = 'solid'">
+ <xsl:attribute name="fo:background-color">
+ <xsl:value-of select="$background-color"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- patterns are necessary in the future. glu -->
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pageBreakBefore and not(w:pageBreakBefore/@w:val = 'off')">
+ <xsl:attribute name="fo:break-before">page</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pageBreakBefore and w:pageBreakBefore/@w:val = 'off'">
+ <xsl:attribute name="fo:break-before">auto</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:keepNext">
+ <xsl:attribute name="fo:keep-with-next">always</xsl:attribute>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:keepLines">
+ <xsl:attribute name="style:break-inside">avoid</xsl:attribute>
+ </xsl:if>
+ -->
+ <xsl:if test="w:widowControl='on'">
+ <xsl:attribute name="fo:widows">2</xsl:attribute>
+ <xsl:attribute name="fo:orphans">2</xsl:attribute>
+ </xsl:if>
+ <!--
+ <xsl:if test="w:suppressAutoHyphens">
+ <xsl:attribute name="fo:hyphenate">false</xsl:attribute>
+ </xsl:if>
+ -->
+ <xsl:if test="w:kinsoku/@w:val='off'">
+ <xsl:attribute name="style:line-break">normal</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:overflowPunct/@w:val='off'">
+ <xsl:attribute name="style:punctuation-wrap">simple</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:autoSpaceDE/@w:val='off' or w:autoSpaceDN/@w:val='off'">
+ <xsl:attribute name="style:text-autospace">none</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:textAlignment">
+ <xsl:choose>
+ <xsl:when test="w:textAlignment/@w:val='center'">
+ <xsl:attribute name="style:vertical-align">middle</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:textAlignment/@w:val='baseline'">
+ <xsl:attribute name="style:vertical-align">bottom</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:vertical-align">
+ <xsl:value-of select="w:textAlignment/@w:val"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:pBdr">
+ <xsl:if test="w:pBdr/w:top">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'top'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:top"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-top">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:top/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:left">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'left'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:left"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-left">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:left/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:right">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'right'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:right"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-right">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:right/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/w:bottom">
+ <xsl:call-template name="get-table-border">
+ <xsl:with-param name="style-pos" select="'bottom'"/>
+ <xsl:with-param name="style-position-0" select="w:pBdr/w:bottom"/>
+ </xsl:call-template>
+ <xsl:attribute name="fo:padding-bottom">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:pBdr/w:bottom/@w:space,'pt')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:pBdr/*/@w:shadow='on'">
+ <xsl:attribute name="style:shadow">#000000 0.15cm 0.15cm</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:snapToGrid/@w:val='off'">
+ <xsl:attribute name="style:snap-to-layout-grid">false</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:tabs">
+ <xsl:element name="style:tab-stops">
+ <xsl:for-each select="w:tabs/w:tab">
+ <xsl:element name="style:tab-stop">
+ <xsl:attribute name="style:position">
+ <xsl:if test="@w:pos &lt; 0">
+ <xsl:message>
+ We meet a negative w:pos:<xsl:value-of select="@w:pos"/>.
+ </xsl:message>
+ <xsl:value-of select="'0cm'"/>
+ </xsl:if>
+ <xsl:if test="not(@w:pos &lt; 0)">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(@w:pos, 'twip')"/>
+ </xsl:call-template>cm</xsl:if>
+ </xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@w:val = 'decimal'">
+ <xsl:attribute name="style:type">char</xsl:attribute>
+ <xsl:attribute name="style:char">
+ <xsl:value-of select="' '"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:val = 'left' or @w:val = 'right' or @w:val = 'center' ">
+ <xsl:attribute name="style:type">
+ <xsl:value-of select="@w:val"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:type">char</xsl:attribute>
+ <xsl:attribute name="style:char">
+ <xsl:value-of select="' '"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- Detect leader chars in tabs (rp) -->
+ <xsl:choose>
+ <xsl:when test="@w:leader = 'hyphen'">
+ <xsl:attribute name="style:leader-style">solid</xsl:attribute>
+ <xsl:attribute name="style:leader-text">-</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:leader = 'underscore'">
+ <xsl:attribute name="style:leader-style">solid</xsl:attribute>
+ <xsl:attribute name="style:leader-text">_</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:leader = 'dot'">
+ <xsl:attribute name="style:leader-style">dotted</xsl:attribute>
+ <xsl:attribute name="style:leader-text">.</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <!-- end leader chars (rp) -->
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:if>
+ <xsl:apply-templates select="w:rPr" mode="paragraph-properties"/>
+ </xsl:template>
+ <xsl:template match="w:rPr" mode="style">
+ <xsl:element name="style:style">
+ <xsl:attribute name="style:name">T<xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:family">text</xsl:attribute>
+ <xsl:if test="w:rStyle">
+ <xsl:attribute name="style:parent-style-name">
+ <xsl:value-of select="concat('w',translate(w:rStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:element name="style:text-properties">
+
+ <xsl:apply-templates select="current()"/>
+<!-- <xsl:call-template name="text-properties"/> -->
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:rPr">
+ <xsl:if test="w:rFonts">
+ <xsl:if test="w:rFonts/@w:ascii">
+ <xsl:attribute name="style:font-name">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:if test="ancestor::w:body">
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="w:rFonts/@w:ascii"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="ancestor::w:styles">
+ <xsl:if test="w:rFonts/@w:fareast">
+ <xsl:attribute name="style:font-name-asian">
+ <xsl:value-of select="w:rFonts/@w:fareast"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:rFonts/@w:cs">
+ <xsl:attribute name="style:font-name-complex">
+ <xsl:value-of select="w:rFonts/@w:cs"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="parent::w:r">
+ <xsl:if test="w:b">
+ <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+ <xsl:attribute name="style:font-weight-asian">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:b-cs">
+ <xsl:attribute name="style:font-weight-complex">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:i">
+ <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+ <xsl:attribute name="style:font-style-asian">italic</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:i-cs">
+ <xsl:attribute name="style:font-style-complex">italic</xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:caps">
+ <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:smallCaps">
+ <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:strike">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:dstrike">
+ <xsl:attribute name="style:text-line-through-style">solid</xsl:attribute>
+ <xsl:attribute name="style:text-line-through-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:outline">
+ <xsl:attribute name="style:text-outline">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:shadow">
+ <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:imprint">
+ <xsl:attribute name="style:font-relief">engraved</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:emboss">
+ <xsl:attribute name="style:font-relief">embossed</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:vanish">
+ <xsl:attribute name="text:display">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:color[not(@w:val = 'auto')]">
+ <xsl:attribute name="fo:color">#<xsl:value-of select="w:color/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:spacing">
+ <xsl:attribute name="fo:letter-spacing">
+ <xsl:call-template name="ConvertMeasure">
+ <xsl:with-param name="value" select="concat(w:spacing/@w:val,'twip')"/>
+ </xsl:call-template>cm</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:w/@w:val">
+ <xsl:attribute name="style:text-scale">
+ <xsl:value-of select="concat(w:w/@w:val, '%')"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:vertAlign or w:position">
+ <xsl:variable name="height">
+ <xsl:choose>
+ <xsl:when test="w:vertAlign[@w:val = 'superscript' or @w:val = 'subscript']">58%</xsl:when>
+ <xsl:otherwise>100%</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="position">
+ <xsl:choose>
+ <xsl:when test="w:position">
+ <!-- con't get font height easily, so just set w:val as percentage. glu -->
+ <xsl:value-of select="concat( w:position/@w:val, '%')"/>
+ </xsl:when>
+ <xsl:when test="w:vertAlign[@w:val = 'superscript']">super</xsl:when>
+ <xsl:when test="w:vertAlign[@w:val = 'subscript']">sub</xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:attribute name="style:text-position">
+ <xsl:value-of select="concat($position, ' ', $height)"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:sz">
+ <xsl:attribute name="fo:font-size">
+ <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ <xsl:attribute name="style:font-size-asian">
+ <xsl:value-of select="translate(w:sz/@w:val,'Na','0') div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:sz-cs">
+ <xsl:attribute name="style:font-size-complex">
+ <xsl:value-of select="w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:highlight">
+ <xsl:choose>
+ <xsl:when test="w:highlight/@w:val='black'">
+ <xsl:attribute name="fo:background-color">#000000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='yellow'">
+ <xsl:attribute name="fo:background-color">#ffff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='green'">
+ <xsl:attribute name="fo:background-color">#00ff00</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='cyan'">
+ <xsl:attribute name="fo:background-color">#00ffff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='magenta'">
+ <xsl:attribute name="fo:background-color">#ff00ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='blue'">
+ <xsl:attribute name="fo:background-color">#0000ff</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='red'">
+ <xsl:attribute name="fo:background-color">#ff0000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-blue'">
+ <xsl:attribute name="fo:background-color">#000080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-cyan'">
+ <xsl:attribute name="fo:background-color">#008080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-green'">
+ <xsl:attribute name="fo:background-color">#008000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-magenta'">
+ <xsl:attribute name="fo:background-color">#800080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-red'">
+ <xsl:attribute name="fo:background-color">#800000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-yellow'">
+ <xsl:attribute name="fo:background-color">#808000</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='dark-gray'">
+ <xsl:attribute name="fo:background-color">#808080</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:highlight/@w:val='light-gray'">
+ <xsl:attribute name="fo:background-color">#c0c0c0</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:u">
+ <xsl:if test="w:u/@w:val = 'thick' or contains(w:u/@w:val,'-heavy')">
+ <xsl:attribute name="style:text-underline-width">bold</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:u/@w:val = 'double' or contains(w:u/@w:val,'-double')">
+ <xsl:attribute name="style:text-underline-type">double</xsl:attribute>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="w:u/@w:val = 'words' or w:u/@w:val = 'single' or w:u/@w:val = 'thick' or w:u/@w:val = 'double'">
+ <xsl:attribute name="style:text-underline-style">solid</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="contains(w:u/@w:val , 'dotted')">
+ <xsl:attribute name="style:text-underline-style">dotted</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dashed-heavy' or w:u/@w:val = 'dash'">
+ <xsl:attribute name="style:text-underline-style">dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-long' or w:u/@w:val = 'dash-long-heavy'">
+ <xsl:attribute name="style:text-underline-style">long-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-dot-heavy' or w:u/@w:val = 'dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'dash-dot-dot-heavy' or w:u/@w:val = 'dot-dot-dash'">
+ <xsl:attribute name="style:text-underline-style">dot-dot-dash</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:u/@w:val = 'wavy-heavy' or w:u/@w:val = 'wavy-double' or w:u/@w:val = 'wavy'">
+ <xsl:attribute name="style:text-underline-style">wave</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="string-length(style:text-underline-style) &gt; 0">
+ <xsl:attribute name="style:text-underline-style">
+ <xsl:value-of select="w:u/@w:val"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="w:u/@w:color and not(w:u/@w:color = 'auto')">
+ <xsl:attribute name="style:text-underline-color">#<xsl:value-of select="w:u/@w:color"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:effect[@w:val = 'blink-background']">
+ <xsl:attribute name="style:text-blinking">true</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="w:shd and not(w:highlight)">
+ <xsl:if test="string-length(w:shd/@w:fill) = 6">
+ <xsl:attribute name="fo:background-color">#<xsl:value-of select="w:shd/@w:fill"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="w:em">
+ <xsl:choose>
+ <xsl:when test="w:em/@w:val = 'comma'">
+ <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:em/@w:val = 'under-dot'">
+ <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:em/@w:val = 'dot' or w:em/@w:val = 'circle' ">
+ <xsl:attribute name="style:text-emphasize">
+ <xsl:value-of select=" concat(w:em/@w:val,' below') "/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="style:text-emphasize">none</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="w:lang">
+ <xsl:if test="w:lang/@w:val">
+ <xsl:attribute name="fo:language">
+ <xsl:choose>
+ <xsl:when test="contains(w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-before( w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ <xsl:attribute name="fo:country">
+ <xsl:choose>
+ <xsl:when test="contains(w:lang/@w:val, '-')">
+ <xsl:value-of select="substring-before( w:lang/@w:val, '-')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="w:lang/@w:val"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!--xsl:value-of select="substring-after( w:lang/@w:val, '-')"/-->
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:rPr" mode="paragraph-properties">
+ <!-- right-to-left support-->
+ <xsl:if test="w:rtl and not(w:rtl/@w:val = 'off')">
+ <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
+ <xsl:attribute name="fo:text-align">end</xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:p">
+ <xsl:choose>
+ <!-- because word treats page breaks as separate tags, we must split some paragraphs up so that we can
+ give the sub para a fo:break-before ="page" or column attribute. -->
+ <xsl:when test="w:r[w:br/@w:type='page' or w:br/@w:type='column']">
+ <xsl:call-template name="process-breaks-in-paragraph"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="process-common-paragraph"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="process-breaks-in-paragraph">
+ <xsl:variable name="textruns-with-break" select="w:r[w:br/@w:type='page' or w:br/@w:type='column']"/>
+ <xsl:call-template name="create-sub-paragraph">
+ <xsl:with-param name="textruns" select="$textruns-with-break[1]/preceding-sibling::w:r"/>
+ </xsl:call-template>
+ <xsl:for-each select="$textruns-with-break">
+ <xsl:variable name="break-position" select="position()"/>
+ <xsl:call-template name="create-sub-paragraph">
+ <!-- added following-sibling::w:fldSimple | following-sibling::w:hlink | following-sibling::aml:annotation to enable these elements to be processed when there are breaks happen G.Yang -->
+ <xsl:with-param name="textruns" select="following-sibling::w:r[not(w:br/@w:type='page' or w:br/@w:type='column') and (count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position)] | following-sibling::w:fldSimple[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::w:hlink[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] | following-sibling::aml:annotation[count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position] "/>
+ <xsl:with-param name="textruns-with-break" select="current()"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:template>
+ <xsl:template name="create-sub-paragraph">
+ <xsl:param name="textruns"/>
+ <xsl:param name="textruns-with-break"/>
+ <xsl:if test="$textruns or $textruns-with-break">
+ <xsl:variable name="curr-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <text:p>
+ <xsl:choose>
+ <xsl:when test="$textruns-with-break">
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat('P',$curr-num,w:br/@w:type, '-break')"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="$textruns-with-break"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat( 'P', $curr-num)"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="$textruns">
+ <xsl:apply-templates select="$textruns"/>
+ </xsl:if>
+ </text:p>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template name="process-common-paragraph">
+ <xsl:variable name="heading-or-paragraph">
+ <xsl:choose>
+ <xsl:when test="key('heading-style', w:pPr/w:pStyle/@w:val)">text:h</xsl:when>
+ <xsl:otherwise>text:p</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{$heading-or-paragraph}">
+ <xsl:if test="$heading-or-paragraph = 'text:h'">
+ <xsl:attribute name="text:outline-level">
+ <xsl:value-of select="key('heading-style',w:pPr/w:pStyle/@w:val)/w:pPr/w:outlineLvl/@w:val + 1"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="curr-num">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat( 'P', $curr-num)"/>
+ </xsl:attribute>
+ <xsl:variable name="bookmark-and-paragraph" select="preceding::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)] | preceding::w:p"/>
+ <xsl:if test="count($bookmark-and-paragraph) &gt; 0 and name($bookmark-and-paragraph[last()]) = 'aml:annotation'">
+ <xsl:call-template name="create-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="count($bookmark-and-paragraph)"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ <xsl:if test="not(following::w:p)">
+ <xsl:apply-templates select="following::aml:annotation[(@w:type = 'Word.Bookmark.Start' or @w:type = 'Word.Bookmark.End') and not(ancestor::w:p)]"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template name="create-bookmark">
+ <xsl:param name="bookmark-and-paragraph"/>
+ <xsl:param name="position"/>
+ <xsl:choose>
+ <xsl:when test="name($bookmark-and-paragraph[$position]) = 'aml:annotation'">
+ <xsl:if test="$position &gt; 0">
+ <xsl:call-template name="create-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position - 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="output-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="output-bookmark">
+ <xsl:param name="bookmark-and-paragraph"/>
+ <xsl:param name="position"/>
+ <xsl:apply-templates select="$bookmark-and-paragraph[$position]"/>
+ <xsl:if test="$position &lt; count($bookmark-and-paragraph)">
+ <xsl:call-template name="output-bookmark">
+ <xsl:with-param name="bookmark-and-paragraph" select="$bookmark-and-paragraph"/>
+ <xsl:with-param name="position" select="$position + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+ <!-- WordML contains multiple w:t within one w:r, so in Star Writer text:span should correspond to w:t glu -->
+ <xsl:template match="w:r">
+ <xsl:choose>
+ <xsl:when test="(preceding-sibling::w:r) or (w:rPr)">
+ <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.-->
+ <xsl:if test="not (preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )">
+ <text:span>
+ <xsl:choose>
+ <xsl:when test="w:rPr/w:rStyle">
+ <xsl:attribute name="text:style-name">
+ <xsl:value-of select="concat('w', translate(w:rPr/w:rStyle/@w:val,' ~`!@#$%^*(&#x26;)+/,;?&lt;&gt;{}[]:','_'))"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="w:rPr">
+ <xsl:variable name="position">
+ <xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr" format="1"/>
+ </xsl:variable>
+ <xsl:attribute name="text:style-name">T<xsl:value-of select="$position + 1"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:span>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- add this condition to prevent from printing the value of DATE, TIME, PRINTDATE, CREATEDATE, SAVEDATE, PAGE, NUMPAGES, etc. fields in-between w:fldchar begin and w:fldchar end G.Yang.-->
+ <xsl:if test="not( preceding-sibling::w:r/w:instrText[substring(normalize-space(.),1,4) = 'DATE' or substring(normalize-space(.),1,4) = 'TIME' or substring(normalize-space(.),1,9) = 'PRINTDATE' or substring(normalize-space(.),1,10) = 'CREATEDATE' or substring(normalize-space(.),1,8) = 'SAVEDATE' or substring(normalize-space(.),1,4) = 'PAGE' or substring(normalize-space(.),1,8) = 'NUMPAGES' or substring(normalize-space(.),1,8) = 'NUMWORDS' or substring(normalize-space(.),1,8) = 'NUMCHARS' or substring(normalize-space(.),1,6) = 'REVNUM' or substring(normalize-space(.),1,7) = 'AUTONUM' or substring(normalize-space(.),1,10) = 'AUTONUMLGL' or substring(normalize-space(.),1,10) = 'AUTONUMOUT' or substring(normalize-space(.),1,3) = 'SEQ' or substring(normalize-space(.),1,6) = 'AUTHOR' or substring(normalize-space(.),1,5) = 'TITLE' or substring(normalize-space(.),1,7) = 'SUBJECT' or substring(normalize-space(.),1,8) = 'KEYWORDS' or substring(normalize-space(.),1,6) = 'FILLIN' or substring(normalize-space(.),1,11) = 'DOCPROPERTY' or substring(normalize-space(.),1,10) = 'MERGEFIELD' or substring(normalize-space(.),1,8) = 'MERGEREC' or substring(normalize-space(.),1,4) = 'NEXT' or substring( normalize-space(.),1,9) = 'HYPERLINK' or substring( normalize-space(.),1,3) = 'REF' ][1] and (following-sibling::w:r/w:fldChar[@w:fldCharType='end'] or ( not(preceding-sibling::w:r/w:fldChar[@w:fldCharType='end'] ) and parent::w:p/following-sibling::w:p/w:r/w:fldChar[@w:fldCharType='end'])) )">
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="aml:annotation">
+ <xsl:choose>
+ <xsl:when test="@w:type = 'Word.Bookmark.Start'">
+ <text:bookmark-start text:name="{@w:name}"/>
+ </xsl:when>
+ <xsl:when test="@w:type = 'Word.Bookmark.End'">
+ <xsl:variable name="id" select="@aml:id"/>
+ <text:bookmark-end text:name="{preceding::aml:annotation[@aml:id = $id]/@w:name}"/>
+ </xsl:when>
+ <xsl:when test="@w:type = 'Word.Comment'">
+ <office:annotation office:display="true">
+ <dc:creator>
+ <xsl:value-of select="@aml:author"/>
+ </dc:creator>
+ <dc:date>
+ <xsl:value-of select="substring(@aml:createdate,1,10)"/>
+ </dc:date>
+ <xsl:apply-templates select="aml:content/w:p"/>
+ </office:annotation>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="w:hlink">
+ <xsl:element name="text:a">
+ <xsl:attribute name="xlink:type">simple</xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="@w:dest and @w:bookmark">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="concat( @w:dest, concat('#', @w:bookmark) )"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:dest">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="@w:dest"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:when test="@w:bookmark">
+ <xsl:attribute name="xlink:href">
+ <xsl:value-of select="concat('#', @w:bookmark)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="@w:target">
+ <xsl:attribute name="office:target-frame-name">
+ <xsl:value-of select="@w:target"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates mode="dispatch"/>
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="w:t">
+ <xsl:choose>
+ <xsl:when test="string(.) = ' ' ">
+ <xsl:element name="text:s"/>
+ </xsl:when>
+ <xsl:when test="contains(.,' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template name="replace-spaces">
+ <xsl:param name="curr-string"/>
+ <xsl:if test="contains($curr-string,' ')">
+ <xsl:value-of select="substring-before($curr-string,' ')"/>
+ <text:s text:c="2"/>
+ <xsl:variable name="next-string" select="substring-after($curr-string,' ')"/>
+ <xsl:choose>
+ <xsl:when test="contains($next-string, ' ')">
+ <xsl:call-template name="replace-spaces">
+ <xsl:with-param name="curr-string" select="$next-string"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$next-string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:tab">
+ <xsl:element name="text:tab"/>
+ </xsl:template>
+ <xsl:template match="w:br">
+ <xsl:if test="@w:type='text-wrapping' or not(@w:type)">
+ <text:line-break/>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="w:footnote">
+ <xsl:variable name="footnote-position">
+ <xsl:number from="/w:wordDocument/w:body" count="w:footnote" level="any"/>
+ </xsl:variable>
+ <text:note text:note-class="footnote" text:id="ftn{$footnote-position}">
+ <text:note-citation/>
+ <text:note-body>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:note-body>
+ </text:note>
+ </xsl:template>
+ <xsl:template match="w:endnote">
+ <xsl:variable name="endnote-position">
+ <xsl:number from="/w:wordDocument/w:body" count="w:endnote" level="any" format="1"/>
+ </xsl:variable>
+ <text:endnote text:id="edn{$endnote-position}">
+ <text:endnote-body>
+ <xsl:apply-templates mode="dispatch"/>
+ </text:endnote-body>
+ </text:endnote>
+ </xsl:template>
+</xsl:stylesheet>