diff options
Diffstat (limited to 'filter/source/xslt/export/wordml')
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml.xsl | 209 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_border.xsl | 144 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl | 275 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_draw.xsl | 1760 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_field.xsl | 726 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_list.xsl | 349 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_page.xsl | 392 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_path.xsl | 849 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_settings.xsl | 308 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_table.xsl | 407 | ||||
-rw-r--r-- | filter/source/xslt/export/wordml/ooo2wordml_text.xsl | 1270 |
11 files changed, 6689 insertions, 0 deletions
diff --git a/filter/source/xslt/export/wordml/ooo2wordml.xsl b/filter/source/xslt/export/wordml/ooo2wordml.xsl new file mode 100644 index 000000000..6cebb3ca5 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml.xsl @@ -0,0 +1,209 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0" standalone="yes"/> + <xsl:include href="../../common/measure_conversion.xsl"/> + <xsl:include href="../common/ooo2ms_docpr.xsl"/> + <xsl:include href="ooo2wordml_settings.xsl"/> + <xsl:include href="ooo2wordml_border.xsl"/> + <xsl:include href="ooo2wordml_page.xsl"/> + <xsl:include href="ooo2wordml_text.xsl"/> + <xsl:include href="ooo2wordml_list.xsl"/> + <xsl:include href="ooo2wordml_field.xsl"/> + <xsl:include href="ooo2wordml_table.xsl"/> + <xsl:include href="ooo2wordml_draw.xsl"/> + <xsl:include href="ooo2wordml_path.xsl"/> + <xsl:key name="paragraph-style" match="style:style[@style:family='paragraph']" use="@style:name"/> + <xsl:key name="text-style" match="style:style[@style:family='text']" use="@style:name"/> + <xsl:key name="section-style" match="style:style[@style:family='section']" use="@style:name"/> + <xsl:key name="master-page" match="style:master-page" use="@style:name"/> + <xsl:key name="page-layout" match="style:page-layout" use="@style:name"/> + <xsl:key name="slave-style" match="style:style[string-length(normalize-space(@style:master-page-name)) > 0]" use="@style:name"/> + <xsl:key name="list-style" match="office:styles/text:list-style | office:automatic-styles/text:list-style" use="@style:name"/> + <xsl:key name="graphics-style" match="style:style[@style:family='graphic']" use="@style:name"/> + <xsl:template match="/"> + <xsl:apply-templates select="office:document"/> + </xsl:template> + <xsl:template match="office:document"> + <xsl:processing-instruction name="mso-application">progid="Word.Document"</xsl:processing-instruction> + <xsl:variable name="embeddedObjPresent"> + <xsl:choose> + <xsl:when test="//draw:object-ole[1]">yes</xsl:when> + <xsl:otherwise>no</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:wordDocument xml:space="preserve" w:embeddedObjPresent="{$embeddedObjPresent}"> + <xsl:apply-templates select="office:meta"/> + <xsl:apply-templates select="office:font-face-decls"/> + <xsl:if test="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style"> + <xsl:call-template name="ListStyles"/> + </xsl:if> + <w:styles> + <xsl:apply-templates select="office:styles"/> + <xsl:apply-templates select="office:automatic-styles"/> + <xsl:call-template name="add_hyperlink_style"/> + <!--add for hyperlink character style G.Y.--> + <xsl:call-template name="add_comments_style"/> + <!--add for comments style G.Y.--> + </w:styles> + <xsl:call-template name="export-oledata"/> + <xsl:apply-templates select="office:settings"/> + <xsl:apply-templates select="office:body"/> + </w:wordDocument> + </xsl:template> + <xsl:template match="office:body"> + <xsl:call-template name="page-background"/> + <xsl:apply-templates select="office:text"/> + </xsl:template> + <xsl:template match="office:font-face-decls"> + <!-- get default font from default paragraph properties --> + <w:fonts> + <xsl:variable name="default-paragraph-properties" select="/office:document/office:styles/style:default-style[@style:family = 'paragraph']/style:paragraph-properties"/> + <w:defaultFonts w:ascii="{$default-paragraph-properties/@style:font-name}" w:h-ansi="{$default-paragraph-properties/@style:font-name}" w:fareast="{$default-paragraph-properties/@style:font-name-asian}" w:cs="{$default-paragraph-properties/@style:font-name-complex}"/> + <xsl:for-each select="style:font-face"> + <w:font w:name="{@style:name}"> + <xsl:if test="@style:font-charset = 'x-symbol'"> + <w:charset w:val="02"/> + </xsl:if> + <xsl:choose> + <xsl:when test="@style:font-family-generic = 'swiss'"> + <w:family w:val="Swiss"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'modern'"> + <w:family w:val="Modern"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'roman'"> + <w:family w:val="Roman"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'script'"> + <w:family w:val="Script"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'decorative'"> + <w:family w:val="Decorative"/> + </xsl:when> + <xsl:when test="@style:font-family-generic = 'system'"> + <w:family w:val="System"/> + </xsl:when> + <xsl:otherwise> + <w:family w:val="System"/> + </xsl:otherwise> + </xsl:choose> + <w:pitch w:val="{@style:font-pitch}"/> + </w:font> + </xsl:for-each> + </w:fonts> + </xsl:template> + <xsl:template match="office:styles | office:automatic-styles"> + <xsl:for-each select="*[(name()='style:style' or name()='style:default-style') and (@style:family= 'paragraph' or @style:family= 'text' or @style:family='table')]"> + <xsl:variable name="style-name"> + <xsl:choose> + <xsl:when test="name() = 'style:default-style'"> + <xsl:value-of select="concat('default-', @style:family, '-style')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style:name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:style w:styleId="{$style-name}"> + <xsl:choose> + <xsl:when test="@style:family = 'paragraph'"> + <xsl:attribute name="w:type">paragraph</xsl:attribute> + </xsl:when> + <xsl:when test="@style:family = 'text'"> + <xsl:attribute name="w:type">character</xsl:attribute> + </xsl:when> + <xsl:when test="@style:family = 'table'"> + <xsl:attribute name="w:type">table</xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="name() = 'style:default-style'"> + <xsl:attribute name="w:default">on</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="@style:parent-style-name"> + <w:basedOn w:val="{@style:parent-style-name}"/> + </xsl:when> + <xsl:when test="name() = 'style:style' and @style:family= 'paragraph'"> + <w:basedOn w:val="{concat('default-', @style:family, '-style')}"/> + </xsl:when> + </xsl:choose> + <w:name w:val="{$style-name}"/> + <xsl:if test="parent::office:automatic-styles"> + <w:hidden w:val="on"/> + </xsl:if> + <xsl:if test="@style:next-style-name"> + <w:next w:val="{@style:next-style-name}"/> + </xsl:if> + <xsl:choose> + <xsl:when test="@style:family = 'paragraph'"> + <xsl:apply-templates select="style:paragraph-properties" mode="paragraph"/> + </xsl:when> + <xsl:when test="@style:family = 'table'"> + <w:tblPr> + <xsl:apply-templates select="style:table-properties" mode="table"/> + </w:tblPr> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="style:text-properties" mode="character"/> + </w:style> + </xsl:for-each> + </xsl:template> + <xsl:template match="office:text"> + <w:body> + <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list |table:table"/> + <xsl:variable name="paragraph-heading-table" select=".//*[name() = 'text:p' or name() = 'text:h' or name() = 'table:table']"/> + <xsl:variable name="page" select="$paragraph-heading-table[key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/> + <w:sectPr> + <!--w:type w:val="continuous"/ --> + <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:choose> + <xsl:when test="count($page) > 0"> + <xsl:apply-templates select="key('master-page', key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/@style:master-page-name)"/> + <xsl:if test="key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"> + <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page --> + <xsl:variable name="pagenumber_start"> + <xsl:value-of select=" key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/> + </xsl:variable> + <xsl:if test=" number($pagenumber_start) > 0 "> + <w:pgNumType w:start="{$pagenumber_start}"/> + </xsl:if> + <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 --> + <!-- w:pgNumType w:start="{key( 'slave-style', $page[last()]/@*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/--> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$paragraph-heading-table[last()]/ancestor::text:section"> + <xsl:apply-templates select="key('section-style',$paragraph-heading-table[last()]/ancestor::text:section[1]/@text:style-name)" mode="section"/> + </xsl:if> + </w:sectPr> + </w:body> + </xsl:template> + <xsl:template match="text:section"> + <xsl:apply-templates select="text:p | text:h | text:section | text:unordered-list | text:ordered-list | text:list | table:table"/> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_border.xsl b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl new file mode 100644 index 000000000..9ca50dc64 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_border.xsl @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <!-- multiple usage: get size, type, color of table-cell, paragraph, and page borders. --> + <xsl:template name="get-border-size"> + <xsl:param name="border"/> + <xsl:param name="border-line-width"/> + <xsl:choose> + <xsl:when test="$border = 'none' or $border = 'hidden'"> + <xsl:text>none;0</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="border-value"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="$border"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="border-style"> + <xsl:choose> + <xsl:when test="contains($border,'solid')">solid</xsl:when> + <xsl:when test="contains($border,'double')">double</xsl:when> + <xsl:otherwise>none</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- MS word and SO writer borders Mapping + MS word Borders SO borders + w:val="single" w:sz="0" 0.05pt(0.002cm);solid + w:val="single" w:sz="12" 1.00pt(0.035cm);solid + w:val="single" w:sz="18" 2.50pt(0.088cm);solid + w:val="single" w:sz="36" 4.00pt(0.141cm);solid + w:val="single" w:sz="48" 5.00pt(0.176cm);solid + w:val="double" w:sz="2" 1.10pt(0.039cm);double + w:val="double" w:sz="6" 2.60pt(0.092cm);double + w:val="thin-thick-small-gap" w:sz="12" 3.00pt(0.105cm);double + w:val="thin-thick-large-gap" w:sz="18" 3.55pt(0.125cm);double + w:val="thick-thin-medium-gap" w:sz="24" 4.50pt(0.158cm);double + w:val="thin-thick-medium-gap" w:sz="24" 5.05pt(0.178cm);double + w:val="thin-thick-small-gap" w:sz="24" 6.00pt(0.211cm);double + w:val="thin-thick-medium-gap" w:sz="36" 6.55pt(0.231cm);double + w:val="double" w:sz="18" 7.50pt(0.264cm);double + w:val="thin-thick-medium-gap" w:sz="48" 9.00pt(0.317cm);double;style:border-line-width="0.088cm 0.088cm 0.141cm" + w:val="double" w:sz="24" 9.00pt(0.317cm);double;style:border-line-width="0.141cm 0.088cm 0.088cm" + we adjust the criteria by adding about 1/2 range of this current criteria and next criteria. Gary. Yang --> + <xsl:variable name="microsoft-border-style-size"> + <xsl:choose> + <xsl:when test=" $border-style = 'solid'"> + <xsl:choose> + <xsl:when test="$border-value <= 0.018">single;0</xsl:when> + <xsl:when test="$border-value <= 0.055">single;12</xsl:when> + <xsl:when test="$border-value <= 0.110">single;18</xsl:when> + <xsl:when test="$border-value <= 0.155">single;36</xsl:when> + <xsl:when test="$border-value <= 0.198">single;48</xsl:when> + <xsl:otherwise>single;48</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$border-style = 'double'"> + <xsl:choose> + <xsl:when test="$border-value < 0.064">double;2</xsl:when> + <xsl:when test="$border-value < 0.098">double;6</xsl:when> + <xsl:when test="$border-value < 0.115">thin-thick-small-gap;12</xsl:when> + <xsl:when test="$border-value < 0.135">thin-thick-large-gap;18</xsl:when> + <xsl:when test="$border-value < 0.168">thick-thin-medium-gap;24</xsl:when> + <xsl:when test="$border-value < 0.190">thin-thick-medium-gap;24</xsl:when> + <xsl:when test="$border-value < 0.221">thin-thick-small-gap;24</xsl:when> + <xsl:when test="$border-value < 0.241">thin-thick-medium-gap;36</xsl:when> + <xsl:when test="$border-value < 0.300">double;18</xsl:when> + <xsl:when test="$border-value < 0.430"> + <xsl:variable name="border-inner-line-value"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="$border-line-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$border-inner-line-value < 0.10">thin-thick-medium-gap;48</xsl:if> + <xsl:if test="$border-inner-line-value > 0.10">double;24</xsl:if> + </xsl:when> + <xsl:otherwise>double;24</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>none;0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$microsoft-border-style-size"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- get bottom and right border style, size, color --> + <xsl:template name="get-border"> + <xsl:param name="so-border"/> + <xsl:param name="so-border-line-width"/> + <xsl:param name="so-border-position"/> + <xsl:variable name="ms-style-width"> + <xsl:call-template name="get-border-size"> + <xsl:with-param name="border" select="$so-border"/> + <xsl:with-param name="border-line-width" select="$so-border-line-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$so-border-position = 'bottom' or $so-border-position = 'right'"> + <!-- if border style is bottom or right border we need to change the thin-thick to thick-thin; Vice Versa --> + <xsl:choose> + <xsl:when test="substring-before($ms-style-width, '-')='thin'"> + <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thick-thin', substring-after(substring-before($ms-style-width, ';'), 'k' ))"/></xsl:attribute> + </xsl:when> + <xsl:when test="substring-before($ms-style-width, '-')='thick'"> + <xsl:attribute name="w:val"><xsl:value-of select="concat( 'thin-thick', substring-after(substring-before($ms-style-width, ';'), 'n' ))"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width, ';')"/></xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute> + </xsl:when> + <xsl:when test="$so-border-position = 'top' or $so-border-position = 'left'"> + <xsl:attribute name="w:val"><xsl:value-of select="substring-before($ms-style-width,';')"/></xsl:attribute> + <xsl:attribute name="w:sz"><xsl:value-of select="substring-after($ms-style-width,';')"/></xsl:attribute> + </xsl:when> + </xsl:choose> + <!--get border color --> + <xsl:choose> + <xsl:when test="contains($so-border,'#')"> + <xsl:attribute name="w:color"><xsl:value-of select="substring-after($so-border, '#')"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:color">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl new file mode 100644 index 000000000..923b19a9e --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_custom_draw.xsl @@ -0,0 +1,275 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template name="ooo_custom_draw2ms_word_draw_map"> + <xsl:param name="ooo_predefined_type"/> + <!-- all ooo draw names are get from EnhancedCustomShapeGeometry.idl--> + <xsl:choose> + <xsl:when test="$ooo_predefined_type = 'isosceles-triangle' "> + <xsl:value-of select=" '#_x0000_t5' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-triangle' "> + <xsl:value-of select=" '#_x0000_t6' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'trapezoid' "> + <xsl:value-of select=" '#_x0000_t8' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'diamond' "> + <xsl:value-of select=" '#_x0000_t4' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'hexagon' "> + <xsl:value-of select=" '#_x0000_t9' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'parallelogram' "> + <xsl:value-of select=" '#_x0000_t7' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'pentagon' "> + <xsl:value-of select=" '#_x0000_t56' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'octagon' "> + <xsl:value-of select=" '#_x0000_t10' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'cross' "> + <xsl:value-of select=" '#_x0000_t11' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'ring' "> + <xsl:value-of select=" '#_x0000_t23' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'block-arc' "> + <xsl:value-of select=" '#_x0000_t95' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'can' "> + <xsl:value-of select=" '#_x0000_t22' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'cube' "> + <xsl:value-of select=" '#_x0000_t16' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'paper' "> + <xsl:value-of select=" '#_x0000_t65' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'smiley' "> + <xsl:value-of select=" '#_x0000_t96' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'sun' "> + <xsl:value-of select=" '#_x0000_t183' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'moon' "> + <xsl:value-of select=" '#_x0000_t184' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'heart' "> + <xsl:value-of select=" '#_x0000_t74' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'forbidden' "> + <xsl:value-of select=" '#_x0000_t57' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-bracket' "> + <xsl:value-of select=" '#_x0000_t85' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-bracket' "> + <xsl:value-of select=" '#_x0000_t86' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-brace' "> + <xsl:value-of select=" '#_x0000_t87' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-brace' "> + <xsl:value-of select=" '#_x0000_t88' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'bracket-pair' "> + <xsl:value-of select=" '#_x0000_t185' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'brace-pair' "> + <xsl:value-of select=" '#_x0000_t186' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'quad-bevel' "> + <xsl:value-of select=" '#_x0000_t189' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-arrow' "> + <xsl:value-of select=" '#_x0000_t66' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'down-arrow' "> + <xsl:value-of select=" '#_x0000_t67' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-arrow' "> + <xsl:value-of select=" '#_x0000_t68' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'right-arrow' "> + <xsl:value-of select=" '#_x0000_t13' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'left-right-arrow' "> + <xsl:value-of select=" '#_x0000_t69' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-down-arrow' "> + <xsl:value-of select=" '#_x0000_t70' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'mso-spt89' "> + <xsl:value-of select=" '#_x0000_t89' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'quad-arrow' "> + <xsl:value-of select=" '#_x0000_t76' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'notched-right-arrow' "> + <xsl:value-of select=" '#_x0000_t94' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'pentagon-right' "> + <xsl:value-of select=" '#_x0000_t177' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'chevron' "> + <xsl:value-of select=" '#_x0000_t55' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-arrow-callout' "> + <xsl:value-of select=" '#_x0000_t79' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'down-arrow-callout' "> + <xsl:value-of select=" '#_x0000_t80' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'up-down-arrow-callout' "> + <xsl:value-of select=" '#_x0000_t82' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'circular-arrow' "> + <xsl:value-of select=" '#_x0000_t103' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-process' "> + <xsl:value-of select=" '#_x0000_t109' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-alternate-process' "> + <xsl:value-of select=" '#_x0000_t116' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-decision' "> + <xsl:value-of select=" '#_x0000_t110' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-data' "> + <xsl:value-of select=" '#_x0000_t111' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-predefined-process' "> + <xsl:value-of select=" '#_x0000_t112' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-internal-storage' "> + <xsl:value-of select=" '#_x0000_t113' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-document' "> + <xsl:value-of select=" '#_x0000_t114' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-multidocument' "> + <xsl:value-of select=" '#_x0000_t115' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-terminator' "> + <xsl:value-of select=" '#_x0000_t116' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-preparation' "> + <xsl:value-of select=" '#_x0000_t117' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-manual-input' "> + <xsl:value-of select=" '#_x0000_t118' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-manual-operation' "> + <xsl:value-of select=" '#_x0000_t119' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-connector' "> + <xsl:value-of select=" '#_x0000_t120' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-off-page-connector' "> + <xsl:value-of select=" '#_x0000_t177' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-card' "> + <xsl:value-of select=" '#_x0000_t121' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-punched-tape' "> + <xsl:value-of select=" '#_x0000_t122' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-summing-junction' "> + <xsl:value-of select=" '#_x0000_t123' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-or' "> + <xsl:value-of select=" '#_x0000_t124' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-collate' "> + <xsl:value-of select=" '#_x0000_t125' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-sort' "> + <xsl:value-of select=" '#_x0000_t126' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-extract' "> + <xsl:value-of select=" '#_x0000_t127' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-merge' "> + <xsl:value-of select=" '#_x0000_t128' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-stored-data' "> + <xsl:value-of select=" '#_x0000_t130' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-delay' "> + <xsl:value-of select=" '#_x0000_t135' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-sequential-access' "> + <xsl:value-of select=" '#_x0000_t131' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-magnetic-disk' "> + <xsl:value-of select=" '#_x0000_t132' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-direct-access-storage' "> + <xsl:value-of select=" '#_x0000_t133' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'flowchart-display' "> + <xsl:value-of select=" '#_x0000_t134' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'rectangular-callout' "> + <xsl:value-of select=" '#_x0000_t61' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'round-rectangular-callout' "> + <xsl:value-of select=" '#_x0000_t62' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'round-callout' "> + <xsl:value-of select=" '#_x0000_t63' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'cloud-callout' "> + <xsl:value-of select=" '#_x0000_t106' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'line-callout-1' "> + <xsl:value-of select=" '#_x0000_t50' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'line-callout-2' "> + <xsl:value-of select=" '#_x0000_t51' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'line-callout-3' "> + <xsl:value-of select=" '#_x0000_t47' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'bang' "> + <xsl:value-of select=" '#_x0000_t72' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star4' "> + <xsl:value-of select=" '#_x0000_t187' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star5' "> + <xsl:value-of select=" '#_x0000_t12' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star8' "> + <xsl:value-of select=" '#_x0000_t58' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'star24' "> + <xsl:value-of select=" '#_x0000_t92' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'vertical-scroll' "> + <xsl:value-of select=" '#_x0000_t97' "/> + </xsl:when> + <xsl:when test="$ooo_predefined_type = 'horizontal-scroll' "> + <xsl:value-of select=" '#_x0000_t98' "/> + </xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl new file mode 100644 index 000000000..1e68ffe38 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_draw.xsl @@ -0,0 +1,1760 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:ole="http://libreoffice.org/2011/xslt/ole" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow ole"> + <xsl:include href="ooo2wordml_custom_draw.xsl"/> + + <xsl:key name="stroke-dash-style" match="draw:stroke-dash" use="@draw:name"/> + <xsl:key name="fill-image" match="draw:fill-image" use="@draw:name"/> + <xsl:key name="draw-gradient" match="draw:gradient " use="@draw:name"/> + <xsl:template name="PageLevelGraphic"> + <xsl:for-each select="//draw:*[@text:anchor-type='page']"> + <xsl:apply-templates select="."/> + </xsl:for-each> + </xsl:template> + <xsl:template match="draw:*"> + <xsl:param name="TargetMeasure" select="'pt'"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:param name="force-draw" select="'false'"/> + <xsl:variable name="MeasureMark"> + <xsl:choose> + <xsl:when test="$TargetMeasure = 'twip'"/> + <xsl:otherwise> + <xsl:value-of select="$TargetMeasure"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <!-- + deal with captions and frames first. draw:text-box is a powerful element in OOo, its GUI name is frame. And OOo use it to contain Captions + Since there is not a corresponding object in word, so we draw the text-box itself and its children separately. If it look like a Caption only frame + we'll adjust the text-box position to make it look pretty + --> + <!-- skip all not force draw children , must be first case --> + <xsl:when test="ancestor::draw:text-box and $force-draw='false' "/> + <xsl:when test="name() = 'draw:text-box'"> + <!-- draw the text-box itself --> + <w:r> + <w:pict> + <xsl:variable name="text-y-adjust"> + <xsl:choose> + <xsl:when test="count(text:p/draw:*) = 1 and (string-length(text:p/draw:*[position()=1]/@svg:x) =0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0) and (string-length(text:p/draw:*[position()=1]/@svg:y)=0 or number(concat('0',translate(text:p/draw:*[position()=1]/@svg:x,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))=0 ) "> + <xsl:variable name="pic-height"> + <xsl:choose> + <xsl:when test="name(text:p/draw:*[position()=1]) = 'draw:g' or name(text:p/draw:*[position()=1]) = 'draw:a'"> + <xsl:variable name="BigestWindow"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="text:p/draw:*[position()=1]/draw:*"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')) + number(concat('0',translate($y-adjust,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','')))"/> + </xsl:when> + <xsl:when test="text:p/draw:*[position()=1]/@svg:height"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@svg:height"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="text:p/draw:*[position()=1]/@fo:min-height"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="text:p/draw:*[position()=1]/@fo:min-height"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="ancestor::draw:frame"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="ancestor::draw:frame/@svg:height"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min-height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'in'"/> + <xsl:with-param name="value" select="@fo:min-height"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$min-height - $pic-height < 0.001"> + <!-- If control goes here, it much like that this text-box is used for contain graphic caption only --> + <xsl:value-of select="$pic-height - 0.1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="shape-type"> + <xsl:choose> + <xsl:when test="$text-y-adjust = $y-adjust"> + <xsl:value-of select="'#_x0000_t202'"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="DrawElements"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$text-y-adjust"/> + <xsl:with-param name="force-draw" select="'true'"/> + <xsl:with-param name="shape-type" select="$shape-type"/> + </xsl:call-template> + </w:pict> + </w:r> + <!-- draw the real object first --> + <xsl:if test="./text:p/draw:*"> + <xsl:apply-templates select="./text:p/draw:*"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="@svg:x"/> + <xsl:with-param name="value2" select="$x-adjust"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="y-adjust"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="@svg:y"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="force-draw" select="'true'"/> + </xsl:apply-templates> + </xsl:if> + </xsl:when> + <!-- end deal with captions and frames --> + <xsl:when test=" name() = 'draw:frame' "> + <xsl:variable name="BigestWindow"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="."/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:apply-templates select="draw:* "> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> + <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="name() = 'draw:g'"> + <w:r> + <w:pict> + <xsl:element name="v:group"> + <xsl:variable name="BigestWindow"> + <xsl:choose> + <xsl:when test="name() = 'draw:g'"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="draw:*"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'draw:frame'"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="."/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="y"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(number(substring-after(substring-before($BigestWindow,';y2'), 'x2:')) - number(substring-after(substring-before($BigestWindow,';y1'), 'x1:')) , 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat(number(substring-after($BigestWindow,'y2:')) - number(substring-after(substring-before($BigestWindow,';x2'), 'y1:')), 'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="id"> + <xsl:value-of select="generate-id()"/> + </xsl:attribute> + <xsl:variable name="absolute"> + <xsl:choose> + <xsl:when test="ancestor::draw:a"/> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/> + <xsl:otherwise>position:absolute</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$TargetMeasure= 'pt'"> + <xsl:attribute name="style"> + <xsl:if test="string-length($absolute) > 0"> + <xsl:value-of select="concat($absolute, ';')"/> + </xsl:if> + <xsl:value-of select="concat('margin-left:',$x ,$MeasureMark,';margin-top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/> + </xsl:attribute> + <xsl:attribute name="coordorigin"> + <xsl:choose> + <!-- if we are in a text-box then oo will use comparative positions on us--> + <xsl:when test="name() = 'draw:frame' "> + <xsl:value-of select=" '0 0' "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat(round($x * 20), ',' , round($y * 20))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="coordsize"> + <xsl:value-of select="concat(round($width * 20),',', round($height * 20) )"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="$TargetMeasure= 'twip' "> + <xsl:attribute name="style"> + <xsl:if test="string-length($absolute) > 0"> + <xsl:value-of select="concat($absolute, ';')"/> + </xsl:if> + <xsl:value-of select="concat('left:',$x ,$MeasureMark,';top:', $y,$MeasureMark ,';width:', $width ,$MeasureMark , ';height:', $height,$MeasureMark)"/> + </xsl:attribute> + <xsl:attribute name="coordorigin"> + <xsl:choose> + <!-- if we are in a text-box then oo will use comparative positions on us--> + <xsl:when test="name() = 'draw:frame' "> + <xsl:value-of select=" '0 0' "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($x , ',' , $y)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="coordsize"> + <xsl:value-of select="concat($width,',', $height )"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <!-- if we are in a text-box then oo will use comparative positions on us--> + <xsl:when test="ancestor::draw:text-box"> + <xsl:apply-templates select="draw:*"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="x-adjust" select="concat(substring-after(substring-before($BigestWindow,';y1'), 'x1:'), 'in')"/> + <xsl:with-param name="y-adjust" select="concat(substring-after(substring-before($BigestWindow,';x2'), 'y1:') , 'in')"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="draw:*"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </w:pict> + </w:r> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="name() = 'draw:a'"> + <xsl:call-template name="export_hyoerlink"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <w:r> + <w:pict> + <xsl:call-template name="DrawElements"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:call-template> + </w:pict> + </w:r> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetWindowSize"> + <xsl:param name="CurrPos" select="1"/> + <xsl:param name="nodeSet"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:variable name="CurrNodeWindow"> + <xsl:call-template name="GetNodeWindow"> + <xsl:with-param name="CurrNode" select=" $nodeSet[ $CurrPos ]"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <!-- if we got to the last node, return it directly, or return the max window of current one and following ones --> + <xsl:when test="$CurrPos = count($nodeSet)"> + <xsl:value-of select="$CurrNodeWindow"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="CurrentWindow"> + <xsl:variable name="FollowingWindow"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="$nodeSet"/> + <xsl:with-param name="CurrPos" select="$CurrPos + 1"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="GetBigestWindows"> + <xsl:with-param name="Window1" select="$CurrNodeWindow"/> + <xsl:with-param name="Window2" select="$FollowingWindow"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$CurrentWindow"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetNodeWindow"> + <xsl:param name="CurrNode"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:choose> + <xsl:when test="name($CurrNode)='draw:g'"> + <xsl:call-template name="GetWindowSize"> + <xsl:with-param name="nodeSet" select="$CurrNode/draw:*"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="x"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="$CurrNode/@svg:x"/> + <xsl:with-param name="value2" select="$x-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="y"> + <xsl:call-template name="Add-With-Measure"> + <xsl:with-param name="value1" select="$CurrNode/@svg:y"/> + <xsl:with-param name="value2" select="$y-adjust"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="width"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$CurrNode/@svg:width"/> + <xsl:with-param name="TargetMeasure" select="'in'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height"> + <xsl:choose> + <xsl:when test="$CurrNode/@svg:height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$CurrNode/@svg:height"/> + <xsl:with-param name="TargetMeasure" select="'in'"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$CurrNode/@fo:min-height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="$CurrNode/@fo:min-height"/> + <xsl:with-param name="TargetMeasure" select="'in'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('x1:' , $x, ';y1:' , $y, ';x2:' , string($x + $width), ';y2:', string($y + $height) ) "/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetBigestWindows"> + <xsl:param name="Window1"/> + <xsl:param name="Window2"/> + <xsl:variable name="w1x1" select="substring-after( substring-before($Window1,';y1'),'x1:') "/> + <xsl:variable name="w2x1" select="substring-after( substring-before($Window2,';y1'),'x1:') "/> + <xsl:variable name="w1y1" select="substring-after( substring-before($Window1,';x2'),'y1:') "/> + <xsl:variable name="w2y1" select="substring-after( substring-before($Window2,';x2'),'y1:') "/> + <xsl:variable name="w1x2" select="substring-after( substring-before($Window1,';y2'),'x2:') "/> + <xsl:variable name="w2x2" select="substring-after( substring-before($Window2,';y2'),'x2:') "/> + <xsl:variable name="w1y2" select="substring-after( $Window1,';y2:') "/> + <xsl:variable name="w2y2" select="substring-after( $Window2,';y2:') "/> + <xsl:variable name="x1"> + <xsl:choose> + <xsl:when test="$w1x1 > $w2x1"> + <xsl:value-of select="$w2x1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w1x1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y1"> + <xsl:choose> + <xsl:when test="$w1y1 > $w2y1"> + <xsl:value-of select="$w2y1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w1y1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="x2"> + <xsl:choose> + <xsl:when test="$w1x2 > $w2x2"> + <xsl:value-of select="$w1x2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w2x2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y2"> + <xsl:choose> + <xsl:when test="$w1y2 > $w2y2"> + <xsl:value-of select="$w1y2"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$w2y2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat('x1:' , $x1 , ';y1:' , $y1 , ';x2:' , $x2, ';y2:' , $y2)"/> + </xsl:template> + <!-- convert percent value to x% numeric x/100 --> + <xsl:template name="ValueOfPercent"> + <xsl:param name="value"/> + <xsl:choose> + <xsl:when test="contains($value, '%')"> + <xsl:value-of select="substring-before($value, '%') div 100"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="points2points"> + <xsl:param name="input_points"/> + <xsl:param name="input_x"/> + <xsl:param name="input_y"/> + <xsl:param name="input_width"/> + <xsl:param name="input_height"/> + <xsl:param name="input_boxwidth"/> + <xsl:param name="input_boxheight"/> + <xsl:variable name="onepoint" select="substring($input_points,1,string-length($input_points) - string-length(substring-after($input_points,' ')) )"/> + <xsl:if test="substring-before($input_points,' ')"> + <xsl:value-of select="round($input_x + (($input_boxwidth - number(substring-before($onepoint,','))) ) * $input_width div $input_boxwidth)"/> + <xsl:value-of select="'pt,'"/> + <xsl:value-of select="round($input_y + ((number(substring-after($onepoint,',')) ) ) * $input_height div $input_boxheight)"/> + <xsl:value-of select="'pt'"/> + </xsl:if> + <xsl:if test="string-length(substring($input_points,string-length($onepoint) + 1)) > 0"> + <xsl:value-of select="','"/> + <xsl:call-template name="points2points"> + <xsl:with-param name="input_points" select="substring($input_points,string-length($onepoint) + 1)"/> + <xsl:with-param name="input_x" select="$input_x"/> + <xsl:with-param name="input_y" select="$input_y"/> + <xsl:with-param name="input_width" select="$input_width"/> + <xsl:with-param name="input_height" select="$input_height"/> + <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/> + <xsl:with-param name="input_boxheight" select="$input_boxheight"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="path2path"> + <xsl:param name="input_points"/> + <xsl:param name="x_or_y" select="'x'"/> + <xsl:param name="input_x"/> + <xsl:param name="input_y"/> + <xsl:param name="input_width"/> + <xsl:param name="input_height"/> + <xsl:param name="input_boxwidth"/> + <xsl:param name="input_boxheight"/> + <xsl:variable name="space-pos" select="string-length($input_points) - string-length(substring-after($input_points,' '))"/> + <xsl:variable name="minus-pos" select="string-length($input_points) - string-length(substring-after($input_points,'-'))"/> + <xsl:variable name="m-pos" select="string-length($input_points) - string-length(substring-after($input_points,'m'))"/> + <xsl:variable name="c-pos" select="string-length($input_points) - string-length(substring-after($input_points,'c'))"/> + <xsl:variable name="e-pos" select="string-length($input_points) - string-length(substring-after($input_points,'e'))"/> + <xsl:variable name="min1"> + <xsl:choose> + <xsl:when test="$space-pos < $minus-pos"> + <xsl:value-of select="$space-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$minus-pos"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min2"> + <xsl:choose> + <xsl:when test="$m-pos < $min1"> + <xsl:value-of select="$m-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$min1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min3"> + <xsl:choose> + <xsl:when test="$c-pos < $min2"> + <xsl:value-of select="$c-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$min2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min4"> + <xsl:choose> + <xsl:when test="$e-pos < $min3"> + <xsl:value-of select="$e-pos"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$min3"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="min-special-char-pos" select="$min4"/> + <xsl:variable name="special-char" select="substring($input_points,$min-special-char-pos,1)"/> + <xsl:variable name="one-value" select="substring($input_points,1,$min-special-char-pos - 1)"/> + <xsl:variable name="left-points" select="substring($input_points,$min-special-char-pos + 1)"/> + <xsl:if test="not($special-char = 'm')"> + <xsl:if test="$x_or_y = 'x'"> + <xsl:value-of select="round($input_x + $one-value * $input_width div $input_boxwidth)"/> + </xsl:if> + <xsl:if test="$x_or_y = 'y'"> + <xsl:value-of select="round($input_y + $one-value * $input_height div $input_boxheight)"/> + </xsl:if> + </xsl:if> + <!-- output the separator--> + <xsl:choose> + <xsl:when test="$special-char = '-' or $special-char = ' ' "> + <xsl:value-of select="','"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$special-char"/> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="next-xy"> + <xsl:if test="$x_or_y = 'x'"> + <xsl:value-of select="'y'"/> + </xsl:if> + <xsl:if test="$x_or_y = 'y'"> + <xsl:value-of select="'x'"/> + </xsl:if> + </xsl:variable> + <xsl:if test="string-length($left-points) > 0"> + <xsl:call-template name="path2path"> + <xsl:with-param name="input_points" select="$left-points"/> + <xsl:with-param name="x_or_y" select="$next-xy"/> + <xsl:with-param name="input_x" select="$input_x"/> + <xsl:with-param name="input_y" select="$input_y"/> + <xsl:with-param name="input_width" select="$input_width"/> + <xsl:with-param name="input_height" select="$input_height"/> + <xsl:with-param name="input_boxwidth" select="$input_boxwidth"/> + <xsl:with-param name="input_boxheight" select="$input_boxheight"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="get_dashstyle"> + <xsl:param name="stroke-width" select="0.1"/> + <xsl:param name="style-name" select="@draw:style-name"/> + <xsl:variable name="graph-style" select="key('graphics-style', $style-name)/style:graphic-properties"/> + <xsl:variable name="dash-style" select="key('stroke-dash-style', $graph-style/@draw:stroke-dash)"/> + <xsl:variable name="stroke"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:stroke"> + <xsl:value-of select="$graph-style/@draw:stroke"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:stroke"> + <xsl:value-of select="$dash-style/@draw:stroke"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$stroke = 'solid' "> + <xsl:value-of select="$stroke"/> + </xsl:when> + <xsl:when test="$stroke = 'dash'"> + <xsl:variable name="dots1"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots1"> + <xsl:value-of select="$graph-style/@draw:dots1"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots1"> + <xsl:value-of select="$dash-style/@draw:dots1"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dots2"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots1"> + <xsl:value-of select="$graph-style/@draw:dots2"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots1"> + <xsl:value-of select="$dash-style/@draw:dots2"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dots1-length"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots1-length"> + <xsl:value-of select="$graph-style/@draw:dots1-length"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots1-length"> + <xsl:value-of select="$dash-style/@draw:dots1-length"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dots2-length"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:dots2-length"> + <xsl:value-of select="$graph-style/@draw:dots2-length"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:dots2-length"> + <xsl:value-of select="$dash-style/@draw:dots2-length"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="distance"> + <xsl:choose> + <xsl:when test="$graph-style/@draw:distance"> + <xsl:value-of select="$graph-style/@draw:distance"/> + </xsl:when> + <xsl:when test="$dash-style/@draw:distance"> + <xsl:value-of select="$dash-style/@draw:distance"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dot1-step"> + <xsl:choose> + <xsl:when test="contains($dots1-length,'%')"> + <xsl:variable name="dots-percent"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="$dots1-length"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round($dots-percent)"/> + </xsl:when> + <xsl:when test="contains($dots1-length , 'in' ) and $stroke-width > 0"> + <xsl:value-of select="round( number(substring-before($dots1-length,'in' )) div $stroke-width )"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dot2-step"> + <xsl:choose> + <xsl:when test="contains($dots2-length,'%')"> + <xsl:variable name="dots-percent"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="$dots2-length"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round($dots-percent)"/> + </xsl:when> + <xsl:when test="contains($dots2-length,'in') and $stroke-width > 0"> + <xsl:value-of select="round(number(substring-before($dots2-length,'in')) div $stroke-width)"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="distance-step"> + <xsl:choose> + <xsl:when test="contains($distance,'%')"> + <xsl:variable name="dots-percent"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="$distance"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="round($dots-percent)"/> + </xsl:when> + <xsl:when test="contains($distance,'in') and $stroke-width > 0"> + <xsl:value-of select="round(number(substring-before($distance,'in')) div $stroke-width)"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dashstyle"> + <xsl:choose> + <xsl:when test="$dots1 = 1 and $dots2 = 1 and $dot1-step = 0 and $dot2-step = 0 and $distance-step = 0"> + <xsl:value-of select="'ShortDot'"/> + </xsl:when> + <xsl:when test="$dots2 = 0 and $dot1-step = 0 and $dot2-step = 0 and $distance-step > 0"> + <xsl:value-of select="concat('0 ', $distance-step)"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="create_dashstyle"> + <xsl:with-param name="dot-count" select="$dots1"/> + <xsl:with-param name="dot-step" select="$dot1-step"/> + <xsl:with-param name="distance-step" select="$distance-step"/> + </xsl:call-template> + <xsl:value-of select="' '"/> + <xsl:call-template name="create_dashstyle"> + <xsl:with-param name="dot-count" select="$dots2"/> + <xsl:with-param name="dot-step" select="$dot2-step"/> + <xsl:with-param name="distance-step" select="$distance-step"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$dashstyle"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="create_dashstyle"> + <xsl:param name="dot-count"/> + <xsl:param name="dot-step"/> + <xsl:param name="distance-step"/> + <xsl:if test="$dot-count > 0"> + <xsl:value-of select="concat($dot-step, ' ' , $distance-step )"/> + <xsl:if test="$dot-count - 1 > 0"> + <xsl:value-of select="' '"/> + <xsl:call-template name="create_dashstyle"> + <xsl:with-param name="dot-count" select="$dot-count - 1"/> + <xsl:with-param name="dot-step" select="$dot-step"/> + <xsl:with-param name="distance-step" select="$distance-step"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + </xsl:template> + <xsl:template name="get_borderstyle"> + <xsl:param name="border"/> + <xsl:param name="border-line-width"/> + <xsl:choose> + <xsl:when test="contains($border,'solid')"> + <xsl:variable name="strokeweight"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before($border, ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="concat ( 'strokeweight:', $strokeweight)"/> + </xsl:when> + <xsl:when test="contains($border,'double')"> + <xsl:variable name="outside"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-after(substring-after($border-line-width, ' ') , ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="inside"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before($border-line-width, ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="space"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="value" select="substring-before(substring-after($border-line-width, ' ') , ' ')"/> + <xsl:with-param name="TargetMeasure" select="'pt'"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="linestyle"> + <xsl:choose> + <xsl:when test="$outside = $inside"> + <xsl:value-of select="'thinThin'"/> + </xsl:when> + <xsl:when test="$outside > $inside"> + <xsl:value-of select="'thickThin'"/> + </xsl:when> + <xsl:when test="$outside < $inside"> + <xsl:value-of select="'thinThick'"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="strokeweight" select="$inside + $outside + $space"/> + <xsl:value-of select="concat( 'linestyle:' , $linestyle , ';' , 'strokeweight:' , $strokeweight )"/> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="DrawElements"> + <xsl:param name="TargetMeasure" select="pt"/> + <xsl:param name="x-adjust" select="0"/> + <xsl:param name="y-adjust" select="0"/> + <xsl:param name="force-draw" select="'false'"/> + <xsl:param name="shape-type"/> + <xsl:variable name="MeasureMark"> + <xsl:choose> + <xsl:when test="$TargetMeasure = 'twip'"/> + <xsl:otherwise> + <xsl:value-of select="$TargetMeasure"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="drawtextstyle" select="@draw:text-style-name"/> + <xsl:variable name="org-z-index"> + <xsl:choose> + <xsl:when test="@draw:z-index"> + <xsl:value-of select="number(concat('0',@draw:z-index))"/> + </xsl:when> + <xsl:when test="parent::draw:frame/@draw:z-index"> + <xsl:value-of select="number(concat('0',parent::draw:frame/@draw:z-index))"/> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="run-though" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:run-through"/> + <xsl:variable name="org-wrap" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:wrap"/> + <xsl:variable name="draw-name"> + <xsl:choose> + <xsl:when test="string-length(@draw:name) = 0"> + <xsl:value-of select="translate(ancestor::draw:frame[1]/@draw:name, ':/', '__')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="translate(@draw:name, ':/', '__')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style_name2key"> + <xsl:choose> + <xsl:when test="@draw:style-name"> + <xsl:value-of select="@draw:style-name"/> + </xsl:when> + <xsl:otherwise> + <xsl:if test="ancestor::draw:frame/@draw:style-name"> + <xsl:value-of select="ancestor::draw:frame/@draw:style-name"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="draw-fill-type" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill"/> + <xsl:variable name="draw-gradient-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-gradient-name"/> + <xsl:variable name="horizontal-pos" select="key('graphics-style', $style_name2key)/style:graphic-properties/@style:horizontal-pos"/> + <!--horizontal-pos attribute is for the placement of all the drawing elements--> + <xsl:variable name="fill-image-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-image-name"/> + <xsl:if test="$draw-fill-type = 'bitmap' "> + <xsl:element name="w:binData"> + <xsl:attribute name="w:name"> + <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/> + </xsl:attribute> + <xsl:value-of select="translate(key('fill-image',$fill-image-name)/office:binary-data/text(),'	  ','' ) "/> + <!-- xsl:value-of select="office:binary-data/text()"/ --> + </xsl:element> + </xsl:if> + <xsl:variable name="z-index"> + <xsl:choose> + <xsl:when test="$run-though='foreground'"> + <!-- make sure z-index >=0 --> + <xsl:choose> + <xsl:when test="$org-z-index < 0">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-z-index"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$run-though='background'"> + <!-- make sure z-index < 0 --> + <xsl:choose> + <xsl:when test="$org-z-index < 0"> + <xsl:value-of select="$org-z-index"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-z-index - 10"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="wrap"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char' ">none</xsl:when> + <xsl:when test="$org-wrap='dynamic'">tight</xsl:when> + <xsl:when test="$org-wrap='parallel'">square</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="ooshapename" select="substring-after(name(),':')"/> + <xsl:variable name="element-name"> + <xsl:choose> + <xsl:when test="$ooshapename='rect'">v:rect</xsl:when> + <xsl:when test="$ooshapename='ellipse' and not(string-length(@draw:kind) > 0)">v:oval</xsl:when> + <xsl:when test="$ooshapename='ellipse' and string-length(@draw:kind) > 0">v:arc</xsl:when> + <xsl:when test="$ooshapename='circle' and string-length(@draw:kind) > 0">v:arc</xsl:when> + <xsl:when test="$ooshapename='line'">v:line</xsl:when> + <xsl:when test="$ooshapename='polyline'">v:polyline</xsl:when> + <xsl:when test="$ooshapename='polygon'">v:polyline</xsl:when> + <xsl:when test="$ooshapename='text-box'">v:shape</xsl:when> + <xsl:when test="$ooshapename='image'">v:shape</xsl:when> + <xsl:when test="$ooshapename='frame'">v:shape</xsl:when> + <xsl:when test="$ooshapename='path'">v:shape</xsl:when> + <!-- This caption is not the "Caption", it's GUI name is Callouts--> + <xsl:when test="$ooshapename='caption'">v:shape</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive' ">v:shape</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'round-rectangle' ">v:roundrect</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'rectangle' ">v:rect</xsl:when> + <xsl:when test="$ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'ellipse' ">v:oval</xsl:when> + <xsl:when test="$ooshapename='custom-shape'">v:shape</xsl:when> + <!-- some wild guess --> + <xsl:otherwise>v:shape</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="ms-shape-type"> + <xsl:choose> + <xsl:when test="string-length($shape-type) > 0"> + <xsl:value-of select="$shape-type"/> + </xsl:when> + <xsl:when test="$ooshapename='custom-shape' "> + <xsl:call-template name="ooo_custom_draw2ms_word_draw_map"> + <xsl:with-param name="ooo_predefined_type" select="draw:enhanced-geometry[1]/@draw:predefined-type"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="real-x-adjust"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat($x-adjust,'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="real-y-adjust"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat($y-adjust,'in')"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:x"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-y"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:y"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="pagemaster" select="key('master-page','Standard')/@style:page-layout-name"/> + <xsl:variable name="leftmargin-pt"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="topmargin-pt"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="key('page-layout',$pagemaster)/style:page-layout-properties/@fo:margin-top"/> + </xsl:call-template> + </xsl:variable> + <!-- adjust the x and y values of the page archored objects--> + <xsl:variable name="x"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-x + $real-x-adjust - $leftmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-x + $real-x-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-y + $real-y-adjust - $topmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-y + $real-y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="width"> + <xsl:variable name="width-tmp"> + <xsl:choose> + <xsl:when test="@svg:width"> + <xsl:value-of select="@svg:width"/> + </xsl:when> + <xsl:when test="not(string-length(parent::draw:frame/@svg:width) = 0)"> + <xsl:value-of select="parent::draw:frame/@svg:width"/> + </xsl:when> + <xsl:when test="string-length(@svg:width) = 0 and ancestor::draw:frame"> + <xsl:value-of select="ancestor::draw:frame/@svg:width"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@svg:width"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="$width-tmp"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="height"> + <xsl:choose> + <xsl:when test="@svg:height"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:height"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="not(string-length(parent::draw:frame/@svg:height) = 0)"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="parent::draw:frame/@svg:height"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@fo:min-height and string-length(text:p/text()) = 0 and not(text:p/draw:*)"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@fo:min-height"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="borderstyle"> + <xsl:call-template name="get_borderstyle"> + <xsl:with-param name="border" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border"/> + <xsl:with-param name="border-line-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@style:border-line-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="stroke-weight-in-inch" select="number(concat('0',translate(key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width ,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','') ))"/> + <xsl:variable name="stroke-weight"> + <xsl:choose> + <xsl:when test="contains($borderstyle , 'strokeweight')"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="concat( substring-after($borderstyle, 'strokeweight:') , 'pt')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-width"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="linestyle"> + <xsl:if test="contains($borderstyle , 'strokeweight')"> + <xsl:value-of select="substring-before( substring-after($borderstyle, 'linestyle:') , ';strokeweight')"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="stroked"> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:stroke = 'none'"> + <xsl:value-of select="'f'"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="dashstyle"> + <xsl:call-template name="get_dashstyle"> + <xsl:with-param name="stroke-width" select="$stroke-weight-in-inch"/> + <xsl:with-param name="style-name" select="@draw:style-name"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="start-arrow"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> + <xsl:call-template name="MapArrowStyle"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-arrow"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> + <xsl:call-template name="MapArrowStyle"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="start-arrow-length"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> + <xsl:call-template name="GetArrowLength"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="start-arrow-width"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"> + <xsl:call-template name="GetArrowWidth"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-end-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-arrow-length"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> + <xsl:call-template name="GetArrowLength"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="end-arrow-width"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"> + <xsl:call-template name="GetArrowWidth"> + <xsl:with-param name="arrow-name" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start"/> + <xsl:with-param name="arrow-width" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:marker-start-width"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="stroke-color"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"> + <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-color"/> + </xsl:when> + <xsl:when test="contains(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#')"> + <xsl:value-of select="concat('#', substring-after(key('graphics-style', @draw:style-name)/style:graphic-properties/@fo:border, '#') )"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="stroke-opacity"> + <xsl:call-template name="ValueOfPercent"> + <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@svg:stroke-opacity"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="fill-color"> + <xsl:choose> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"> + <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill-color"/> + </xsl:when> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style">black</xsl:when> + <xsl:when test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fill = 'none'"/> + <xsl:when test="$draw-fill-type = 'gradient' "> + <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:end-color "/> + </xsl:when> + <!-- for these need fill, set the default color we used in oo--> + <xsl:when test="name()='draw:polygon' or name()='draw:custom-shape' or name() = 'draw:rect' or (name() = 'draw:ellipse' and not( @draw:kind='arc') )">#00B8FF</xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="position"> + <xsl:value-of select="concat('left:', $x ,$MeasureMark , ';top:' , $y ,$MeasureMark , ';width:', $width ,$MeasureMark )"/> + <xsl:if test="not($height = 0)"> + <xsl:value-of select="concat(';height:', $height ,$MeasureMark )"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="flip"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char' and $ooshapename='line'"/> + <xsl:when test="$ooshapename='image'"/> + <xsl:when test="$ooshapename='path'"/> + <xsl:when test="$ooshapename='caption'"/> + <xsl:when test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"/> + <xsl:when test="$ooshapename='custom-shape'"/> + <xsl:otherwise>flip:x</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="absolute"> + <xsl:choose> + <xsl:when test="ancestor::draw:a"/> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'"/> + <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'"/> + <xsl:otherwise>position:absolute</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="anchorlock"> + <xsl:choose> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">has</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <!-- start line special --> + <xsl:variable name="org-x1"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:x1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-y1"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:y1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-x2"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:x2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="org-y2"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="value" select="@svg:y2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x1"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-x1 + $real-x-adjust - $leftmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-x1 + $real-x-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y1"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-y1 + $real-y-adjust - $topmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-y1 + $real-y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="x2"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-x2 + $real-x-adjust - $leftmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-x2 + $real-x-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="y2"> + <xsl:choose> + <xsl:when test="@text:anchor-type='page' or ancestor::draw:*/@text:anchor-type='page'"> + <xsl:value-of select="$org-y2 + $real-y-adjust - $topmargin-pt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$org-y2 + $real-y-adjust"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- end line special --> + <xsl:variable name="relative"> + <xsl:choose> + <xsl:when test="@text:anchor-type = 'as-char' or @text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when> + <xsl:when test="parent::draw:frame/@text:anchor-type = 'as-char' or parent::draw:frame/@text:anchor-type = 'to-char'">mso-position-horizontal-relative:char;mso-position-vertical-relative:line</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + <xsl:variable name="style"> + <xsl:choose> + <xsl:when test="$wrap='none'"/> + <xsl:otherwise> + <xsl:if test="string-length($absolute) > 0"> + <xsl:value-of select="concat($absolute, ';')"/> + </xsl:if> + <xsl:value-of select="concat('z-index:', $z-index, ';')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="string-length($flip) > 0"> + <xsl:value-of select="concat($flip,';')"/> + </xsl:if> + <xsl:if test="not($ooshapename = 'line')"> + <xsl:value-of select="concat($position,';')"/> + </xsl:if> + <xsl:if test="ancestor::draw:frame and name()='draw:text-box'"> + <xsl:if test="string-length($horizontal-pos) > 0"> + <xsl:value-of select="concat('mso-position-horizontal:',$horizontal-pos,';')"/> + </xsl:if> + </xsl:if> + <xsl:if test="string-length($relative) > 0"> + <xsl:value-of select="concat($relative,';')"/> + </xsl:if> + </xsl:variable> + <!-- image special: convert oo base64 binary data (77char/line) to word base64 binary data(73char/line) , a workthrough is removing all line breaks --> + <xsl:if test="$ooshapename = 'image'"> + <xsl:element name="w:binData"> + <xsl:attribute name="w:name"> + <xsl:value-of select="concat( 'wordml://', $draw-name )"/> + </xsl:attribute> + <xsl:value-of select="translate(office:binary-data/text(),'	  ','' ) "/> + <!-- xsl:value-of select="office:binary-data/text()"/ --> + </xsl:element> + </xsl:if> + <!-- all element goes here --> + <xsl:variable name="id"> + <xsl:choose> + <xsl:when test="$ooshapename='line'"> + <xsl:value-of select="concat('_x',$x1 , '_' ,$y1, '_' , $x2, '_' ,$y2 )"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('_x',$x , '_' ,$y, '_' , $width, '_' ,$height )"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:element name="{$element-name}"> + <xsl:attribute name="id"> + <xsl:value-of select="$id"/> + </xsl:attribute> + <xsl:if test="string-length($ms-shape-type) > 0"> + <xsl:attribute name="type"> + <xsl:value-of select="$ms-shape-type"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="style"> + <xsl:value-of select="$style"/> + </xsl:attribute> + <xsl:if test="$stroke-weight > 0"> + <xsl:attribute name="strokeweight"> + <xsl:value-of select="concat($stroke-weight,$MeasureMark)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($stroked) > 0"> + <xsl:attribute name="stroked"> + <xsl:value-of select="$stroked"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($stroke-color) > 0"> + <xsl:attribute name="strokecolor"> + <xsl:value-of select="$stroke-color"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($fill-color) > 0"> + <xsl:attribute name="fillcolor"> + <xsl:value-of select="$fill-color"/> + </xsl:attribute> + <xsl:attribute name="filled">true</xsl:attribute> + </xsl:if> + <xsl:if test="parent::draw:frame/draw:object-ole[1]"> + <xsl:attribute name="filled">true</xsl:attribute> + </xsl:if> + <xsl:if test="string-length($stroke-opacity) > 0"> + <xsl:attribute name="opacity"> + <xsl:value-of select="$stroke-opacity"/> + </xsl:attribute> + </xsl:if> + <!-- arc special attribute --> + <xsl:if test="@draw:kind = 'arc' or @draw:kind = 'cut' or @draw:kind = 'section'"> + <xsl:choose> + <xsl:when test="@draw:start-angle > @draw:end-angle"> + <xsl:attribute name="startangle"> + <xsl:value-of select="round( 450 - (@draw:end-angle + 360) )"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="startangle"> + <xsl:value-of select="round( 450 - @draw:end-angle )"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="endangle"> + <xsl:value-of select="round(450 - @draw:start-angle)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@draw:kind = 'cut'"> + <xsl:attribute name="fill"> + <xsl:value-of select="'true'"/> + </xsl:attribute> + </xsl:if> + <!-- end arc special attribute --> + <!-- line special attribute--> + <xsl:if test="$ooshapename='line'"> + <xsl:attribute name="from"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char'">0,0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($x1,$MeasureMark, ',',$y2,$MeasureMark )"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="to"> + <xsl:choose> + <xsl:when test="@text:anchor-type='as-char'"> + <xsl:value-of select="concat($x2,$MeasureMark ,',',$y2,$MeasureMark )"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($x2,$MeasureMark ,',' ,$y1,$MeasureMark)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:if> + <!-- end line special attribute--> + <!-- polyline and polygon special attribute--> + <xsl:if test="$ooshapename='polyline' or $ooshapename='polygon' "> + <!-- translate ' ' to in ' translate ',' to 'in,' --> + <xsl:variable name="points"> + <xsl:call-template name="points2points"> + <xsl:with-param name="input_x" select="$x"/> + <xsl:with-param name="input_y" select="$y"/> + <xsl:with-param name="input_width" select="$width"/> + <xsl:with-param name="input_height" select="$height"/> + <xsl:with-param name="input_boxwidth" select="substring-before(substring-after(@svg:viewBox,'0 0 '),' ')"/> + <xsl:with-param name="input_boxheight" select="substring-after(substring-after(@svg:viewBox,'0 0 '),' ')"/> + <xsl:with-param name="input_points" select="concat(@draw:points,' ')"/> + <!-- add a space to the end of input_points --> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="points"> + <xsl:value-of select="$points"/> + </xsl:attribute> + </xsl:if> + <!-- end polyline and polygon special attribute--> + <!-- callouts special attribute--> + <xsl:if test="$ooshapename='caption'"> + <xsl:variable name="caption-point-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="value" select="@draw:caption-point-x"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="caption-point-y"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="value" select="@draw:caption-point-y"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="type"> + <!-- map to word line label 3--> + <xsl:value-of select="'#_x0000_t48'"/> + </xsl:attribute> + <xsl:attribute name="adj"> + <xsl:value-of select=" concat($caption-point-x * 20 , ',' , $caption-point-y * 20 , ',' , $caption-point-x * 10 , ',,,,' , $caption-point-x * 20, ',' , $caption-point-y * 20) "/> + </xsl:attribute> + </xsl:if> + <!-- end callouts special attribute--> + <!-- path special attribute--> + <xsl:if test="$ooshapename='path' or string-length(@svg:d) > 0 or ( $ooshapename='custom-shape' and draw:enhanced-geometry[1]/@draw:predefined-type = 'non-primitive') "> + <xsl:variable name="path"> + <xsl:choose> + <xsl:when test="$ooshapename='path' or string-length(@svg:d) > 0 "> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="@svg:d"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="draw:enhanced-geometry[1]/@draw:enhanced-path"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="coordorigin"> + <xsl:value-of select=" '0 0' "/> + </xsl:attribute> + <xsl:attribute name="coordsize"> + <xsl:choose> + <xsl:when test="string-length(@svg:viewBox) > 0 "> + <xsl:value-of select="substring-after(@svg:viewBox,'0 0 ')"/> + </xsl:when> + <xsl:when test="string-length(draw:enhanced-geometry[1]/@svg:viewBox) > 0 "> + <xsl:value-of select="substring-after(draw:enhanced-geometry[1]/@svg:viewBox,'0 0 ')"/> + </xsl:when> + <!-- for custom shape use a default viewbox. right? --> + <xsl:otherwise> + <xsl:value-of select=" '21600 21600' "/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="path"> + <xsl:value-of select="$path"/> + </xsl:attribute> + </xsl:if> + <!-- end path special attribute--> + <!-- image special element --> + <xsl:if test="$ooshapename='image'"> + <xsl:element name="v:imagedata"> + <xsl:attribute name="src"> + <xsl:value-of select="concat('wordml://', $draw-name)"/> + </xsl:attribute> + <xsl:attribute name="o:title"> + <xsl:value-of select="$draw-name"/> + </xsl:attribute> + </xsl:element> + </xsl:if> + <!-- end image special element --> + <!-- start dash style , line style and arrow style--> + <xsl:if test="string-length($dashstyle) > 0 or string-length($linestyle) > 0 or string-length($start-arrow) > 0 or string-length($end-arrow) > 0 "> + <xsl:element name="v:stroke"> + <xsl:if test="string-length($dashstyle) > 0"> + <xsl:attribute name="dashstyle"> + <xsl:value-of select="$dashstyle"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($linestyle) > 0"> + <xsl:attribute name="linestyle"> + <xsl:value-of select="$linestyle"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($start-arrow) > 0 "> + <xsl:attribute name="startarrow"> + <xsl:value-of select="$start-arrow"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($end-arrow) > 0 "> + <xsl:attribute name="endarrow"> + <xsl:value-of select="$end-arrow"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($start-arrow-length) > 0 "> + <xsl:attribute name="startarrowlength"> + <xsl:value-of select="$start-arrow-length"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($start-arrow-width) > 0 "> + <xsl:attribute name="startarrowwidth"> + <xsl:value-of select="$start-arrow-width"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($end-arrow-length) > 0 "> + <xsl:attribute name="endarrowlength"> + <xsl:value-of select="$end-arrow-length"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="string-length($end-arrow-width) > 0 "> + <xsl:attribute name="endarrowwidth"> + <xsl:value-of select="$end-arrow-width"/> + </xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <!-- end dash style , line style and arrow style --> + <!-- start wrap type --> + <xsl:if test="string-length($wrap) > 0"> + <xsl:element name="w10:wrap"> + <xsl:attribute name="type"> + <xsl:value-of select="$wrap"/> + </xsl:attribute> + </xsl:element> + </xsl:if> + <!-- end wrap type --> + <!-- start anchor to char specific element --> + <xsl:if test="string-length($anchorlock) > 0"> + <xsl:element name="w10:anchorlock"/> + </xsl:if> + <!-- end wrap type --> + <!-- start fill image --> + <xsl:if test="string-length($draw-fill-type ) > 0"> + <xsl:element name="v:fill"> + <xsl:choose> + <xsl:when test="$draw-fill-type = 'bitmap'"> + <xsl:attribute name="src"> + <xsl:value-of select="concat( 'wordml://', $fill-image-name)"/> + </xsl:attribute> + <xsl:attribute name="o:title"> + <xsl:value-of select="$fill-image-name"/> + </xsl:attribute> + <xsl:attribute name="recolor"> + <xsl:value-of select=" 'true' "/> + </xsl:attribute> + <xsl:attribute name="rotate"> + <xsl:value-of select=" 'true' "/> + </xsl:attribute> + <xsl:attribute name="type"> + <xsl:value-of select=" 'frame' "/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$draw-fill-type = 'gradient'"> + <xsl:attribute name="type"> + <xsl:value-of select=" 'gradient' "/> + </xsl:attribute> + <xsl:attribute name="color2"> + <xsl:value-of select="key('draw-gradient',$draw-gradient-name)/@draw:start-color "/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + </xsl:element> + </xsl:if> + <!-- end fill image --> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-style"> + <xsl:call-template name="FontWork"/> + </xsl:if> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:shadow = 'visible'"> + <xsl:call-template name="Shadow"/> + </xsl:if> + <!-- only draw:g can have child graphic --> + <xsl:choose> + <xsl:when test="name() = 'draw:g'"> + <xsl:apply-templates select="draw:*"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="text:*/* | text:*/text()"> + <xsl:element name="v:textbox"> + <xsl:if test="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:writing-mode = 'tb-rl'"> + <xsl:attribute name="style"> + <xsl:value-of select="'layout-flow:vertical'"/> + </xsl:attribute> + </xsl:if> + <w:txbxContent> + <xsl:apply-templates select="text() | text:*"/> + </w:txbxContent> + </xsl:element> + </xsl:when> + </xsl:choose> + </xsl:element> + <xsl:apply-templates select="parent::draw:frame/draw:object-ole" mode="output"> + <xsl:with-param name="ShapeID" select="$id"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template name="Shadow"> + <xsl:element name="v:shadow"> + <xsl:variable name="key-node" select="key('graphics-style', @draw:style-name)/style:graphic-properties"/> + <xsl:attribute name="on">true</xsl:attribute> + <xsl:attribute name="offset"> + <xsl:value-of select="concat($key-node/@draw:shadow-offset-x,',' , $key-node/@draw:shadow-offset-y)"/> + </xsl:attribute> + <xsl:attribute name="color"> + <xsl:value-of select="$key-node/@draw:shadow-color"/> + </xsl:attribute> + <xsl:attribute name="opacity"> + <xsl:value-of select="$key-node/@draw:shadow-opacity"/> + </xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="FontWork"> + <xsl:element name="v:path"> + <xsl:attribute name="textpathok">true</xsl:attribute> + </xsl:element> + <xsl:if test="not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow) or not(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow = 'normal')"> + <xsl:element name="v:shadow"> + <xsl:attribute name="on">true</xsl:attribute> + <xsl:attribute name="type">perspective</xsl:attribute> + <xsl:attribute name="color"> + <xsl:value-of select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-color"/> + </xsl:attribute> + <xsl:variable name="offset-x"> + <xsl:call-template name="ConvertMeasure"> + <xsl:with-param name="TargetMeasure" select="'twip'"/> + <xsl:with-param name="value" select="key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-x"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="offset-y" select="substring-before(key('graphics-style', @draw:style-name)/style:graphic-properties/@draw:fontwork-shadow-offset-y, 'in')"/> + <xsl:attribute name="matrix"> + <xsl:value-of select="concat(',,,' , round($offset-y div 0.000693) div 100, ',,')"/> + </xsl:attribute> + <xsl:attribute name="origin">-30%, -30%</xsl:attribute> + </xsl:element> + </xsl:if> + <xsl:element name="v:textpath"> + <xsl:attribute name="on">true</xsl:attribute> + <xsl:attribute name="fitpath">true</xsl:attribute> + <xsl:attribute name="fitshape">true</xsl:attribute> + <xsl:attribute name="style"> + <xsl:choose> + <xsl:when test="key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family"> + <xsl:value-of select="concat('font-family:"' , key('paragraph-style', text:p[1]/@text:style-name )/style:graphic-properties/@svg:font-family , '"') "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="default-graphics-properties" select="/office:document/office:styles/style:default-style[@style:family = 'graphics']/style:graphic-properties"/> + <xsl:value-of select="concat('font-family:"' , $default-graphics-properties/@style:font-name , '"') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="string"> + <xsl:value-of select="text:p"/> + </xsl:attribute> + </xsl:element> + </xsl:template> + <xsl:template name="MapArrowStyle"> + <xsl:param name="arrow-name"/> + <xsl:choose> + <xsl:when test="$arrow-name = 'Arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Square' ">Diamond</xsl:when> + <xsl:when test="$arrow-name = 'Small arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Dimension lines' ">Diamond</xsl:when> + <xsl:when test="$arrow-name = 'Double Arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Rounded short arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Symmetric arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Line Arrow' ">Open</xsl:when> + <xsl:when test="$arrow-name = 'Rounded large arrow' ">Block</xsl:when> + <xsl:when test="$arrow-name = 'Circle' ">Oval</xsl:when> + <xsl:when test="$arrow-name = 'Square 45' ">Diamond</xsl:when> + <xsl:when test="$arrow-name = 'Arrow concave' ">Classic</xsl:when> + <xsl:otherwise>Block</xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="GetArrowLength"> + <xsl:param name="arrow-name"/> + <xsl:param name="arrow-width"/> + <xsl:variable name="arrow-size"> + <xsl:choose> + <xsl:when test="$arrow-width"> + <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/> + </xsl:when> + <xsl:otherwise>3</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$arrow-size > 2">Long</xsl:when> + <xsl:when test="$arrow-size > 1">Medium</xsl:when> + <xsl:when test="$arrow-size > 0">Short</xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template name="GetArrowWidth"> + <xsl:param name="arrow-name"/> + <xsl:param name="arrow-width"/> + <xsl:variable name="arrow-size"> + <xsl:choose> + <xsl:when test="$arrow-width"> + <xsl:value-of select="round(number(substring-before($arrow-width, 'in')) div 0.02) "/> + </xsl:when> + <xsl:otherwise>3</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$arrow-size > 2">Wide</xsl:when> + <xsl:when test="$arrow-size > 1">Medium</xsl:when> + <xsl:when test="$arrow-size > 0">Narrow</xsl:when> + </xsl:choose> + </xsl:template> + + <xsl:template name="export-oledata"> + <xsl:if test="//draw:object-ole[1]"> + <xsl:apply-templates select="//draw:object-ole" mode="oledata.mso"/> + <w:docOleData> + <w:binData w:name="oledata.mso"> + <xsl:if test="function-available('ole:getByName')"> + <xsl:value-of select="translate(ole:getByName('oledata.mso'),'  ','')"/> + </xsl:if> + </w:binData> + </w:docOleData> + </xsl:if> + </xsl:template> + <xsl:template match="draw:object-ole" mode="oledata.mso"> + <xsl:variable name="stream-name"> + <xsl:apply-templates select="." mode="get-number"/> + </xsl:variable> + <xsl:variable name="tmp" select="ole:insertByName($stream-name, translate(office:binary-data/text(),'  ','' ) )"/> + </xsl:template> + <xsl:template match="draw:object-ole" mode="output"> + <xsl:param name="ShapeID"/> + <xsl:variable name="stream-name"> + <xsl:apply-templates select="." mode="get-number"/> + </xsl:variable> + <o:OLEObject Type="Embed" DrawAspect="Content" ObjectID="{$stream-name}" ShapeID="{$ShapeID}" ProgID=""/> + </xsl:template> + <xsl:template match="draw:object-ole" mode="get-number"> + <xsl:number from="/office:document" level="any" count="draw:object-ole" format="1"/> + </xsl:template> + <xsl:template match="draw:object-ole"/> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_field.xsl b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl new file mode 100644 index 000000000..349a07e0e --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_field.xsl @@ -0,0 +1,726 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <!-- the following are common used fields --> + <xsl:template match="text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date + | text:time | text:page-variable-get | text:author-name | text:author-initials | text:file-name | text:sender-company + | text:sender-initials | text:sender-phone-work | text:word-count | text:paragraph-count | text:character-count + | text:description | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration + | text:keywords | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:variable-get | text:user-field-get | text:sequence | text:database-name "> + <w:fldSimple> + <xsl:variable name="attribute_value1"> + <xsl:choose> + <xsl:when test="name() = 'text:page-number' or name() = 'text:page-variable-get' "> + <xsl:text> PAGE </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:page-count' "> + <xsl:text> NUMPAGES </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:subject' "> + <xsl:text> SUBJECT </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:initial-creator' "> + <xsl:text> AUTHOR </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:title' "> + <xsl:text> TITLE </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:date' "> + <xsl:text> DATE </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:time' "> + <xsl:text> TIME </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="name() = 'text:author-name' "> + <xsl:text> AUTHOR </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:author-initials' "> + <xsl:text> USERINITIALS </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:file-name' "> + <xsl:choose> + <xsl:when test="@text:display='name-and-extension' or @text:display='name' "> + <xsl:text> FILENAME </xsl:text> + </xsl:when> + <xsl:when test=" @text:display='full' or @text:display='path' "> + <xsl:text>FILENAME \p </xsl:text> + </xsl:when> + </xsl:choose> + </xsl:when> + <xsl:when test=" name() = 'text:sender-company' "> + <xsl:text> DOCPROPERTY Company </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:sender-initials' "> + <xsl:text> USERINITIALS </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:sender-phone-work' "> + <xsl:text> DOCPROPERTY "Telephone number" </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:word-count' "> + <xsl:text> DOCPROPERTY Words </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:paragraph-count' "> + <xsl:text> DOCPROPERTY Paragraphs </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:character-count' "> + <xsl:text> DOCPROPERTY CharactersWithSpaces </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:description' "> + <xsl:text> COMMENTS </xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:creation-time' "> + <xsl:text> DOCPROPERTY CreateTime </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name()= 'text:creation-date' "> + <xsl:text> CREATEDATE </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:editing-cycles' "> + <xsl:text> REVNUM \* Arabic </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:editing-duration' "> + <xsl:text> EDITTIME </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:keywords' "> + <xsl:text> KEYWORDS </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:print-time' "> + <xsl:text>DOCPROPERTY LastPrinted </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:print-date' "> + <xsl:text>DOCPROPERTY LastPrinted </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:creator' "> + <xsl:text> LASTSAVEDBY </xsl:text> + </xsl:when> + <xsl:when test=" name() = 'text:modification-time' "> + <xsl:text> DOCPROPERTY LastSavedTime </xsl:text> + <!-- ATM, this template just return null time format, it might be developed in the future --> + <xsl:call-template name="field_get_time_format"> + <xsl:with-param name="field_time_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_time_value" select="@text:time-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:modification-date' "> + <xsl:text> SAVEDATE </xsl:text> + <!-- ATM, this template just return null date format, it might be developed in the future --> + <xsl:call-template name="field_get_date_format"> + <xsl:with-param name="field_date_stylename" select="@style:data-style-name"/> + <xsl:with-param name="field_date_value" select="@text:date-value"/> + </xsl:call-template> + </xsl:when> + <xsl:when test=" name() = 'text:user-defined' "> + <xsl:text> DOCPROPERTY </xsl:text> + <xsl:text>"</xsl:text> + <xsl:value-of select="translate(string(@text:name), ' ', '')"/> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="name() = 'text:variable-get' or name() = 'text:user-field-get' "> + <xsl:value-of select="concat ('DOCVARIABLE ', @text:name)"/> + </xsl:when> + <xsl:when test=" name() = 'text:sequence' "> + <xsl:value-of select="concat(' SEQ "',@text:name, '"') "/> + </xsl:when> + <xsl:when test="name() = 'text:database-name' "> + <xsl:value-of select="concat (' DATABASE ', @text:database-name, '.' , @text:table-name)"/> + </xsl:when> + </xsl:choose> + <!-- Get number style format for number fields --> + <xsl:if test="@style:num-format"> + <xsl:call-template name="field_get_number_format"> + <xsl:with-param name="field_number_format_style" select="@style:num-format"/> + </xsl:call-template> + </xsl:if> + <xsl:text> \* MERGEFORMAT </xsl:text> + </xsl:variable> + <xsl:attribute name="w:instr"> + <xsl:value-of select="$attribute_value1"/> + </xsl:attribute> + <w:r> + <w:rPr> + <xsl:choose> + <xsl:when test="@style:num-format = '가, 나, 다, ...' or @style:num-format ='일, 이, 삼, ...' or @style:num-format ='ㄱ, ㄴ, ㄷ, ...' "> + <w:rFonts w:fareast="Batang" w:hint="fareast"/> + <!--wx:font wx:val="Batang"/ --> + <w:lang w:fareast="KO"/> + </xsl:when> + <xsl:when test="@style:num-format = 'ア, イ, ウ, ...' or @style:num-format = 'ア, イ, ウ, ...' or @style:num-format = 'イ, ロ, ハ, ...' or @style:num-format = 'イ, ロ, ハ, ...' or @style:num-format ='壱, 弐, 参, ...' "> + <w:rFonts w:fareast="MS Mincho" w:hint="fareast"/> + <!--wx:font wx:val="MS Mincho"/ --> + <w:lang w:fareast="JA"/> + </xsl:when> + <xsl:when test=" @style:num-format ='壹, 貳, 參, ...' or @style:num-format ='壹, 貳, 參, ...' or @style:num-format ='壹, 贰, 叁, ...'or @style:num-format = '一, 二, 三, ...' "> + <w:rFonts w:hint="fareast"/> + <!--wx:font wx:val="宋体"/ --> + </xsl:when> + </xsl:choose> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </w:fldSimple> + </xsl:template> + <xsl:template name="field_get_number_format"> + <!-- this template get the various of number formats for number type field--> + <xsl:param name="field_number_format_style"/> + <xsl:choose> + <xsl:when test=" $field_number_format_style = '1, 2, 3, ...' or $field_number_format_style = '1' "> + <xsl:text> \* Arabic </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '①, ②, ③, ...' "> + <xsl:text> \* CircleNum </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'i' "> + <xsl:text> \* roman </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'I' "> + <xsl:text> \* ROMAN </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '一, 二, 三, ...'"> + <xsl:text> \* CHINESENUM3 </xsl:text> + </xsl:when> + <xsl:when test=" $field_number_format_style ='壹, 貳, 參, ...' or $field_number_format_style ='壹, 貳, 參, ...' or $field_number_format_style ='壹, 贰, 叁, ...' "> + <xsl:text> \* CHINESENUM2 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '壱, 弐, 参, ...' "> + <xsl:text> \* DBNUM3 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '子, 丑, 寅, ...' "> + <xsl:text> \* ZODIAC2 </xsl:text> + </xsl:when> + <xsl:when test=" $field_number_format_style ='甲, 乙, 丙, ...' "> + <xsl:text> \* ZODIAC1 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'イ, ロ, ハ, ...' or $field_number_format_style = 'イ, ロ, ハ, ...' "> + <xsl:text> \* Iroha </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='ア, イ, ウ, ...' or $field_number_format_style ='ア, イ, ウ, ...' "> + <xsl:text> \* Aiueo </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '일, 이, 삼, ...' "> + <xsl:text> \* DBNUM1 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='ㄱ, ㄴ, ㄷ, ...' or $field_number_format_style = '㉠, ㉡, ㉢, ...' "> + <xsl:text> \* Chosung </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = '가, 나, 다, ...' or $field_number_format_style = '㉮, ㉯, ㉰, ...' "> + <xsl:text> \* Ganada </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'ア, イ, ウ, ...' or $field_number_format_style = 'ア, イ, ウ, ...' "> + <xsl:text> \* Aiueo </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='a' "> + <xsl:text> \* alphabetic </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style ='A' "> + <xsl:text> \* ALPHABETIC </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'א, י, ק, ...' "> + <xsl:text> \* hebrew1 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'א, ב, ג, ...' "> + <xsl:text> \* hebrew2 </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'أ, ب, ت, ...' "> + <xsl:text> \* ArabicAlpha </xsl:text> + </xsl:when> + <xsl:when test="$field_number_format_style = 'ก, ข, ฃ, ...' "> + <xsl:text> \* ThaiLetter </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="field_get_date_format"> + <xsl:param name="field_date_stylename"/> + <xsl:param name="field_date_value"/> + <!-- this template return null date format ATM--> + <xsl:text/> + </xsl:template> + <xsl:template name="field_get_time_format"> + <xsl:param name="field_time_stylename"/> + <xsl:param name="field_time_value"/> + <!-- this template return null date format ATM--> + <xsl:text/> + </xsl:template> + <xsl:template match="text:template-name"> + <xsl:choose> + <xsl:when test="@text:display='title' or @text:display= 'area' "> + <!-- directly export the content --> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </xsl:when> + <xsl:otherwise> + <w:fldSimple> + <xsl:variable name="template_attribute_value"> + <xsl:choose> + <xsl:when test="@text:display='name-and-extension' or @text:display= 'name' "> + <xsl:text> TEMPLATE </xsl:text> + </xsl:when> + <xsl:when test=" @text:display='full' or @text:display='path' "> + <xsl:text>TEMPLATE \p </xsl:text> + </xsl:when> + </xsl:choose> + <xsl:text>\* MERGEFORMAT </xsl:text> + </xsl:variable> + <xsl:attribute name="w:instr"> + <xsl:value-of select="$template_attribute_value"/> + </xsl:attribute> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </w:fldSimple> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="text:text-input | text:variable-input | text:user-field-input"> + <w:fldSimple> + <xsl:variable name="text-input-attribute"> + <xsl:text>FILLIN </xsl:text> + <xsl:if test="@text:description"> + <xsl:value-of select="@text:description"/> + </xsl:if> + <xsl:text> \* MERGEFORMAT</xsl:text> + </xsl:variable> + <xsl:attribute name="w:instr"> + <xsl:value-of select="$text-input-attribute"/> + </xsl:attribute> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <xsl:call-template name="field_convert_linebreak"> + <xsl:with-param name="field_input_text" select="text()"/> + </xsl:call-template> + </w:r> + </w:fldSimple> + </xsl:template> + <xsl:template name="field_convert_linebreak"> + <!-- this template convert the linebreak (
 and 
) in continuous text to Ms word element<w:br/> --> + <xsl:param name="field_input_text"/> + <xsl:if test="not (contains($field_input_text,'
'))"> + <w:t> + <xsl:value-of select="$field_input_text"/> + </w:t> + </xsl:if> + <xsl:if test="contains($field_input_text,'
')"> + <w:t> + <xsl:value-of select="translate(substring-before($field_input_text,'
'),'
','')"/> + </w:t> + <w:br/> + <xsl:call-template name="field_convert_linebreak"> + <xsl:with-param name="field_input_text" select="substring-after($field_input_text,'
')"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template name="field_declare"> + <!-- this template export the field declaration to w:docpr --> + <xsl:param name="simple_field_variable_declares"/> + <xsl:param name="user_field_variable_declares"/> + <xsl:param name="field_sequence_declares"/> + <w:docVars> + <xsl:if test="$simple_field_variable_declares/text:variable-decl"> + <xsl:for-each select="$simple_field_variable_declares/text:variable-decl"> + <w:docVar w:name="{@text:name}" w:val="default value"/> + </xsl:for-each> + </xsl:if> + <xsl:if test="$user_field_variable_declares/text:user-field-decl"> + <xsl:for-each select="$user_field_variable_declares/text:user-field-decl"> + <w:docVar w:name="{@text:name}" w:val="{@text:string-value}"/> + </xsl:for-each> + </xsl:if> + <xsl:if test="$field_sequence_declares/text:sequence-decl"> + <!-- do nothing for sequence declares when exporting to MS word--> + </xsl:if> + </w:docVars> + </xsl:template> + <xsl:template match="text:reference-ref | text:bookmark-ref | text:footnote-ref + | text:endnote-ref "> + <!-- this template is for reference fields --> + <w:r> + <w:fldChar w:fldCharType="begin"/> + </w:r> + <xsl:variable name="complicate_field_instruction"> + <xsl:choose> + <xsl:when test=" name() = 'text:reference-ref' "> + <xsl:choose> + <xsl:when test=" string(@text:reference-format) = 'page' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'chapter' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'text' "> + <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'direction' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name() = 'text:footnote-ref' or name() = 'text:endnote-ref' "> + <xsl:choose> + <xsl:when test=" string(@text:reference-format) = 'page' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'chapter' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, '\n \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'text' "> + <xsl:value-of select="concat ( ' NOTEREF ' , @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'direction' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \p \h' ) "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="name() = 'text:bookmark-ref' "> + <xsl:choose> + <xsl:when test=" string(@text:reference-format) = 'page' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, '\h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'chapter' "> + <xsl:value-of select="concat(' PAGEREF ', @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'text' "> + <xsl:value-of select="concat ( ' REF ' , @text:ref-name, ' \h') "/> + </xsl:when> + <xsl:when test="string(@text:reference-format) = 'direction' "> + <xsl:value-of select="concat(' REF ', @text:ref-name, ' \p \h' ) "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat ( ' PAGEREF ', @text:ref-name, '\h')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:variable> + <!--start to combine the complicate field instruction --> + <w:r> + <w:instrText> + <xsl:value-of select="$complicate_field_instruction"/> + </w:instrText> + </w:r> + <w:r> + <w:fldChar w:fldCharType="separate"/> + </w:r> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + <w:r> + <w:fldChar w:fldCharType="end"/> + </w:r> + </xsl:template> + <xsl:template match="text:chapter | text:sender-firstname | text:sender-lastname + | text:sender-street | text:sender-country | text:sender-postal-code + | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:table-count | text:image-count + | text:object-count | text:printed-by | text:hidden-paragraph + | text:placeholder | text:drop-down | text:conditional-text + | text:variable-set | text:table-formula | text:database-display + | text:database-next | text:database-select | text:database-row-number + | text:sequence-ref | text:expression | text:sheet-name | text:dde-connection"> + <!-- this template just export content of staroffice fields that do not have the corresponding fields in MS word ATM --> + <w:r> + <w:rPr> + <w:noProof/> + </w:rPr> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </xsl:template> + <xsl:template match="text:execute-macro | text:variable-decls | text:variable-decl | text:user-field-decls | text:variable-decl | text:sequence-decls | text:sequence-decl | text:page-variable-set | text:bibliography-mark | text:script | text:page-continuation "> + <!-- this template is to ignore matched elements when exporting writer to word --> + </xsl:template> + <xsl:template match="text:a "> + <xsl:call-template name="export_hyoerlink"/> + </xsl:template> + <xsl:template name="export_hyoerlink"> + <!-- all params are used by draw --> + <xsl:param name="TargetMeasure"/> + <xsl:param name="x-adjust"/> + <xsl:param name="y-adjust"/> + <xsl:param name="force-draw"/> + <!-- this template processes the hyperlink in writer --> + <xsl:variable name="hyperlink_filename"> + <xsl:choose> + <xsl:when test="contains(@xlink:href, '#')"> + <xsl:value-of select="substring-before(@xlink:href, '#')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@xlink:href"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="hyperlink_bookmark"> + <xsl:if test="contains(@xlink:href, '#')"> + <xsl:choose> + <xsl:when test="contains(@xlink:href, '%7C')"> + <xsl:call-template name="translate_string"> + <xsl:with-param name="t_input_string" select="substring-before( substring-after(@xlink:href, '#'), '%7C')"/> + <xsl:with-param name="t_pattern_string" select=" '%20' "/> + <xsl:with-param name="t_substitute_string" select=" ' ' "/> + <xsl:with-param name="t_output_string" select=" '' "/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="translate_string"> + <xsl:with-param name="t_input_string" select="substring-after(@xlink:href, '#')"/> + <xsl:with-param name="t_pattern_string" select=" '%20' "/> + <xsl:with-param name="t_substitute_string" select=" ' ' "/> + <xsl:with-param name="t_output_string" select=" '' "/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:variable> + <w:hlink> + <xsl:if test="@xlink:href"> + <xsl:attribute name="w:dest"> + <xsl:value-of select="$hyperlink_filename"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="contains(@xlink:href, '#')"> + <xsl:attribute name="w:bookmark"> + <xsl:value-of select="$hyperlink_bookmark"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@office:target-frame-name"> + <xsl:attribute name="w:target"> + <xsl:value-of select="@office:target-frame-name"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@office:name"> + <xsl:attribute name="w:screenTip"> + <xsl:value-of select="@office:name"/> + </xsl:attribute> + </xsl:if> + <w:r> + <w:rPr> + <w:rStyle w:val="Hyperlink"/> + </w:rPr> + <!--apply inline-text-elements, many many many ... --> + <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text + | text:line-break | text:tab-stop | text:s | text:page-number | text:page-count | text:subject + | text:initial-creator | text:title | text:date | text:time | text:author-name + | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title + | text:sender-position | text:sender-phone-private | text:sender-phone-work + | text:sender-email | text:sender-fax | text:sender-state-or-province | text:word-count + | text:paragraph-count | text:character-count | text:table-count | text:image-count + | text:object-count | text:template-name | text:description | text:creation-time + | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time + | text:modification-date | text:user-defined | text:printed-by | text:hidden-paragraph + | text:placeholder | text:drop-down | text:conditional-text | text:text-input + | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence + | text:page-variable-set | text:page-variable-get | text:table-formula + | text:database-display | text:database-next| text:database-select + | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref + | text:expression | text:measure | text:dde-connection | text:sheet-name + | text:bibliography-mark | text:script | text:page-continuation | office:annotation + | draw:*"> + <xsl:with-param name="TargetMeasure" select="$TargetMeasure"/> + <xsl:with-param name="x-adjust" select="$x-adjust"/> + <xsl:with-param name="y-adjust" select="$y-adjust"/> + <xsl:with-param name="force-draw" select="$force-draw"/> + </xsl:apply-templates> + </w:r> + </w:hlink> + </xsl:template> + <xsl:template name="translate_string"> + <!-- this template is to replace the substring matched t_pattern_string in t_t_input_string with t_substitute_string G.Y.--> + <xsl:param name="t_input_string"/> + <xsl:param name="t_pattern_string"/> + <xsl:param name="t_substitute_string"/> + <xsl:param name="t_output_string"/> + <xsl:variable name="t_temp_output_string"> + <xsl:if test="contains($t_input_string, $t_pattern_string) "> + <xsl:value-of select="concat($t_output_string, substring-before($t_input_string,$t_pattern_string), $t_substitute_string) "/> + </xsl:if> + <xsl:if test="not (contains($t_input_string, $t_pattern_string)) "> + <xsl:value-of select="$t_output_string"/> + </xsl:if> + </xsl:variable> + <xsl:if test="contains($t_input_string, $t_pattern_string) "> + <xsl:call-template name="translate_string"> + <xsl:with-param name="t_input_string" select="substring-after($t_input_string,$t_pattern_string)"/> + <xsl:with-param name="t_pattern_string" select="$t_pattern_string"/> + <xsl:with-param name="t_substitute_string" select="$t_substitute_string"/> + <xsl:with-param name="t_output_string" select="$t_temp_output_string"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not (contains($t_input_string, $t_pattern_string))"> + <xsl:value-of select="concat($t_temp_output_string, $t_input_string)"/> + </xsl:if> + </xsl:template> + <xsl:template name="add_hyperlink_style"> + <!--this template is to add the hyperlink related style --> + <w:style w:type="character" w:styleId="Hyperlink"> + <w:name w:val="Hyperlink"/> + <w:rsid w:val="006A55B0"/> + <w:rPr> + <w:color w:val="000080"/> + <w:u w:val="single"/> + </w:rPr> + </w:style> + <w:style w:type="character" w:styleId="FollowedHyperlink"> + <w:name w:val="FollowedHyperlink"/> + <w:rsid w:val="006A55B0"/> + <w:rPr> + <w:color w:val="800000"/> + <w:u w:val="single"/> + </w:rPr> + </w:style> + </xsl:template> + <xsl:template match="office:annotation"> + <!-- this template export writer note to word comments --> + <xsl:variable name="comments_aml_id"> + <xsl:call-template name="unique_amlid_generator"/> + </xsl:variable> + <aml:annotation w:type="Word.Comment.Start"> + <xsl:attribute name="aml:id"> + <xsl:value-of select="$comments_aml_id"/> + </xsl:attribute> + </aml:annotation> + <aml:annotation w:type="Word.Comment.End"> + <xsl:attribute name="aml:id"> + <xsl:value-of select="$comments_aml_id"/> + </xsl:attribute> + </aml:annotation> + <!-- export aml:annotation content--> + <w:r> + <w:rPr> + <w:rStyle w:val="CommentReference"/> + </w:rPr> + <aml:annotation aml:author="{@office:author}" aml:createdate="{@office:create-date}" w:type="Word.Comment" w:initials="{@office:author}"> + <xsl:attribute name="aml:id"> + <xsl:value-of select="$comments_aml_id"/> + </xsl:attribute> + <aml:content> + <xsl:apply-templates select="text:p"/> + </aml:content> + </aml:annotation> + </w:r> + <!-- end of export aml:annotation content--> + </xsl:template> + <xsl:template name="unique_amlid_generator"> + <!-- this template generate unique id for aml:id, ATM it only counts the office:annotation, some other elements might be added later --> + <xsl:number count="office:annotation" from="/office:document/office:body" level="any" format="1"/> + </xsl:template> + <xsl:template name="add_comments_style"> + <w:style w:type="character" w:styleId="CommentReference"> + <w:name w:val="annotation reference"/> + <w:basedOn w:val="DefaultParagraphFont"/> + <w:semiHidden/> + <w:rsid w:val="007770B7"/> + <w:rPr> + <w:sz w:val="16"/> + <w:sz-cs w:val="16"/> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="CommentText"> + <w:name w:val="annotation text"/> + <w:basedOn w:val="Normal"/> + <w:semiHidden/> + <w:rsid w:val="007770B7"/> + <w:pPr> + <w:pStyle w:val="CommentText"/> + </w:pPr> + <w:rPr> + <w:sz w:val="20"/> + <w:sz-cs w:val="20"/> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="CommentSubject"> + <w:name w:val="annotation subject"/> + <w:basedOn w:val="CommentText"/> + <w:next w:val="CommentText"/> + <w:semiHidden/> + <w:rsid w:val="007770B7"/> + <w:pPr> + <w:pStyle w:val="CommentSubject"/> + </w:pPr> + <w:rPr> + <w:b/> + <w:b-cs/> + </w:rPr> + </w:style> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_list.xsl b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl new file mode 100644 index 000000000..5ebf0e6ac --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_list.xsl @@ -0,0 +1,349 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template name="ListStyles"> + <w:lists> + <xsl:if test="descendant::text:list-level-style-image"> + <xsl:call-template name="PicLists"/> + </xsl:if> + <xsl:apply-templates select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style" mode="style"/> + <xsl:for-each select="office:styles/text:outline-style | office:styles/text:list-style | office:automatic-styles/text:list-style"> + <w:list w:ilfo="{position()}"> + <w:ilst w:val="{position()-1}"/> + </w:list> + </xsl:for-each> + </w:lists> + </xsl:template> + <xsl:template match="text:list-style | text:outline-style" mode="style"> + <w:listDef w:listDefId="{position()-1}"> + <xsl:if test="name(..)='office:styles' and name()!='text:outline-style'"> + <w:styleLink w:val="{@style:name}"/> + </xsl:if> + <xsl:for-each select="text:list-level-style-number | text:list-level-style-bullet | text:list-level-style-image | text:outline-level-style"> + <xsl:if test="@text:level < 10"> + <w:lvl w:ilvl="{ @text:level - 1 }"> + <xsl:if test="name()='text:outline-level-style'"> + <xsl:variable name="headinglevel"> + <xsl:value-of select="@text:level"/> + </xsl:variable> + <xsl:if test="/office:document/office:body//text:h[@text:level=$headinglevel and @text:style-name]"> + <xsl:element name="w:pStyle"> + <xsl:attribute name="w:val"><xsl:value-of select="/office:document/office:body//text:h[@text:level=$headinglevel]/@text:style-name"/></xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:if> + <xsl:choose> + <xsl:when test="@text:start-value"> + <w:start w:val="{@text:start-value}"/> + </xsl:when> + <xsl:otherwise> + <w:start w:val="1"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="@text:bullet-char"> + <w:nfc w:val="23"/> + </xsl:when> + <xsl:when test="@style:num-format"> + <xsl:call-template name="convert_list_number"> + <xsl:with-param name="number-format" select="@style:num-format"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="name()='text:list-level-style-image'"> + <w:lvlText w:val="."/> + <w:lvlPicBulletId> + <xsl:attribute name="w:val"><xsl:value-of select="count(preceding::text:list-level-style-image)"/></xsl:attribute> + </w:lvlPicBulletId> + </xsl:when> + <xsl:when test="@text:bullet-char"> + <w:lvlText w:val="{@text:bullet-char}"/> + </xsl:when> + <xsl:when test="@text:display-levels and not(../@text:consecutive-numbering='true')"> + <xsl:variable name="levelText"> + <xsl:call-template name="displaylevel"> + <xsl:with-param name="number" select="@text:display-levels"/> + <xsl:with-param name="textlevel" select="@text:level"/> + </xsl:call-template> + </xsl:variable> + <w:lvlText w:val="{concat(@style:num-prefix, substring-after($levelText, '.'), @style:num-suffix)}"/> + </xsl:when> + <xsl:otherwise> + <w:lvlText w:val="{concat(@style:num-prefix, '%', @text:level, @style:num-suffix)}"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="style:list-level-properties/@fo:text-align = 'end'"> + <w:lvlJc w:val="right"/> + </xsl:when> + <xsl:when test="style:list-level-properties/@fo:text-align = 'center'"> + <w:lvlJc w:val="center"/> + </xsl:when> + <xsl:otherwise> + <w:lvlJc w:val="left"/> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:space-before | style:list-level-properties/@text:min-label-width | style:list-level-properties/@text:min-label-distance"> + <xsl:call-template name="list_position"/> + </xsl:when> + <xsl:otherwise> + <w:suff w:val="Nothing"/> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates select="key('text-style',@text:style-name)/style:text-properties" mode="character"/> + <xsl:apply-templates select="style:text-properties" mode="character"/> + </w:lvl> + </xsl:if> + </xsl:for-each> + </w:listDef> + </xsl:template> + <xsl:template match="text:list-style" mode="count"> + <xsl:value-of select="count(preceding::text:list-style | preceding::text:outline-style)+1"/> + </xsl:template> + <xsl:template match="text:unordered-list | text:ordered-list | text:list"> + <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list-item | text:list-header | text:list"/> + </xsl:template> + <xsl:template match="text:list-item | text:list-header"> + <xsl:apply-templates select="text:unordered-list | text:ordered-list | text:list | text:p | text:h"/> + </xsl:template> + <xsl:template name="displaylevel"> + <xsl:param name="number"/> + <xsl:param name="textlevel"/> + <xsl:if test="$number > 1"> + <xsl:call-template name="displaylevel"> + <xsl:with-param name="number" select="$number -1"/> + <xsl:with-param name="textlevel" select="number($textlevel)-1"/> + </xsl:call-template> + </xsl:if> + <xsl:value-of select="concat('.','%',$textlevel)"/> + </xsl:template> + <xsl:template name="list_position"> + <xsl:variable name="spacebefore"> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:space-before"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:list-level-properties/@text:space-before"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="space2text"> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:min-label-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-width"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="spacedistance"> + <xsl:choose> + <xsl:when test="style:list-level-properties/@text:min-label-distance"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:list-level-properties/@text:min-label-distance"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="$spacedistance='0' and $space2text='0'"> + <w:suff w:val="Nothing"/> + </xsl:if> + <w:pPr> + <xsl:if test="$spacedistance!='0' or $space2text!='0'"> + <w:tabs> + <w:tab> + <xsl:attribute name="w:val">list</xsl:attribute> + <xsl:attribute name="w:pos"><xsl:choose><xsl:when test="number($spacedistance) > number($space2text)"><xsl:value-of select="number($spacebefore)+number($spacedistance)+150"/></xsl:when><xsl:otherwise><xsl:value-of select="number($spacebefore)+number($space2text)+150"/></xsl:otherwise></xsl:choose></xsl:attribute> + <!-- Since SO MinSpaceDistance is width after number or bullet, MS TabSpaceAfter include the number or bullet width. So +150 --> + </w:tab> + </w:tabs> + </xsl:if> + <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/> + <!-- w:pos(MS TabSpaceAfter) = text:space-before + MAX(text:min-label-distance,text:min-label-width) + ( Symbol width ); w:left(MS IndentAt)= text:space-before + text:min-label-width; w:hanging(MS IndentAt - MS AlignedAt)=text:min-label-width --> + </w:pPr> + </xsl:template> + <xsl:template name="PicLists"> + <xsl:for-each select="descendant::text:list-level-style-image"> + <w:listPicBullet w:listPicBulletId="{position()-1}"> + <w:pict> + <v:shape> + <xsl:variable name="Picwidth"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="style:list-level-properties/@fo:width"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="Picheight"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="style:list-level-properties/@fo:height"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="style"><xsl:value-of select="concat('width:', number($Picwidth*1), 'pt;height:', number($Picheight*1), 'pt')"/></xsl:attribute> + <xsl:attribute name="o:bullet">t</xsl:attribute> + <v:stroke joinstyle="miter"/> + <w:binData w:name="{concat('wordml://SOpicbullet', position(), '.gif')}"> + <xsl:value-of select="office:binary-data"/> + </w:binData> + <v:imagedata src="{concat('wordml://SOpicbullet', position(), '.gif')}" o:title="{concat('SOpicbullet', position())}"/> + </v:shape> + </w:pict> + </w:listPicBullet> + </xsl:for-each> + </xsl:template> + <xsl:template name="convert_list_number"> + <xsl:param name="number-format"/> + <xsl:choose> + <xsl:when test="$number-format = 'a'"> + <!-- nfcLCLetter: Lowercase alpha --> + <w:nfc w:val="4"/> + </xsl:when> + <xsl:when test="$number-format = 'A'"> + <!-- nfcUCLetter: Uppercase alpha --> + <w:nfc w:val="3"/> + </xsl:when> + <xsl:when test="$number-format = 'i'"> + <!-- nfcLCRoman: Lowercase roman --> + <w:nfc w:val="2"/> + </xsl:when> + <xsl:when test="$number-format = 'I'"> + <!-- nfcUCRoman: Uppercase roman --> + <w:nfc w:val="1"/> + </xsl:when> + <xsl:when test="$number-format = '1st'"> + <!-- nfcUCOrdinal: Ordinal indicator --> + <w:nfc w:val="5"/> + </xsl:when> + <xsl:when test="$number-format = 'One'"> + <!-- nfcCardText: Cardinal --> + <w:nfc w:val="6"/> + </xsl:when> + <xsl:when test="$number-format = 'First'"> + <!-- nfcOrdText: Ordinal --> + <w:nfc w:val="7"/> + </xsl:when> + <xsl:when test="$number-format = '1, 2, 3, ...'"> + <!-- '1, 2, 3, ...' also seems: decimal-full-width2 --> + <w:nfc w:val="14"/> + </xsl:when> + <xsl:when test="$number-format = '①, ②, ③, ...'"> + <w:nfc w:val="18"/> + </xsl:when> + <xsl:when test="$number-format = '一, 二, 三, ...'"> + <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand, + taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 --> + <w:nfc w:val="10"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 贰, 叁, ...'"> + <w:nfc w:val="38"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 貳, 參, ...'"> + <w:nfc w:val="34"/> + </xsl:when> + <xsl:when test="$number-format = '甲, 乙, 丙, ...'"> + <w:nfc w:val="30"/> + </xsl:when> + <xsl:when test="$number-format = '子, 丑, 寅, ...'"> + <w:nfc w:val="31"/> + </xsl:when> + <xsl:when test="$number-format = '壱, 弐, 参, ...'"> + <w:nfc w:val="16"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:nfc w:val="12"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:nfc w:val="20"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:nfc w:val="13"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:nfc w:val="21"/> + </xsl:when> + <xsl:when test="$number-format = '일, 이, 삼, ...'"> + <w:nfc w:val="42"/> + </xsl:when> + <xsl:when test="$number-format = '하나, 둘, 셋, ...'"> + <w:nfc w:val="43"/> + </xsl:when> + <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'"> + <!-- mapping circled to uncircled --> + <w:nfc w:val="25"/> + </xsl:when> + <xsl:when test='$number-format = "가, 나, 다, ..." or $number-format = "㉮, ㉯, ㉰, ..."'> + <!-- mapping circled to uncircled --> + <w:nfc w:val="24"/> + </xsl:when> + <xsl:when test="$number-format ='أ, ب, ت, ...'"> + <!-- 46. arabic-alpha--> + <w:nfc w:val="46"/> + </xsl:when> + <xsl:when test="$number-format = 'ก, ข, ฃ, ...'"> + <!--53. thai-letters not match well !--> + <w:nfc w:val="53"/> + </xsl:when> + <xsl:when test="$number-format='א, י, ק, ...'"> + <!--45. hebrew-1--> + <w:nfc w:val="45"/> + </xsl:when> + <xsl:when test="$number-format='א, ב, ג, ...'"> + <!--47. hebrew-2--> + <w:nfc w:val="47"/> + </xsl:when> + <xsl:when test="string-length($number-format)=0"> + <w:nfc w:val="255"/> + </xsl:when> + <xsl:when test="$number-format = 'Native Numbering'"> + <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/> + <xsl:choose> + <xsl:when test="starts-with($locale, 'th-')"> + <!-- for Thai, mapping thai-numbers, thai-counting to thai-numbers --> + <w:nfc w:val="54"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'hi-')"> + <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers --> + <w:nfc w:val="51"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ar-')"> + <!-- for Arabic, mapping arabic-abjad to arabic-alpha --> + <w:nfc w:val="45"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'he-')"> + <!-- for Hebrew, mapping hebrew-2 to --> + <w:nfc w:val="46"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ru-')"> + <!-- for Russian, mapping russian-upper to russian-lower --> + <w:nfc w:val="58"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'vi-')"> + <!-- for Vietnamese --> + <w:nfc w:val="56"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <!-- unsupported: hex, chicago, bullet, ideograph-zodiac-traditional, + chinese-not-impl, korean-legal, none --> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_page.xsl b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl new file mode 100644 index 000000000..d32874e23 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_page.xsl @@ -0,0 +1,392 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template name="page-background"> + <xsl:choose> + <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) > 0]"> + <w:bgPict> + <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties/style:background-image[string-length(office:binary-data/text()) > 0]" mode="bgPict"/> + </w:bgPict> + </xsl:when> + <xsl:when test="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) > 0]"> + <w:bgPict> + <xsl:apply-templates select="/office:document/office:automatic-styles/style:page-layout/style:page-layout-properties[string-length(@fo:background-color) > 0]" mode="bgPict"/> + </w:bgPict> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="style:background-image" mode="bgPict"> + <xsl:variable name="binName" select="concat('wordml://',generate-id(.))"/> + <w:binData w:name="{$binName}"> + <xsl:value-of select="translate(office:binary-data/text(),'	  ','' ) "/> + </w:binData> + <w:background w:bgcolor="{parent::style:page-layout-properties/@fo:background-color}" w:background="{$binName}"/> + </xsl:template> + <xsl:template match="style:page-layout-properties" mode="bgPict"> + <w:background w:bgcolor="{@fo:background-color}"/> + </xsl:template> + <xsl:template match="style:master-page"> + <xsl:apply-templates select="key( 'page-layout', @style:page-layout-name)"/> + <xsl:if test="style:header"> + <w:hdr w:type="odd"> + <xsl:apply-templates select="style:header/text:p | style:header/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:hdr> + </xsl:if> + <xsl:if test="style:header-left"> + <w:hdr w:type="even"> + <xsl:apply-templates select="style:header-left/text:p | style:header-left/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:hdr> + </xsl:if> + <xsl:if test="style:footer"> + <w:ftr w:type="odd"> + <xsl:apply-templates select="style:footer/text:p | style:footer/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:ftr> + </xsl:if> + <xsl:if test="style:footer-left"> + <w:ftr w:type="even"> + <xsl:apply-templates select="style:footer-left/text:p | style:footer-left/table:table"/> + <!-- change style:header//text:p to style:header/text:p and add table:table here, fix for Issue 32035 --> + </w:ftr> + </xsl:if> + </xsl:template> + <xsl:template match="style:page-layout"> + <xsl:choose> + <xsl:when test="@style:page-usage = 'left'"> + <w:type w:val="even-page"/> + </xsl:when> + <xsl:when test="@style:page-usage = 'right'"> + <w:type w:val="odd-page"/> + </xsl:when> + <xsl:when test="@style:page-usage = 'all'"> + <w:type w:val="next-page"/> + </xsl:when> + <!-- for mirrored, and default --> + <xsl:otherwise> + <w:type w:val="next-page"/> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="page-width"> + <xsl:if test="style:page-layout-properties/@fo:page-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-width"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="margin-left"> + <xsl:if test="style:page-layout-properties/@fo:margin-left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-left"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="margin-right"> + <xsl:if test="style:page-layout-properties/@fo:margin-right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-right"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <w:pgSz> + <xsl:if test="style:page-layout-properties/@fo:page-width"> + <xsl:attribute name="w:w"> + <xsl:value-of select="$page-width"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:page-height"> + <xsl:attribute name="w:h"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:page-height"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@style:print-orientation"> + <xsl:attribute name="w:orient"> + <xsl:value-of select="style:page-layout-properties/@style:print-orientation"/> + </xsl:attribute> + </xsl:if> + </w:pgSz> + <w:pgMar> + <xsl:if test="style:page-layout-properties/@fo:margin-top"> + <xsl:variable name="top-margin"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-top"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:top"> + <xsl:value-of select="$top-margin"/> + </xsl:attribute> + <xsl:if test="style:header-style/style:page-layout-properties/@fo:min-height"> + <xsl:variable name="header-height"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:header-style/style:page-layout-properties/@fo:min-height"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:header"> + <xsl:value-of select="$top-margin - $header-height"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:margin-bottom"> + <xsl:variable name="bottom-margin"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:page-layout-properties/@fo:margin-bottom"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:bottom"> + <xsl:value-of select="$bottom-margin"/> + </xsl:attribute> + <xsl:if test="style:footer-style/style:page-layout-properties/@fo:min-height"> + <xsl:variable name="footer-height"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="style:footer-style/style:page-layout-properties/@fo:min-height"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:footer"> + <xsl:value-of select="$bottom-margin - $footer-height"/> + </xsl:attribute> + </xsl:if> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:margin-left"> + <xsl:attribute name="w:left"> + <xsl:value-of select="$margin-left"/> + </xsl:attribute> + <xsl:attribute name="w:gutter"> + <xsl:value-of select="'0'"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:page-layout-properties/@fo:margin-right"> + <xsl:attribute name="w:right"> + <xsl:value-of select="$margin-right"/> + </xsl:attribute> + </xsl:if> + </w:pgMar> + <xsl:variable name="border-top" select="style:page-layout-properties/@fo:border-top | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-bottom" select="style:page-layout-properties/@fo:border-bottom | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-left" select="style:page-layout-properties/@fo:border-left | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-right" select="style:page-layout-properties/@fo:border-right | style:page-layout-properties/@fo:border"/> + <xsl:variable name="border-line-width-top" select="style:page-layout-properties/@style:border-line-width-top | style:page-layout-properties/@style:border-line-width "/> + <xsl:variable name="border-line-width-bottom" select="style:page-layout-properties/@style:border-line-width-bottom | style:page-layout-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-left" select="style:page-layout-properties/@style:border-line-width-left | style:page-layout-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-right" select="style:page-layout-properties/@style:border-line-width-right | style:page-layout-properties/@style:border-line-width"/> + <xsl:variable name="padding-top" select="style:page-layout-properties/@fo:padding-top | style:page-layout-properties/@fo:padding"/> + <xsl:variable name="padding-bottom" select="style:page-layout-properties/@fo:padding-bottom | style:page-layout-properties/@fo:padding"/> + <xsl:variable name="padding-left" select="style:page-layout-properties/@fo:padding-left | style:page-layout-properties/@fo:padding"/> + <xsl:variable name="padding-right" select="style:page-layout-properties/@fo:padding-right | style:page-layout-properties/@fo:padding"/> + <w:pgBorders w:offset-from="text"> + <xsl:if test="$border-top"> + <xsl:element name="w:top"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-top"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/> + <xsl:with-param name="so-border-position" select=" 'top' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-top"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-bottom"> + <xsl:element name="w:bottom"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-bottom"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/> + <xsl:with-param name="so-border-position" select=" 'bottom' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-bottom"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-left"> + <xsl:element name="w:left"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-left"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/> + <xsl:with-param name="so-border-position" select=" 'left' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-right"> + <xsl:element name="w:right"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-right"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/> + <xsl:with-param name="so-border-position" select=" 'right' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-right"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="style:page-layout-properties/@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + </w:pgBorders> + <xsl:variable name="valid-width"> + <xsl:value-of select="$page-width - $margin-left - $margin-right"/> + </xsl:variable> + <xsl:apply-templates select="style:page-layout-properties/style:columns"> + <xsl:with-param name="page-width" select="$valid-width"/> + </xsl:apply-templates> + <xsl:apply-templates select="/office:document/office:styles/text:linenumbering-configuration"/> + </xsl:template> + <xsl:template match="text:linenumbering-configuration"> + <xsl:if test="not(@text:number-lines = 'false')"> + <xsl:element name="w:lnNumType"> + <xsl:if test="@text:increment"> + <xsl:attribute name="w:count-by"> + <xsl:value-of select="@text:increment"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@text:offset"> + <xsl:attribute name="w:distance"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@text:offset"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="w:restart">continuous</xsl:attribute> + </xsl:element> + </xsl:if> + </xsl:template> + <xsl:template match="style:style" mode="section"> + <xsl:param name="master-page"/> + <xsl:variable name="page-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:page-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="margin-left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="margin-right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$master-page/style:page-layout-properties/@fo:margin-right"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="valid-width"> + <xsl:value-of select="$page-width - $margin-left - $margin-right"/> + </xsl:variable> + <w:type w:val="continuous"/> + <xsl:apply-templates select="style:section-properties/style:columns"> + <xsl:with-param name="page-width" select="$valid-width"/> + </xsl:apply-templates> + </xsl:template> + <xsl:template match="style:columns"> + <xsl:param name="page-width"/> + <w:cols w:num="{@fo:column-count}"> + <xsl:if test="@fo:column-gap"> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:column-gap"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="style:column-sep"> + <xsl:attribute name="w:sep">on</xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="not(style:column)"> + <xsl:attribute name="w:equalWidth">on</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:equalWidth">off</xsl:attribute> + <xsl:variable name="column-relative-width"> + <xsl:call-template name="get-sum-column-width"> + <xsl:with-param name="current-column" select="style:column[1]"/> + <xsl:with-param name="current-width" select="'0'"/> + </xsl:call-template> + </xsl:variable> + <xsl:for-each select="style:column"> + <xsl:element name="w:col"> + <xsl:attribute name="w:w"> + <xsl:value-of select="floor(substring-before(@style:rel-width,'*') * $page-width div $column-relative-width)"/> + </xsl:attribute> + <xsl:if test="@fo:margin-right"> + <xsl:variable name="margin-right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-right"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="following-sibling::style:column"> + <xsl:variable name="margin-left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-left"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:space"> + <xsl:value-of select="$margin-right + $margin-left"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:space"> + <xsl:value-of select="$margin-right"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:element> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </w:cols> + </xsl:template> + <xsl:template name="get-sum-column-width"> + <xsl:param name="current-column"/> + <xsl:param name="current-width"/> + <xsl:variable name="new-width" select="$current-width + substring-before($current-column/@style:rel-width,'*')"/> + <xsl:choose> + <xsl:when test="$current-column/following-sibling::style:column"> + <xsl:call-template name="get-sum-column-width"> + <xsl:with-param name="current-column" select="$current-column/following-sibling::style:column[1]"/> + <xsl:with-param name="current-width" select="$new-width"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$new-width"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_path.xsl b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl new file mode 100644 index 000000000..5eafe99ae --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_path.xsl @@ -0,0 +1,849 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:include href="../../common/math.xsl"/> + <xsl:template name="test-arc"> + <xsl:call-template name="svg-arc2vml-arc"> + <!-- M 125,75 a100,50 0 ?,? 100,50 --> + <xsl:with-param name="x0" select="125"/> + <xsl:with-param name="y0" select="75"/> + <xsl:with-param name="rx" select="100"/> + <xsl:with-param name="ry" select="50"/> + <xsl:with-param name="x-axis-rotation" select="0"/> + <xsl:with-param name="large-arc-flag" select="0"/> + <xsl:with-param name="sweep-flag" select="0"/> + <xsl:with-param name="x" select="225"/> + <xsl:with-param name="y" select="125"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="test"> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="'M 36.0 162.0 C 38.0 168.0 39.0-172.0 40.0 176.0 S 42.0 184.0 144.0 188.0'"/> + </xsl:call-template> + </xsl:template> + <xsl:template name="svgpath2vmlpath"> + <xsl:param name="svg-path"/> + <xsl:param name="vml-path" select="''"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command" select="'M'"/> + <xsl:param name="current-x" select="'0'"/> + <xsl:param name="current-y" select="'0'"/> + <xsl:variable name="command-and-newpos"> + <xsl:call-template name="get-path-command"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="command" select="substring-before($command-and-newpos , ':')"/> + <xsl:variable name="newpos" select="substring-after($command-and-newpos , ':')"/> + <xsl:choose> + <xsl:when test="$command = 'M' "> + <!-- absolute moveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' m ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="'L'"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'm' "> + <!-- relative moveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' t ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="'l'"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x"/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'L' "> + <!-- absolute lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'l' "> + <!-- relative lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' r ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'H' "> + <!-- absolute horizontal lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') , ' ' , $current-y , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'h' "> + <!-- relative horizontal lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $num-and-pos , ':') + $current-x , ' ' , $current-y , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $num-and-pos , ':') + $current-x"/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'V' "> + <!-- absolute vertical lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') , ' ' ) "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x"/> + <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'v' "> + <!-- relative horizontal lineto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' l ' ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $current-x , ' ' , substring-before( $num-and-pos , ':') + $current-y , ' ' ) "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x"/> + <xsl:with-param name="current-y" select=" substring-before( $num-and-pos , ':') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'C' "> + <!-- absolute curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'c' "> + <!-- relative curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="4"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'S' "> + <!-- absolute shorthand/smooth curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' c ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control-1"> + <xsl:choose> + <xsl:when test="string-length(translate($last-command, 'CcSs','') )= 0 "> + <xsl:variable name="previous-control-2"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="count" select="2"/> + <xsl:with-param name="skipcount" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring-before($previous-control-2 , ':') "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($control-and-pos, ':') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 's' "> + <!-- absolute shorthand/smooth curveto --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' v ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control-1"> + <xsl:choose> + <xsl:when test="string-length(translate($last-command, 'CcSs' , '')) = 0 "> + <xsl:variable name="previous-control-2"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="count" select="2"/> + <xsl:with-param name="skipcount" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring-before($previous-control-2 , ':') "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($control-and-pos, ':') "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , $control-1 , ' ' , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') + $current-x "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') + $current-y "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'Q' "> + <!-- absolute quadratic bézier curves --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' ) "/> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , substring-before( $control-and-pos , ':') , ' ' , substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( substring-before( $num-and-pos , ':') , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( substring-before( $num-and-pos , ':') , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'q' "> + <!-- relative quadratic bézier curves --> + <xsl:variable name="control-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$newpos"/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="control" select="substring-before( $control-and-pos , ':') "/> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' qb ' , substring-before($control,' ') + $current-x , ' ' , substring-after($control , ' ') + $current-y ) "/> + <xsl:variable name="num-and-pos"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after( $control-and-pos , ':') "/> + <xsl:with-param name="count" select="2"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="number" select="substring-before($num-and-pos, ':')"/> + <xsl:variable name="absolute-number" select="concat(substring-before($number, ' ') + $current-x , ' ' , substring-after($number, ' ') + $current-y)"/> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ' , $absolute-number , ' ') "/> + <xsl:with-param name="position" select=" substring-after( $num-and-pos , ':') "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" substring-before( $absolute-number , ' ') "/> + <xsl:with-param name="current-y" select=" substring-after( $absolute-number , ' ') "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$command = 'Z' or $command = 'z' "> + <!-- closepath --> + <xsl:variable name="new-vml-path" select="concat($vml-path ,' x ' ) "/> + <xsl:call-template name="svgpath2vmlpath"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="vml-path" select=" concat($new-vml-path , ' ') "/> + <xsl:with-param name="position" select=" $newpos "/> + <xsl:with-param name="last-command" select="$command"/> + <xsl:with-param name="current-x" select=" $current-x "/> + <xsl:with-param name="current-y" select=" $current-y"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$vml-path"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-before"> + <!-- get $count number of number before current position , output format:number1 number2 ... numberN:newposition + skip $skipcount of numbers + --> + <xsl:param name="svg-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="count" select="1"/> + <xsl:param name="skipcount" select="0"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$count = 0"> + <xsl:value-of select=" concat($number , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-pos"> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="direction" select="-1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="previous-num-and-pos"> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$num-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$skipcount > 0"> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count"/> + <xsl:with-param name="skipcount" select="$skipcount - 1"/> + <xsl:with-param name="number" select="$number"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$skipcount = 0"> + <xsl:variable name="new-number"> + <xsl:if test="not($count = 1)"> + <xsl:value-of select="' '"/> + </xsl:if> + <xsl:value-of select=" concat( substring-before($previous-num-and-pos , ':') , $number ) "/> + </xsl:variable> + <xsl:call-template name="get-number-before"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($previous-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count - 1"/> + <xsl:with-param name="skipcount" select="0"/> + <xsl:with-param name="number" select="$new-number"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-after"> + <!-- get $count number of number after current position, output format:number1 number2 ... numberN:newposition + skip $skipcount of numbers + --> + <xsl:param name="svg-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="count" select="1"/> + <xsl:param name="skipcount" select="0"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$count = 0"> + <xsl:value-of select=" concat($number , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="num-pos"> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position"/> + <xsl:with-param name="direction" select="1"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="next-num-and-pos"> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$num-pos"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$skipcount > 0"> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count"/> + <xsl:with-param name="skipcount" select="$skipcount - 1"/> + <xsl:with-param name="number" select="$number"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$skipcount = 0"> + <xsl:variable name="new-number"> + <xsl:value-of select=" concat( $number , substring-before($next-num-and-pos , ':') ) "/> + <xsl:if test="not($count = 1)"> + <xsl:value-of select="' '"/> + </xsl:if> + </xsl:variable> + <xsl:call-template name="get-number-after"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="substring-after($next-num-and-pos , ':')"/> + <xsl:with-param name="count" select="$count - 1"/> + <xsl:with-param name="skipcount" select="0"/> + <xsl:with-param name="number" select="$new-number"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-number-position"> + <!-- get the next number start position, direction should be 1 or -1--> + <xsl:param name="svg-path"/> + <xsl:param name="position"/> + <xsl:param name="direction" select="1"/> + <xsl:choose> + <xsl:when test="$direction = 1 and $position > string-length($svg-path) ">0</xsl:when> + <xsl:when test="$direction = -1 and not($position > 0)">0</xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char"> + <xsl:if test="$direction = 1"> + <xsl:value-of select="substring($svg-path, $position , 1)"/> + </xsl:if> + <xsl:if test="$direction = -1"> + <xsl:value-of select="substring($svg-path, $position -1 , 1)"/> + </xsl:if> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '+-.0123456789' ,'')) = 0 "> + <!-- number start--> + <xsl:value-of select="$position"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="get-number-position"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position + $direction"/> + <xsl:with-param name="direction" select="$direction"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-next-number"> + <!-- get the next number from current position--> + <xsl:param name="svg-path"/> + <xsl:param name="position"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="$position > string-length($svg-path) "> + <xsl:value-of select=" concat(round($number) , ':' , $position) "/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 "> + <!-- is number --> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="number" select="concat( $number, $curr-char) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0"> + <!-- is number --> + <xsl:call-template name="get-next-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="number" select="concat( $number, $curr-char) "/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat( round($number) , ':' , $position)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-previous-number"> + <!-- get the previous number from current position--> + <xsl:param name="svg-path"/> + <xsl:param name="position"/> + <xsl:param name="number" select="''"/> + <xsl:choose> + <xsl:when test="not($position > 0)"> + <xsl:value-of select="concat( round($number ), ':0')"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($svg-path, $position -1 , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , '.0123456789' ,'')) = 0 "> + <!-- is number --> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position -1"/> + <xsl:with-param name="number" select="concat($curr-char , $number) "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) = 0"> + <!-- skip it --> + <xsl:call-template name="get-previous-number"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position -1"/> + <xsl:with-param name="number" select="$number "/> + </xsl:call-template> + </xsl:when> + <xsl:when test="string-length(translate($curr-char , '+-' ,'') ) = 0 and string-length($number) > 0"> + <!-- finish it with +/- --> + <xsl:value-of select="concat( round( concat( $curr-char, $number)) , ':' , $position)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat( round($number) , ':' , $position)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="get-path-command"> + <xsl:param name="svg-path"/> + <xsl:param name="position" select="1"/> + <xsl:param name="last-command"/> + <xsl:choose> + <xsl:when test="$position > string-length($svg-path) "/> + <xsl:otherwise> + <xsl:variable name="curr-char" select="substring($svg-path, $position , 1)"/> + <xsl:choose> + <xsl:when test="string-length(translate($curr-char , 'MmZzLlHhVvCcSsQqTtAa' ,'')) = 0 "> + <!-- "MmZzLlHhVvCcSsQqTtAa" are all possible 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 , ',	  ' ,'')) = 0 "> + <!-- space or ',' should be skip --> + <xsl:call-template name="get-path-command"> + <xsl:with-param name="svg-path" select="$svg-path"/> + <xsl:with-param name="position" select="$position +1"/> + <xsl:with-param name="last-command" select="$last-command"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message>ooo2wordml_path.xsl: Find undefined command:<xsl:value-of select="$curr-char"/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template name="svg-arc2vml-arc"> + <xsl:param name="x0"/> + <xsl:param name="y0"/> + <xsl:param name="rx"/> + <xsl:param name="ry"/> + <xsl:param name="x-axis-rotation" select="0"/> + <xsl:param name="large-arc-flag" select="0"/> + <xsl:param name="sweep-flag" select="0"/> + <xsl:param name="x"/> + <xsl:param name="y"/> + <!-- Compute 1/2 distance between current and final point --> + <xsl:variable name="dx2" select="($x0 - $x) div 2"/> + <xsl:variable name="dy2" select="($y0 - $y) div 2"/> + <!-- Convert from degrees to radians --> + <xsl:variable name="rotation-radian" select="$x-axis-rotation * $pi div 180"/> + <!-- Compute (x1, y1). What are x1,y1?--> + <xsl:variable name="cos-rotation"> + <xsl:call-template name="cos"> + <xsl:with-param name="x" select="$rotation-radian"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="sin-rotation"> + <xsl:call-template name="sin"> + <xsl:with-param name="x" select="$rotation-radian"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x1" select="$cos-rotation * $dx2 + $sin-rotation * $dy2"/> + <xsl:variable name="y1" select="-1 * $sin-rotation * $dx2 + $cos-rotation * $dy2"/> + <!-- Make sure radii are large enough --> + <xsl:variable name="rx-abs"> + <xsl:call-template name="abs"> + <xsl:with-param name="x" select="$rx"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="ry-abs"> + <xsl:call-template name="abs"> + <xsl:with-param name="x" select="$ry"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="rx-sq" select="$rx-abs * $rx-abs"/> + <xsl:variable name="ry-sq" select="$ry-abs * $ry-abs"/> + <xsl:variable name="x1-sq" select="$x1 * $x1"/> + <xsl:variable name="y1-sq" select="$y1 * $y1"/> + <xsl:variable name="radius-check" select=" $x1-sq div $rx-sq + $y1-sq div $ry-sq "/> + <xsl:variable name="radius-check-sqrt"> + <xsl:call-template name="sqrt"> + <xsl:with-param name="x" select="$radius-check"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="new-rx"> + <xsl:choose> + <xsl:when test="$radius-check > 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 > 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 > 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 > 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 < 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 < 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) < 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 > 0 "> + <xsl:value-of select=" ($unchecked-delta - 360) mod 360 "/> + </xsl:when> + <xsl:when test=" $sweep-flag = 1 and $unchecked-delta < 0 "> + <xsl:value-of select=" ($unchecked-delta + 360) mod 360 "/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select=" $unchecked-delta mod 360 "/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="concat ($cx, ' ' , $cy, ' ' , $rx, ' ' , $ry, ' ' , $theta, ' ' , $delta, ' ' , $x-axis-rotation) "/> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl new file mode 100644 index 000000000..2130db508 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_settings.xsl @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template match="office:settings"> + <w:docPr> + <w:displayBackgroundShape/> + <xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/> + <xsl:choose> + <xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'"> + <w:view w:val="outline"/> + </xsl:when> + <xsl:otherwise> + <w:view w:val="print"/> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/> + <w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}"> + <xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/> + <xsl:choose> + <xsl:when test="$zoom-type = '3'"> + <xsl:attribute name="w:val">best-fit</xsl:attribute> + </xsl:when> + <xsl:when test="$zoom-type = '2'"> + <xsl:attribute name="w:val">full-page</xsl:attribute> + </xsl:when> + <xsl:when test="$zoom-type = '1'"> + <xsl:attribute name="w:val">text-fit</xsl:attribute> + </xsl:when> + </xsl:choose> + </w:zoom> + <w:defaultTabStop> + <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute> + </w:defaultTabStop> + <xsl:if test="../office:master-styles/style:master-page/style:header-left"> + <w:evenAndOddHeaders/> + </xsl:if> + <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/> + <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/> + <!-- add the variables declaration in w:docpr G.Y. Begin--> + <xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls "> + <xsl:call-template name="field_declare"> + <xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/> + <xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/> + <xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/> + </xsl:call-template> + </xsl:if> + <!--add the variables declaration in w:docpr G.Y. End--> + </w:docPr> + </xsl:template> + <xsl:template match="text:footnotes-configuration"> + <xsl:param name="within-section"/> + <w:footnotePr> + <xsl:choose> + <xsl:when test="@text:footnotes-position = 'document'"> + <w:pos w:val="beneath-text"/> + </xsl:when> + <xsl:otherwise> + <w:pos w:val="page-bottom"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@text:start-value"> + <w:numStart w:val="{@text:start-value + 1}"/> + </xsl:if> + <xsl:if test="@style:num-format"> + <xsl:call-template name="convert-number-format"> + <xsl:with-param name="number-format" select="@style:num-format"/> + <xsl:with-param name="number-prefix" select="@style:num-prefix"/> + <xsl:with-param name="number-suffix" select="@style:num-suffix"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="@text:start-numbering-at"> + <xsl:choose> + <xsl:when test="@text:start-numbering-at = 'document'"> + <w:numRestart w:val="continuous"/> + </xsl:when> + <xsl:when test="@text:start-numbering-at = 'page'"> + <w:numRestart w:val="each-page"/> + </xsl:when> + <!-- convert "chapter" to "section" --> + <xsl:otherwise> + <w:numRestart w:val="each-sect"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="$within-section != 'yes'"> + <!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator + is defined solely in docPr, so not trouble to find the proper footnote-sep definition. --> + <w:footnote w:type="separator"> + <w:p> + <w:r> + <w:separator/> + </w:r> + </w:p> + </w:footnote> + <w:footnote w:type="continuation-separator"> + <w:p> + <w:r> + <w:continuationSeparator/> + <xsl:if test="text:footnote-continuation-notice-backward"> + <w:t> + <xsl:value-of select="text:footnote-continuation-notice-backward"/> + </w:t> + </xsl:if> + </w:r> + </w:p> + </w:footnote> + <xsl:if test="text:footnote-continuation-notice-forward"> + <w:footnote w:type="continuation-notice"> + <w:p> + <w:r> + <w:t> + <xsl:value-of select="text:footnote-continuation-notice-forward"/> + </w:t> + </w:r> + </w:p> + </w:footnote> + </xsl:if> + </xsl:if> + </w:footnotePr> + </xsl:template> + <xsl:template match="text:endnotes-configuration"> + <xsl:param name="within-section"/> + <w:endnotePr> + <w:pos w:val="sect-end"/> + <xsl:if test="@text:start-value"> + <w:numStart w:val="{@text:start-value + 1}"/> + </xsl:if> + <xsl:if test="@style:num-format"> + <xsl:call-template name="convert-number-format"> + <xsl:with-param name="number-format" select="@style:num-format"/> + <xsl:with-param name="number-prefix" select="@style:num-prefix"/> + <xsl:with-param name="number-suffix" select="@style:num-suffix"/> + </xsl:call-template> + </xsl:if> + <w:numRestart w:val="each-sect"/> + <xsl:if test="$within-section != 'yes'"> + <w:endnote w:type="separator"> + <w:p> + <w:r> + <w:separator/> + </w:r> + </w:p> + </w:endnote> + <w:endnote w:type="continuation-separator"> + <w:p> + <w:r> + <w:continuationSeparator/> + </w:r> + </w:p> + </w:endnote> + </xsl:if> + </w:endnotePr> + </xsl:template> + <xsl:template name="convert-number-format"> + <xsl:param name="number-format"/> + <xsl:param name="number-prefix"/> + <xsl:param name="number-suffix"/> + <xsl:choose> + <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'"> + <w:numFmt w:val="decimal-zero"/> + </xsl:when> + <xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'"> + <w:numFmt w:val="decimal-enclosed-fullstop"/> + </xsl:when> + <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'"> + <w:numFmt w:val="decimal-enclosed-paren"/> + </xsl:when> + <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'"> + <w:numFmt w:val="number-in-dash"/> + </xsl:when> + <xsl:when test="$number-format = '1'"> + <!-- '1' also seems: decimal-half-width --> + <w:numFmt w:val="decimal"/> + </xsl:when> + <xsl:when test="$number-format = 'a'"> + <w:numFmt w:val="lower-letter"/> + </xsl:when> + <xsl:when test="$number-format = 'A'"> + <w:numFmt w:val="upper-letter"/> + </xsl:when> + <xsl:when test="$number-format = 'i'"> + <w:numFmt w:val="lower-roman"/> + </xsl:when> + <xsl:when test="$number-format = 'I'"> + <w:numFmt w:val="upper-roman"/> + </xsl:when> + <xsl:when test="$number-format = '1, 2, 3, ...'"> + <!-- '1, 2, 3, ...' also seems: decimal-full-width2 --> + <w:numFmt w:val="decimal-full-width"/> + </xsl:when> + <xsl:when test="$number-format = '①, ②, ③, ...'"> + <!-- decimal-enclosed-circle seems same --> + <w:numFmt w:val="decimal-enclosed-circle-chinese"/> + </xsl:when> + <xsl:when test="$number-format = '一, 二, 三, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'"> + <w:numFmt w:val="ideograph-enclosed-circle"/> + </xsl:when> + <xsl:when test="$number-format = '一, 二, 三, ...'"> + <!-- '一, 二, 三, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand, + taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 --> + <w:numFmt w:val="chinese-counting-thousand"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 贰, 叁, ...'"> + <w:numFmt w:val="chinese-legal-simplified"/> + </xsl:when> + <xsl:when test="$number-format = '壹, 貳, 參, ...'"> + <w:numFmt w:val="ideograph-legal-traditional"/> + </xsl:when> + <xsl:when test="$number-format = '甲, 乙, 丙, ...'"> + <w:numFmt w:val="ideograph-traditional"/> + </xsl:when> + <xsl:when test="$number-format = '子, 丑, 寅, ...'"> + <w:numFmt w:val="ideograph-zodiac"/> + </xsl:when> + <xsl:when test="$number-format = '壱, 弐, 参, ...'"> + <w:numFmt w:val="japanese-legal"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:numFmt w:val="aiueo-full-width"/> + </xsl:when> + <xsl:when test="$number-format = 'ア, イ, ウ, ...'"> + <w:numFmt w:val="aiueo"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:numFmt w:val="iroha-full-width"/> + </xsl:when> + <xsl:when test="$number-format = 'イ, ロ, ハ, ...'"> + <w:numFmt w:val="iroha"/> + </xsl:when> + <xsl:when test="$number-format = '일, 이, 삼, ...'"> + <w:numFmt w:val="korean-counting"/> + </xsl:when> + <xsl:when test="$number-format = '하나, 둘, 셋, ...'"> + <w:numFmt w:val="korean-legal"/> + </xsl:when> + <xsl:when test="$number-format = 'ㄱ, ㄴ, ㄷ, ...' or $number-format = '㉠, ㉡, ㉢, ...'"> + <!-- mapping circled to uncircled --> + <w:numFmt w:val="chosung"/> + </xsl:when> + <xsl:when test="$number-format = '가, 나, 다, ...' or $number-format = '㉮, ㉯, ㉰, ...'"> + <!-- mapping circled to uncircled --> + <w:numFmt w:val="ganada"/> + </xsl:when> + <xsl:when test="$number-format = 'أ, ب, ت, ...'"> + <w:numFmt w:val="arabic-alpha"/> + </xsl:when> + <xsl:when test="$number-format = 'ก, ข, ฃ, ...'"> + <w:numFmt w:val="thai-letters"/> + </xsl:when> + <xsl:when test="$number-format = 'א, י, ק, ...'"> + <w:numFmt w:val="hebrew-1"/> + </xsl:when> + <xsl:when test="$number-format = 'א, ב, ג, ...'"> + <w:numFmt w:val="hebrew-2"/> + </xsl:when> + <xsl:when test="$number-format = 'Native Numbering'"> + <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/> + <xsl:choose> + <xsl:when test="starts-with($locale, 'th-')"> + <!-- for Thai, mapping thai-numbers, thai-counting to thai-letters --> + <w:numFmt w:val="thai-letters"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'hi-')"> + <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers --> + <w:numFmt w:val="hindi-numbers"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ar-')"> + <!-- for Arabic, mapping arabic-abjad to arabic-alpha --> + <w:numFmt w:val="arabic-alpha"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'he-')"> + <!-- for Hebrew, mapping hebrew-2 to --> + <w:numFmt w:val="hebrew-1"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'ru-')"> + <!-- for Russian, mapping russian-upper to russian-lower --> + <w:numFmt w:val="russian-lower"/> + </xsl:when> + <xsl:when test="starts-with($locale, 'vi-')"> + <!-- for Vietnamese --> + <w:numFmt w:val="vietnamese-counting"/> + </xsl:when> + </xsl:choose> + </xsl:when> + <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional, + chinese-not-impl --> + <xsl:otherwise> + <w:numFmt w:val="decimal"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_table.xsl b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl new file mode 100644 index 000000000..6812b8dee --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_table.xsl @@ -0,0 +1,407 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:key name="table-style" match="style:style[@style:family='table']" use="@style:name"/> + <xsl:key name="table-column-style" match="style:style[@style:family='table-column']" use="@style:name"/> + <xsl:key name="table-row-style" match="style:style[@style:family='table-row']" use="@style:name"/> + <xsl:key name="table-cell-style" match="style:style[@style:family='table-cell']" use="@style:name"/> + <xsl:template match="style:table-properties" mode="table"> + <xsl:param name="within-body"/> + <xsl:if test="$within-body = 'yes'"> + <w:tblW> + <xsl:choose> + <xsl:when test="@style:rel-width"> + <xsl:attribute name="w:w"><xsl:value-of select="substring-before(@style:rel-width, '%') * 50"/></xsl:attribute> + <xsl:attribute name="w:type">pct</xsl:attribute> + </xsl:when> + <xsl:when test="@style:width"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@style:width"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="w:type">dxa</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:w">0</xsl:attribute> + <xsl:attribute name="w:type">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:tblW> + </xsl:if> + <w:tblInd> + <xsl:choose> + <xsl:when test="@fo:margin-left"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="@fo:margin-left"/></xsl:call-template></xsl:attribute> + <xsl:attribute name="w:type">dxa</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:w">0</xsl:attribute> + <xsl:attribute name="w:type">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:tblInd> + <xsl:if test="@table:align"> + <w:jc> + <xsl:choose> + <xsl:when test="@table:align = 'left' or @table:align= 'center' or @table:align = 'right'"> + <xsl:attribute name="w:val"><xsl:value-of select="@table:align"/></xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val">left</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:jc> + </xsl:if> + </xsl:template> + <xsl:template match="table:table"> + <!--fix for issue i32030 pagebreak before--> + <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"> + <xsl:variable name="table-break-before" select="key('table-style', @table:style-name)/style:table-properties/@fo:break-before"/> + <xsl:choose> + <xsl:when test="$table-break-before = 'page' "> + <w:p> + <w:r> + <w:br w:type="page"/> + </w:r> + </w:p> + </xsl:when> + <xsl:when test="$table-break-before = 'column' "> + <w:p> + <w:r> + <w:br w:type="column"/> + </w:r> + </w:p> + </xsl:when> + </xsl:choose> + </xsl:if> + <w:tbl> + <w:tblPr> + <xsl:if test="not (@table:is-sub-table) or (@table:is-sub-table = 'false' )"> + <w:tblStyle w:val="{@table:style-name}"/> + <xsl:apply-templates select="key('table-style', @table:style-name)/style:table-properties" mode="table"> + <xsl:with-param name="within-body" select="'yes'"/> + </xsl:apply-templates> + </xsl:if> + <xsl:if test="@table:is-sub-table ='true' "> + <w:tblW w:type="dxa"> + <xsl:variable name="sub-table-width"> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="table:table-column[1]"/> + <xsl:with-param name="total-sub-table-width" select="0"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:w"><xsl:value-of select="$sub-table-width"/></xsl:attribute> + </w:tblW> + <!--w:tblLayout w:type="Fixed"/--> + </xsl:if> + </w:tblPr> + <w:tblGrid> + <xsl:apply-templates select="table:table-column"/> + </w:tblGrid> + <xsl:apply-templates select="table:table-header-rows/table:table-row | table:table-row"/> + </w:tbl> + <!--fix for issue i32030 pagebreak after--> + <xsl:if test="key('table-style', @table:style-name)/style:table-properties/@fo:break-after"> + <xsl:variable name="table-break-after" select=" key('table-style', @table:style-name)/style:table-properties/@fo:break-after"/> + <xsl:choose> + <xsl:when test="$table-break-after = 'page' "> + <w:p> + <w:r> + <w:br w:type="page"/> + </w:r> + </w:p> + </xsl:when> + <xsl:when test="$table-break-after = 'column' "> + <w:p> + <w:r> + <w:br w:type="column"/> + </w:r> + </w:p> + </xsl:when> + </xsl:choose> + </xsl:if> + <xsl:if test="name(..)= 'table:table-cell' "> + <w:p/> + </xsl:if> + </xsl:template> + <xsl:template name="calculate-sub-table-width"> + <xsl:param name="sub-table-column-node"/> + <xsl:param name="total-sub-table-width"/> + <xsl:variable name="column-width" select="key('table-column-style', $sub-table-column-node/@table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="column-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$column-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$sub-table-column-node/following-sibling::table:table-column"> + <xsl:choose> + <xsl:when test="$sub-table-column-node/@table:number-columns-repeated"> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[ 1]"/> + <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="$sub-table-column-node/following-sibling::table:table-column[1]"/> + <xsl:with-param name="total-sub-table-width" select="$total-sub-table-width + $column-width-in-twip "/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="$sub-table-column-node/@table:number-columns-repeated"> + <xsl:value-of select="$total-sub-table-width + $column-width-in-twip * $sub-table-column-node/@table:number-columns-repeated"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$total-sub-table-width + $column-width-in-twip "/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="table:table-column"> + <xsl:variable name="column-width" select="key('table-column-style', @table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="column-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$column-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <!-- if table:table-column has attribute table:number-columns-repeated, then call the recursion + temple repeat-gridcol to produce multiple w:gridCol in MS word. Gary.Yang --> + <xsl:when test="@table:number-columns-repeated"> + <xsl:call-template name="repeat-gridcol"> + <xsl:with-param name="grid-repeat-count" select="@table:number-columns-repeated"/> + <xsl:with-param name="column-width" select="$column-width-in-twip"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <w:gridCol w:w="{$column-width-in-twip}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!--recursion template for produce multiple w:gridCol Gary.Yang--> + <xsl:template name="repeat-gridcol"> + <xsl:param name="grid-repeat-count"/> + <xsl:param name="column-width"/> + <xsl:if test="$grid-repeat-count > 0"> + <w:gridCol w:w="{$column-width}"/> + <xsl:call-template name="repeat-gridcol"> + <xsl:with-param name="grid-repeat-count" select="$grid-repeat-count - 1"/> + <xsl:with-param name="column-width" select="$column-width"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <xsl:template match="table:table-row"> + <xsl:element name="w:tr"> + <xsl:element name="w:trPr"> + <xsl:if test="parent::table:table-header-rows"> + <!-- fix for Issue 32034--> + <w:tblHeader>on</w:tblHeader> + </xsl:if> + <xsl:variable name="row-height" select="key('table-row-style', @table:style-name)/style:table-row-properties/@style:row-height"/> + <xsl:if test="$row-height"> + <w:trHeight> + <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$row-height"/></xsl:call-template></xsl:attribute> + </w:trHeight> + </xsl:if> + </xsl:element> + <!--end of w:trPr--> + <xsl:apply-templates select="table:table-cell "/> + </xsl:element> + </xsl:template> + <xsl:template match="table:table-cell "> + <xsl:element name="w:tc"> + <xsl:element name="w:tcPr"> + <!-- to calculate the table-cell width Gary.Yang --> + <xsl:choose> + <!--when the table-cell contains the sub-table --> + <xsl:when test="table:table/@table:is-sub-table= 'true' "> + <xsl:variable name="table-cell-width"> + <xsl:call-template name="calculate-sub-table-width"> + <xsl:with-param name="sub-table-column-node" select="table:table/table:table-column[1]"/> + <xsl:with-param name="total-sub-table-width" select="0"/> + </xsl:call-template> + </xsl:variable> + <w:tcW w:type="dxa"> + <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute> + </w:tcW> + </xsl:when> + <xsl:otherwise> + <!-- when the table-cell doesn't contain the sub-table --> + <xsl:variable name="table-cell-width"> + <xsl:call-template name="calculate-table-cell-width"> + <xsl:with-param name="table-cell-position" select="position()"/> + <xsl:with-param name="table-column" select="ancestor::table:table[1]/table:table-column[1]"/> + </xsl:call-template> + </xsl:variable> + <w:tcW w:type="dxa"> + <xsl:attribute name="w:w"><xsl:value-of select="$table-cell-width"/></xsl:attribute> + </w:tcW> + <!-- for performance issue, we can set w:type to auto that makes the cell width auto fit the content. --> + <!--w:tcW w:w="0" w:type="auto"/--> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@table:number-columns-spanned"> + <w:gridSpan w:val="{@table:number-columns-spanned}"/> + </xsl:if> + <xsl:variable name="cell-style-properties" select="key('table-cell-style', @table:style-name)/style:table-cell-properties"/> + <xsl:if test="$cell-style-properties/@fo:background-color"> + <w:shd w:val="solid" w:color="{substring-after($cell-style-properties/@fo:background-color,'#')}"/> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:vertical-align"> + <xsl:choose> + <xsl:when test="$cell-style-properties/@fo:vertical-align = 'middle'"> + <w:vAlign w:val="center"/> + </xsl:when> + <xsl:when test="$cell-style-properties/@fo:vertical-align = 'Automatic'"> + <w:vAlign w:val="both"/> + </xsl:when> + <xsl:otherwise> + <w:vAlign w:val="{$cell-style-properties/@fo:vertical-align}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <w:tcMar> + <xsl:if test="$cell-style-properties/@fo:padding-top"> + <w:top w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-top"/></xsl:call-template></xsl:attribute> + </w:top> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:padding-bottom"> + <w:bottom w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-bottom"/></xsl:call-template></xsl:attribute> + </w:bottom> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:padding-left"> + <w:left w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-left"/></xsl:call-template></xsl:attribute> + </w:left> + </xsl:if> + <xsl:if test="$cell-style-properties/@fo:padding-right"> + <w:right w:type="dxa"> + <xsl:attribute name="w:w"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="$cell-style-properties/@fo:padding-right"/></xsl:call-template></xsl:attribute> + </w:right> + </xsl:if> + </w:tcMar> + <!-- the following code is to get the cell borders if they exist --> + <xsl:variable name="border-top" select="$cell-style-properties/@fo:border-top | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-bottom" select="$cell-style-properties/@fo:border-bottom | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-left" select="$cell-style-properties/@fo:border-left | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-right" select="$cell-style-properties/@fo:border-right | $cell-style-properties/@fo:border"/> + <xsl:variable name="border-line-width-top" select="$cell-style-properties/@style:border-line-width-top | $cell-style-properties/@style:border-line-width "/> + <xsl:variable name="border-line-width-bottom" select="$cell-style-properties/@style:border-line-width-bottom | $cell-style-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-left" select="$cell-style-properties/@style:border-line-width-left | $cell-style-properties/@style:border-line-width"/> + <xsl:variable name="border-line-width-right" select="$cell-style-properties/@style:border-line-width-right | $cell-style-properties/@style:border-line-width"/> + <xsl:element name="w:tcBorders"> + <xsl:if test="$border-top"> + <xsl:element name="w:top"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-top"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/> + <xsl:with-param name="so-border-position" select=" 'top' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$border-bottom"> + <xsl:element name="w:bottom"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-bottom"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/> + <xsl:with-param name="so-border-position" select=" 'bottom' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$border-left"> + <xsl:element name="w:left"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-left"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/> + <xsl:with-param name="so-border-position" select=" 'left' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + <xsl:if test="$border-right"> + <xsl:element name="w:right"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-right"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/> + <xsl:with-param name="so-border-position" select=" 'right' "/> + </xsl:call-template> + </xsl:element> + </xsl:if> + </xsl:element> + </xsl:element> + <xsl:if test="not (*) "> + <w:p/> + </xsl:if> + <xsl:apply-templates select=" text:p | table:table | text:h | office:annotation"/> + </xsl:element> + </xsl:template> + <xsl:template name="calculate-table-cell-width"> + <xsl:param name="table-cell-position"/> + <xsl:param name="table-column"/> + <xsl:choose> + <xsl:when test="$table-column/@table:number-columns-repeated"> + <xsl:choose> + <xsl:when test="($table-cell-position - $table-column/@table:number-columns-repeated) <= 0"> + <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="table-cell-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$table-cell-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$table-cell-width-in-twip"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="calculate-table-cell-width"> + <xsl:with-param name="table-cell-position" select="$table-cell-position - $table-column/@table:number-columns-repeated"/> + <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- if the $table-column doesn't contain the table:number-columns-repeated attribute --> + <xsl:choose> + <xsl:when test="($table-cell-position - 1) = 0"> + <xsl:variable name="table-cell-width" select="key('table-column-style', $table-column/@table:style-name)/style:table-column-properties/@style:column-width"/> + <xsl:variable name="table-cell-width-in-twip"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$table-cell-width"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$table-cell-width-in-twip"/> + </xsl:when> + <xsl:when test="($table-cell-position - 1) > 0"> + <xsl:call-template name="calculate-table-cell-width"> + <xsl:with-param name="table-cell-position" select=" $table-cell-position - 1 "/> + <xsl:with-param name="table-column" select="$table-column/following-sibling::table:table-column[1]"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:value-of select=" 'calculate table cell width wrong ' "/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/filter/source/xslt/export/wordml/ooo2wordml_text.xsl b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl new file mode 100644 index 000000000..406c8cb91 --- /dev/null +++ b/filter/source/xslt/export/wordml/ooo2wordml_text.xsl @@ -0,0 +1,1270 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw"> + <xsl:template match="style:paragraph-properties" mode="paragraph"> + <w:pPr> + <w:adjustRightInd w:val="off"/> + <xsl:if test="@fo:break-before = 'page'"> + <w:pageBreakBefore w:val="on"/> + </xsl:if> + <xsl:if test="contains(@style:writing-mode, 'rl')"> + <w:bidi/> + </xsl:if> + <xsl:choose> + <xsl:when test="@fo:text-align-last = 'start'"> + <xsl:choose> + <xsl:when test="contains(@style:writing-mode, 'rl')"> + <w:jc w:val="right"/> + </xsl:when> + <xsl:otherwise> + <w:jc w:val="left"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@fo:text-align-last = 'justify'"> + <w:jc w:val="distribute"/> + </xsl:when> + <xsl:when test="@fo:text-align-last = 'center'"> + <w:jc w:val="center"/> + </xsl:when> + <xsl:when test="@fo:text-align = 'start'"> + <xsl:choose> + <xsl:when test="contains(@style:writing-mode, 'rl')"> + <w:jc w:val="right"/> + </xsl:when> + <xsl:otherwise> + <w:jc w:val="left"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@fo:text-align = 'end'"> + <xsl:choose> + <xsl:when test="contains(@style:writing-mode, 'rl')"> + <w:jc w:val="left"/> + </xsl:when> + <xsl:otherwise> + <w:jc w:val="right"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@fo:text-align = 'justify'"> + <w:jc w:val="distribute"/> + </xsl:when> + <xsl:when test="@fo:text-align = 'center'"> + <w:jc w:val="center"/> + </xsl:when> + </xsl:choose> + <w:spacing> + <xsl:choose> + <xsl:when test="@fo:line-height"> + <xsl:choose> + <xsl:when test="contains(@fo:line-height, '%')"> + <xsl:attribute name="w:line-rule">auto</xsl:attribute> + <xsl:attribute name="w:line"> + <xsl:value-of select="round(substring-before(@fo:line-height, '%') div 100 * 240)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:line-rule">exact</xsl:attribute> + <xsl:attribute name="w:line"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:line-height"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:line-height-at-least"> + <xsl:attribute name="w:line-rule">at-least</xsl:attribute> + <xsl:attribute name="w:line"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@style:line-height-at-least"/> + </xsl:call-template> + </xsl:attribute> + </xsl:when> + <xsl:when test="@style:line-spacing"> + <xsl:attribute name="w:line-rule">auto</xsl:attribute> + <xsl:variable name="spacing"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@style:line-spacing"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:line"> + <xsl:value-of select="round($spacing div 0.567)"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="@fo:margin-top"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-top, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-top"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:before"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-top, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:before"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-top"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:margin-bottom"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-bottom, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-bottom"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:after"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-bottom, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:after"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-bottom"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </w:spacing> + <w:ind> + <xsl:if test="@fo:margin-left"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-left, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-left"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:left"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-left, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-left"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:margin-right"> + <xsl:choose> + <xsl:when test="contains(@fo:margin-right, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:margin-right"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:right"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:margin-right, '%'))"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:margin-right"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:text-indent"> + <xsl:choose> + <!-- When @style:auto-text-indent='true' @fo:text-indent ignored, use 283 for all font size --> + <xsl:when test="@style:auto-text-indent='true'"> + <xsl:attribute name="w:first-line">283</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@fo:text-indent, '%')"> + <xsl:if test="../@style:parent-style-name"> + <xsl:variable name="parent-size"> + <xsl:value-of select="key('paragraph-style', ../@style:parent-style-name)/style:paragraph-properties/@fo:text-indent"/> + </xsl:variable> + <xsl:variable name="w-number"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$parent-size"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$w-number < 0"> + <xsl:attribute name="w:hanging"> + <xsl:value-of select="round($w-number div -100 * substring-before(@fo:text-indent, '%'))"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:first-line"> + <xsl:value-of select="round($w-number div 100 * substring-before(@fo:text-indent, '%'))"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:when> + <xsl:when test="starts-with(@fo:text-indent,'-')"> + <xsl:attribute name="w:hanging"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="substring-after(@fo:text-indent,'-')"/> + </xsl:call-template> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:first-line"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:text-indent"/> + </xsl:call-template> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </w:ind> + <xsl:if test="contains(@fo:background-color, '#')"> + <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/> + </xsl:if> + <xsl:if test="@fo:keep-with-next='true'"> + <w:keepNext/> + </xsl:if> + <xsl:choose> + <xsl:when test="@fo:widows | @fo:orphans"> + <w:widowControl w:val="on"/> + </xsl:when> + <xsl:otherwise> + <w:widowControl w:val="off"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@style:break-inside = 'avoid'"> + <w:keepLines/> + </xsl:if> + <xsl:if test="@fo:hyphenate = 'false'"> + <w:suppressAutoHyphens/> + </xsl:if> + <xsl:if test="@style:snap-to-layout-grid='false'"> + <w:snapToGrid w:val="off"/> + </xsl:if> + <xsl:if test="style:tab-stops"> + <w:tabs> + <xsl:for-each select="style:tab-stops/style:tab-stop"> + <w:tab> + <xsl:choose> + <xsl:when test="@style:type='char'"> + <xsl:attribute name="w:val">decimal</xsl:attribute> + </xsl:when> + <xsl:when test="@style:type"> + <xsl:attribute name="w:val"> + <xsl:value-of select="@style:type"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val">left</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@style:leader-char"> + <xsl:choose> + <xsl:when test="@style:leader-char='-'"> + <xsl:attribute name="w:leader">hyphen</xsl:attribute> + </xsl:when> + <xsl:when test="@style:leader-char='_'"> + <xsl:attribute name="w:leader">underscore</xsl:attribute> + </xsl:when> + <xsl:when test="@style:leader-char='.'"> + <xsl:attribute name="w:leader">dot</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:leader">dot</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@style:position"> + <xsl:attribute name="w:pos"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@style:position"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </w:tab> + </xsl:for-each> + </w:tabs> + </xsl:if> + <xsl:if test="@style:line-break='normal'"> + <w:kinsoku w:val="off"/> + </xsl:if> + <xsl:if test="@style:punctuation-wrap='simple'"> + <w:overflowPunct w:val="off"/> + </xsl:if> + <xsl:if test="@style:text-autospace='none'"> + <w:autoSpaceDE w:val="off"/> + <w:autoSpaceDN w:val="off"/> + </xsl:if> + <xsl:if test="@style:vertical-align"> + <xsl:element name="w:textAlignment"> + <xsl:choose> + <xsl:when test="@style:vertical-align='middle'"> + <xsl:attribute name="w:val">center</xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val"> + <xsl:value-of select="@style:vertical-align"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:if> + <xsl:if test="@text:number-lines='false'"> + <w:suppressLineNumbers/> + </xsl:if> + <xsl:variable name="border-top" select="@fo:border-top | @fo:border"/> + <xsl:variable name="border-bottom" select="@fo:border-bottom | @fo:border"/> + <xsl:variable name="border-left" select="@fo:border-left | @fo:border"/> + <xsl:variable name="border-right" select="@fo:border-right | @fo:border"/> + <xsl:variable name="border-line-width-top" select="@style:border-line-width-top | @style:border-line-width "/> + <xsl:variable name="border-line-width-bottom" select="@style:border-line-width-bottom | @style:border-line-width"/> + <xsl:variable name="border-line-width-left" select="@style:border-line-width-left | @style:border-line-width"/> + <xsl:variable name="border-line-width-right" select="@style:border-line-width-right | @style:border-line-width"/> + <xsl:variable name="padding-top" select="@fo:padding-top | @fo:padding"/> + <xsl:variable name="padding-bottom" select="@fo:padding-bottom | @fo:padding"/> + <xsl:variable name="padding-left" select="@fo:padding-left | @fo:padding"/> + <xsl:variable name="padding-right" select="@fo:padding-right | @fo:padding"/> + <w:pBdr> + <xsl:if test="$border-top"> + <xsl:element name="w:top"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-top"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-top"/> + <xsl:with-param name="so-border-position" select=" 'top' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-top"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-bottom"> + <xsl:element name="w:bottom"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-bottom"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-bottom"/> + <xsl:with-param name="so-border-position" select=" 'bottom' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-bottom"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-left"> + <xsl:element name="w:left"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-left"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-left"/> + <xsl:with-param name="so-border-position" select=" 'left' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-left"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="$border-right"> + <xsl:element name="w:right"> + <xsl:call-template name="get-border"> + <xsl:with-param name="so-border" select="$border-right"/> + <xsl:with-param name="so-border-line-width" select="$border-line-width-right"/> + <xsl:with-param name="so-border-position" select=" 'right' "/> + </xsl:call-template> + <xsl:attribute name="w:space"> + <xsl:call-template name="convert2pt"> + <xsl:with-param name="value" select="$padding-right"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="@style:shadow!='none'"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + </xsl:if> + </xsl:element> + </xsl:if> + <xsl:if test="@style:shadow!='none' and not(@fo:border-top | @fo:border-bottom | @fo:border-left | @fo:border-right | @fo:border)"> + <xsl:element name="w:right"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + <xsl:attribute name="w:val">single</xsl:attribute> + <xsl:variable name="shadow-size"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:sz"> + <xsl:choose> + <xsl:when test="$shadow-size <= 0.08">12</xsl:when> + <xsl:when test="$shadow-size <= 0.14">18</xsl:when> + <xsl:when test="$shadow-size <= 0.20">24</xsl:when> + <xsl:when test="$shadow-size <= 0.25">36</xsl:when> + <xsl:otherwise>48</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:element> + <xsl:element name="w:bottom"> + <xsl:attribute name="w:shadow">on</xsl:attribute> + <xsl:attribute name="w:val">single</xsl:attribute> + <xsl:variable name="shadow-size"> + <xsl:call-template name="convert2cm"> + <xsl:with-param name="value" select="substring-after(substring-after(@style:shadow, ' '), ' ')"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="w:sz"> + <xsl:choose> + <xsl:when test="$shadow-size <= 0.08">12</xsl:when> + <xsl:when test="$shadow-size <= 0.14">18</xsl:when> + <xsl:when test="$shadow-size <= 0.20">24</xsl:when> + <xsl:when test="$shadow-size <= 0.25">36</xsl:when> + <xsl:otherwise>48</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:element> + </xsl:if> + </w:pBdr> + <w:ind> + <xsl:if test="$padding-left!=''"> + <xsl:attribute name="w:left"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$padding-left"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + <xsl:if test="$padding-right!='' "> + <xsl:attribute name="w:right"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="$padding-right"/> + </xsl:call-template> + </xsl:attribute> + </xsl:if> + </w:ind> + <xsl:variable name="stylename"> + <xsl:value-of select="../@style:name"/> + </xsl:variable> + <xsl:if test="/office:document/office:body//text:h[@text:style-name = $stylename]"> + <xsl:variable name="headinglevel"> + <xsl:value-of select="/office:document/office:body//text:h[@text:style-name = $stylename]/@text:level"/> + </xsl:variable> + <xsl:if test="/office:document/office:styles/text:outline-style/text:outline-level-style[@text:level = $headinglevel]"> + <w:listPr> + <w:ilvl w:val="{$headinglevel -1}"/> + <w:ilfo w:val="1"/> + </w:listPr> + </xsl:if> + </xsl:if> + </w:pPr> + </xsl:template> + <xsl:template match="style:text-properties" mode="character"> + <w:rPr> + <xsl:if test="@svg:font-family | @style:font-name | @style:font-name-asian | @style:font-name-complex"> + <w:rFonts> + <xsl:variable name="fontname"> + <xsl:choose> + <xsl:when test='starts-with(@svg:font-family,"'")'> + <xsl:value-of select='substring-before(substring-after(@svg:font-family,"'"),"'")'/> + </xsl:when> + <xsl:when test="@svg:font-family"> + <xsl:value-of select="@svg:font-family"/> + </xsl:when> + <xsl:when test="@style:font-name"> + <xsl:value-of select="@style:font-name"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:if test="string-length($fontname)!=0"> + <xsl:attribute name="w:ascii"> + <xsl:value-of select="$fontname"/> + </xsl:attribute> + <xsl:attribute name="w:h-ansi"> + <xsl:value-of select="$fontname"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@style:font-name-asian"> + <xsl:attribute name="w:fareast"> + <xsl:value-of select="@style:font-name-asian"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@style:font-name-complex"> + <xsl:attribute name="w:cs"> + <xsl:value-of select="@style:font-name-complex"/> + </xsl:attribute> + </xsl:if> + </w:rFonts> + </xsl:if> + <!-- relative font sizes not supported yet. --> + <xsl:if test="contains(@fo:font-size, 'pt')"> + <w:sz w:val="{substring-before(@fo:font-size,'pt') * 2}"/> + </xsl:if> + <xsl:if test="contains(@fo:font-size-complex, 'pt')"> + <w:sz-cs w:val="{substring-before(@fo:font-size-complex, 'pt') * 2}"/> + </xsl:if> + <xsl:if test="@fo:font-style = 'italic' or @fo:font-style-asian = 'italic'"> + <w:i/> + </xsl:if> + <xsl:if test="@fo:font-style-complex = 'italic'"> + <w:i-cs/> + </xsl:if> + <xsl:if test="@fo:font-weight = 'bold' or @fo:font-weight-asian = 'bold'"> + <w:b/> + </xsl:if> + <xsl:if test="@fo:font-weight-complex = 'bold'"> + <w:b-cs/> + </xsl:if> + <xsl:if test="@style:text-underline-style"> + <w:u> + <xsl:variable name="w-u"> + <xsl:choose> + <xsl:when test="@style:text-underline-style = 'solid'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">thick</xsl:when> + <xsl:otherwise>single</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dotted'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dotted-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dotted-heavy</xsl:when> + <xsl:otherwise>dotted</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dashed-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dashed-heavy</xsl:when> + <xsl:otherwise>dash</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'long-dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dash-long-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dash-long-heavy</xsl:when> + <xsl:otherwise>dash-long</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dot-dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dot-dash-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-heavy</xsl:when> + <xsl:otherwise>dot-dash</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'dot-dot-dash'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">dot-dot-dash-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">dash-dot-dot-heavy</xsl:when> + <xsl:otherwise>dot-dot-dash</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@style:text-underline-style = 'wave'"> + <xsl:choose> + <xsl:when test="@style:text-underline-type = 'double'">wavy-double</xsl:when> + <xsl:when test="@style:text-underline-width = 'bold'">wavy-heavy</xsl:when> + <xsl:otherwise>wave</xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style:text-underline-style"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:attribute name="w:val"> + <xsl:value-of select="$w-u"/> + </xsl:attribute> + <xsl:if test="contains(@style:text-underline-color,'#')"> + <xsl:attribute name="w:color"> + <xsl:value-of select="substring-after(@style:text-underline-color,'#')"/> + </xsl:attribute> + </xsl:if> + </w:u> + </xsl:if> + <xsl:if test="@style:text-shadow | @fo:text-shadow"> + <w:shadow/> + </xsl:if> + <xsl:if test="string-length(@style:text-line-through-style) > 0"> + <xsl:choose> + <xsl:when test="@style:text-line-through-type = 'double'"> + <w:dstrike/> + </xsl:when> + <xsl:when test="@style:text-line-through-style = 'solid'"> + <w:strike/> + </xsl:when> + <xsl:otherwise> + <w:strike/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@fo:color"> + <w:color> + <xsl:choose> + <xsl:when test="@fo:color != '#000000'"> + <xsl:attribute name="w:val"> + <xsl:value-of select="substring-after(@fo:color,'#')"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="w:val">auto</xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </w:color> + </xsl:if> + <xsl:if test="@fo:font-variant = 'small-caps'"> + <w:smallCaps/> + </xsl:if> + <xsl:if test="@fo:text-transform = 'uppercase'"> + <w:caps/> + </xsl:if> + <xsl:if test="@style:font-relief = 'engraved'"> + <w:imprint/> + </xsl:if> + <xsl:if test="@style:font-relief = 'embossed'"> + <w:emboss/> + </xsl:if> + <xsl:if test="@style:text-outline = 'true'"> + <w:outline/> + </xsl:if> + <xsl:if test="contains(@style:text-scale,'%')"> + <w:w w:val="{substring-before(@style:text-scale,'%')}"/> + </xsl:if> + <xsl:if test="@style:text-emphasize"> + <w:em> + <xsl:choose> + <xsl:when test="contains(@style:text-emphasize, 'accent')"> + <xsl:attribute name="w:val">comma</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'disc')"> + <xsl:attribute name="w:val">under-dot</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'none')"> + <xsl:attribute name="w:val">none</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'dot below')"> + <xsl:attribute name="w:val">under-dot</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'dot above')"> + <xsl:attribute name="w:val">dot</xsl:attribute> + </xsl:when> + <xsl:when test="contains(@style:text-emphasize, 'circle')"> + <xsl:attribute name="w:val">dot</xsl:attribute> + </xsl:when> + </xsl:choose> + </w:em> + </xsl:if> + <xsl:if test="@fo:letter-spacing != 'normal'"> + <w:spacing> + <xsl:attribute name="w:val"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="@fo:letter-spacing"/> + </xsl:call-template> + </xsl:attribute> + </w:spacing> + </xsl:if> + <xsl:if test="@style:text-blinking = 'true'"> + <w:effect w:val="blink-background"/> + </xsl:if> + <xsl:if test="@fo:language | @fo:language-asian | @fo:language-complex"> + <w:lang> + <xsl:if test="@fo:language and @fo:country"> + <xsl:attribute name="w:val"> + <xsl:value-of select="concat(@fo:language, '-', @fo:country)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@fo:language-asian and @fo:country-asian"> + <xsl:attribute name="w:fareast"> + <xsl:value-of select="concat(@fo:language-asian, '-', @fo:country-asian)"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@fo:language-complex and @fo:language-complex"> + <xsl:attribute name="w:bidi"> + <xsl:value-of select="concat(@fo:language-complex, '-', @fo:language-complex)"/> + </xsl:attribute> + </xsl:if> + </w:lang> + </xsl:if> + <xsl:if test="@style:text-position"> + <xsl:variable name="position"> + <xsl:choose> + <xsl:when test="starts-with(@style:text-position, 'super')">superscript_0</xsl:when> + <xsl:when test="starts-with(@style:text-position, 'sub')">subscript_0</xsl:when> + <xsl:when test="starts-with(@style:text-position, '-')"> + <xsl:value-of select="concat('subscript_', substring-before(@style:text-position,'%'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('superscript_', substring-before(@style:text-position,'%'))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:vertAlign> + <xsl:attribute name="w:val"> + <xsl:value-of select="substring-before($position,'_')"/> + </xsl:attribute> + </w:vertAlign> + <!-- Raised/Lowed position is difficult to map to MSWord w:position, Writer use %, but Word use half-point(not relative position). Since it's difficult to get font-size, use 12pt as default font-size --> + <w:position> + <xsl:attribute name="w:val"> + <xsl:choose> + <xsl:when test="substring-after($position, '_') = 0">0</xsl:when> + <xsl:otherwise> + <xsl:value-of select="round(substring-after($position, '_') div 6)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </w:position> + </xsl:if> + <xsl:if test="@text:display = 'true'"> + <w:vanish/> + </xsl:if> + <xsl:if test="contains(@fo:background-color, '#')"> + <w:shd w:val="clear" w:color="auto" w:fill="{substring-after(@fo:background-color, '#')}"/> + </xsl:if> + </w:rPr> + </xsl:template> + <xsl:template match="text:p | text:h"> + <w:p> + <w:pPr> + <xsl:if test="@text:style-name"> + <w:pStyle w:val="{@text:style-name}"/> + </xsl:if> + <xsl:if test="@text:level"> + <w:outlineLvl w:val="{@text:level - 1}"/> + </xsl:if> + <xsl:variable name="following-paragraph-heading-table" select="following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table')]"/> + <xsl:variable name="following-section" select="following::text:section[1]"/> + <xsl:variable name="ancestor-section" select="ancestor::text:section"/> + <!-- if the following neighbour paragraph/heading are slave of one master style, or new section starts, + then a new page will start --> + <xsl:variable name="next-is-new-page" select="boolean(key( 'slave-style', $following-paragraph-heading-table[1]/@*[name()='text:style-name' or name()='table:style-name']))"/> + <xsl:variable name="next-is-new-section"> + <xsl:if test="$following-section and generate-id($following-section/descendant::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])"> + <xsl:value-of select="'yes'"/> + </xsl:if> + </xsl:variable> + <xsl:variable name="next-is-section-end"> + <xsl:if test="$ancestor-section and generate-id($ancestor-section[1]/following::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and position() =1]) = generate-id($following-paragraph-heading-table[1])"> + <xsl:value-of select="'yes'"/> + </xsl:if> + </xsl:variable> + <xsl:if test="ancestor::office:body and not(ancestor::text:footnote or ancestor::text:endnote) and ($next-is-new-page or $next-is-new-section = 'yes' or $next-is-section-end = 'yes')"> + <w:sectPr> + <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"> + <xsl:with-param name="within-section" select="'yes'"/> + </xsl:apply-templates> + <xsl:choose> + <xsl:when test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])"> + <xsl:apply-templates select="key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/> + <xsl:if test="$ancestor-section"> + <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section"> + <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/> + </xsl:apply-templates> + </xsl:if> + <xsl:if test="key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"> + <!-- in M$ word the header and footer associate with the w:sectPr, but in StarOffice writer the header and footer associate with the style:master-page --> + <xsl:variable name="pagenumber_start"> + <xsl:value-of select=" key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number"/> + </xsl:variable> + <xsl:if test=" number($pagenumber_start) > 0 "> + <w:pgNumType w:start="{$pagenumber_start}"/> + </xsl:if> + <!-- comment out the below line to enable the header and footer display normally when style:page-number =0 --> + <!--w:pgNumType w:start="{key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])/style:paragraph-properties/@style:page-number}"/ --> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="preceding-style" select="preceding::*[(name()= 'text:p' or name()= 'text:h' or name()= 'table:table') and key( 'slave-style', @*[name()='text:style-name' or name()='table:style-name'])]"/> + <xsl:choose> + <xsl:when test="$preceding-style"> + <xsl:apply-templates select="key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="/office:document/office:master-styles/style:master-page[1]"/> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="$ancestor-section"> + <xsl:choose> + <xsl:when test="$preceding-style"> + <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section"> + <xsl:with-param name="master-page" select="key( 'page-layout', key('master-page', key( 'slave-style', $preceding-style[1]/@*[name()='text:style-name' or name()='table:style-name'])[1]/@style:master-page-name)/@style:page-layout-name)"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="key('section-style',$ancestor-section[1]/@text:style-name)" mode="section"> + <xsl:with-param name="master-page" select="/office:document/office:automatic-styles/style:page-layout[1]"/> + </xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </w:sectPr> + </xsl:if> + <!-- add for office:annotation style G.Y. --> + <xsl:if test="name(..)= 'office:annotation' "> + <w:pStyle w:val="CommentText"/> + </xsl:if> + <!-- add by wym for listPr --> + <xsl:if test="ancestor::text:ordered-list | ancestor::text:unordered-list | ancestor::text:list"> + <xsl:variable name="listname"> + <xsl:value-of select="ancestor::text:ordered-list/@text:style-name | ancestor::text:unordered-list/@text:style-name | ancestor::text:list/@text:style-name"/> + </xsl:variable> + <xsl:variable name="currlevel"> + <xsl:value-of select="count(ancestor::text:list-item|ancestor::text:list-header)"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($listname)!=0 and $currlevel < 10"> + <xsl:variable name="currlist"> + <xsl:apply-templates select="key('list-style', $listname)" mode="count"/> + </xsl:variable> + <w:listPr> + <w:ilvl w:val="{number($currlevel)-1}"/> + <w:ilfo w:val="{$currlist}"/> + </w:listPr> + </xsl:when> + <xsl:when test="string-length($listname)!=0"> + <xsl:for-each select="key('list-style', $listname)"> + <xsl:variable name="spacebefore"> + <xsl:choose> + <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:space-before"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="space2text"> + <xsl:choose> + <xsl:when test="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width"> + <xsl:call-template name="convert2twip"> + <xsl:with-param name="value" select="*[@text:level=$currlevel]/style:list-level-properties/@text:min-label-width"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <w:ind w:left="{number($space2text)+number($spacebefore)}" w:hanging="{$space2text}"/> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <w:listPr> + <w:ilvl w:val="{number($currlevel)-1}"/> + <w:ilfo w:val="1"/> + </w:listPr> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <!-- end of listPr --> + </w:pPr> + <!-- get break column from style --> + <xsl:variable name="style" select="key('paragraph-style', @text:style-name)/style:paragraph-properties"/> + <xsl:if test="$style/@fo:break-before = 'column'"> + <w:r> + <w:br w:type="column"/> + </w:r> + </xsl:if> + <xsl:if test="parent::office:text and not(preceding-sibling::text:p)"> + <xsl:call-template name="PageLevelGraphic"/> + </xsl:if> + <xsl:if test="parent::text:footnote-body and not(preceding-sibling::*)"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-style-name}"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:footnote-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:footnote-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:footnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <xsl:if test="parent::text:endnote-body and not(preceding-sibling::*)"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-style-name}"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:endnote-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:endnote-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:endnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <!-- newly added the endnote , footnote templates --> + <xsl:if test="../../@text:note-class='endnote' and not(preceding-sibling::*)"> + <xsl:message> + <xsl:value-of select=" 'enter into ext:note-class= endnote' "/> + </xsl:message> + <w:r> + <w:rPr> + <w:rStyle w:val="Endnote_20_Symbol"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:note-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:note-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:footnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <xsl:if test="../../@text:note-class='footnote' and not(preceding-sibling::*)"> + <xsl:message> + <xsl:value-of select=" 'enter into ext:note-class= footnote' "/> + </xsl:message> + <w:r> + <w:rPr> + <w:rStyle w:val="Footnote_20_Symbol"/> + </w:rPr> + <xsl:choose> + <xsl:when test="../../text:note-citation/@text:label"> + <w:t> + <xsl:value-of select="../../text:note-citation/@text:label"/> + </w:t> + </xsl:when> + <xsl:otherwise> + <w:footnoteRef/> + </xsl:otherwise> + </xsl:choose> + </w:r> + <w:r> + <w:tab/> + </w:r> + </xsl:if> + <!-- apply inline-text-elements, many many many ... :( glu --> + <xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop + | text:s | text:note | draw:* + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark + "/> + <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format --> + <!--xsl:apply-templates select="text:a | text:span | text() | text:hidden-text | text:line-break | text:tab-stop + | text:s | text:footnote | text:endnote | draw:* + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark + "/--> + <xsl:if test="$style/@fo:break-after"> + <w:r> + <w:br w:type="{$style/@fo:break-after}"/> + </w:r> + </xsl:if> + </w:p> + </xsl:template> + <xsl:template match="text:span"> + <!-- apply inline-text-elements, many many many ... :( glu --> + <xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s + | text:note + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark +"/> + <!-- comment out the following line to replace the text:footnote , text:endnote with text:note in OASIS format --> + <!-- xsl:apply-templates select="text:a | text() | text:hidden-text | text:line-break | text:tab-stop | text:s + | text:footnote | text:endnote + | text:page-number | text:page-count | text:subject | text:initial-creator | text:title | text:date | text:time + | text:author-name | text:author-initials | text:chapter | text:file-name | text:sender-company + | text:sender-firstname | text:sender-lastname | text:sender-initials | text:sender-street + | text:sender-country | text:sender-postal-code | text:sender-city | text:sender-title | text:sender-position + | text:sender-phone-private | text:sender-phone-work | text:sender-email | text:sender-fax + | text:sender-state-or-province | text:word-count | text:paragraph-count | text:character-count + | text:table-count | text:image-count | text:object-count | text:template-name | text:description + | text:creation-time | text:creation-date | text:editing-cycles | text:editing-duration | text:keywords + | text:print-time | text:print-date | text:creator | text:modification-time | text:modification-date + | text:user-defined | text:printed-by | text:hidden-paragraph | text:placeholder | text:drop-down + | text:conditional-text | text:text-input | text:execute-macro | text:variable-set | text:variable-input + | text:user-field-input | text:variable-get | text:user-field-get | text:sequence | text:page-variable-set + | text:page-variable-get | text:table-formula | text:database-display | text:database-next + | text:database-select | text:database-row-number | text:database-name | text:reference-ref + | text:bookmark-ref | text:footnote-ref | text:endnote-ref | text:sequence-ref | text:expression + | text:measure | text:dde-connection | text:sheet-name | text:bibliography-mark | text:script + | text:page-continuation | office:annotation | text:bookmark-start | text:bookmark-end | text:bookmark +"/--> + </xsl:template> + <xsl:template match="text()"> + <xsl:if test="string-length(normalize-space(.)) > 0"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:t> + <xsl:value-of select="."/> + </w:t> + </w:r> + </xsl:if> + </xsl:template> + <xsl:template match="text:hidden-text"> + <w:r> + <w:rPr> + <xsl:if test="parent::text:span"> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </xsl:if> + <w:vanish/> + </w:rPr> + <w:t> + <xsl:value-of select="@text:string-value"/> + </w:t> + </w:r> + </xsl:template> + <xsl:template match="text:line-break"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:br w:type="text-wrapping" w:clear="all"/> + </w:r> + </xsl:template> + <xsl:template match="text:tab-stop"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:tab/> + </w:r> + </xsl:template> + <xsl:template match="text:s"> + <w:r> + <xsl:if test="parent::text:span"> + <w:rPr> + <w:rStyle w:val="{parent::text:span/@text:style-name}"/> + </w:rPr> + </xsl:if> + <w:t> + <xsl:if test="@text:c"> + <xsl:call-template name="add-space"> + <xsl:with-param name="number" select="@text:c"/> + </xsl:call-template> + </xsl:if> + <xsl:text> </xsl:text> + </w:t> + </w:r> + </xsl:template> + <xsl:template name="add-space"> + <xsl:param name="number"/> + <xsl:if test="$number > 1"> + <xsl:call-template name="add-space"> + <xsl:with-param name="number" select="$number - 1"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:template> + <xsl:template match="text:footnote"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:footnotes-configuration/@text:citation-body-style-name}"/> + </w:rPr> + <xsl:apply-templates select="text:footnote-body"/> + </w:r> + </xsl:template> + <xsl:template match="text:footnote-body"> + <w:footnote> + <xsl:if test="../text:footnote-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:footnote> + </xsl:template> + <xsl:template match="text:endnote"> + <w:r> + <w:rPr> + <w:rStyle w:val="{/office:document/office:styles/text:endnotes-configuration/@text:citation-body-style-name}"/> + </w:rPr> + <xsl:apply-templates select="text:endnote-body"/> + </w:r> + </xsl:template> + <xsl:template match="text:endnote-body"> + <w:endnote> + <xsl:if test="../text:endnote-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:endnote> + </xsl:template> + <xsl:template match="text:bookmark-start"> + <xsl:variable name="bookmark-id"> + <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/> + </xsl:variable> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/> + </xsl:template> + <xsl:template match="text:bookmark-end"> + <xsl:variable name="bookmark-id"> + <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/> + </xsl:variable> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/> + </xsl:template> + <xsl:template match="text:bookmark"> + <xsl:variable name="bookmark-id"> + <xsl:number from="/office:document/office:body" count="text:bookmark | text:bookmark-start" level="any" format="1"/> + </xsl:variable> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.Start" w:name="{@text:name}"/> + <aml:annotation aml:id="{$bookmark-id}" w:type="Word.Bookmark.End"/> + </xsl:template> + <!-- newly added the endnote , footnote templates --> + <xsl:template match="text:note"> + <xsl:choose> + <xsl:when test="@text:note-class = 'endnote' "> + <w:r> + <w:rPr> + <w:rStyle w:val="Endnote"/> + </w:rPr> + <xsl:apply-templates select="text:note-body"/> + </w:r> + </xsl:when> + <xsl:when test="@text:note-class = 'footnote' "> + <w:r> + <w:rPr> + <w:rStyle w:val="Footnote"/> + </w:rPr> + <xsl:apply-templates select="text:note-body"/> + </w:r> + </xsl:when> + </xsl:choose> + </xsl:template> + <xsl:template match="text:note-body"> + <xsl:choose> + <xsl:when test="../@text:note-class='endnote' "> + <w:endnote> + <xsl:if test="../text:note-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:endnote> + </xsl:when> + <xsl:when test="../@text:note-class='footnote' "> + <w:footnote> + <xsl:if test="../text:note-citation/@text:label"> + <xsl:attribute name="w:suppressRef">on</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="text:h | text:p | text:ordered-list | text:unordered-list | text:list"/> + </w:footnote> + </xsl:when> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> |